mirror of https://github.com/rectorphp/rector.git
Updated Rector to commit e2ba601e7ca2e8d602bfc2ffa36bf60a88b1a1f0
e2ba601e7c
[DeadCode] Skip return false pseudo type in union on RemoveUselessReturnTagRector (#5172)
This commit is contained in:
parent
41683b4c5a
commit
5479401552
|
@ -78,9 +78,9 @@ final class DeadReturnTagValueNodeAnalyzer
|
|||
if ($this->mixedArrayTypeNodeAnalyzer->hasMixedArrayType($returnTagValueNode->type)) {
|
||||
return \false;
|
||||
}
|
||||
return !$this->hasTruePseudoType($returnTagValueNode->type);
|
||||
return !$this->hasTrueFalsePseudoType($returnTagValueNode->type);
|
||||
}
|
||||
private function hasTruePseudoType(BracketsAwareUnionTypeNode $bracketsAwareUnionTypeNode) : bool
|
||||
private function hasTrueFalsePseudoType(BracketsAwareUnionTypeNode $bracketsAwareUnionTypeNode) : bool
|
||||
{
|
||||
$unionTypes = $bracketsAwareUnionTypeNode->types;
|
||||
foreach ($unionTypes as $unionType) {
|
||||
|
@ -88,7 +88,7 @@ final class DeadReturnTagValueNodeAnalyzer
|
|||
continue;
|
||||
}
|
||||
$name = \strtolower((string) $unionType);
|
||||
if ($name === 'true') {
|
||||
if (\in_array($name, ['true', 'false'], \true)) {
|
||||
return \true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
declare (strict_types=1);
|
||||
namespace Rector\DeadCode\Rector\If_;
|
||||
|
||||
use PhpParser\Node\Expr\ArrayDimFetch;
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Expr;
|
||||
use PhpParser\Node\Expr\BinaryOp\BooleanAnd;
|
||||
|
@ -185,7 +186,7 @@ CODE_SAMPLE
|
|||
}
|
||||
private function shouldSkipForeachExpr(Expr $foreachExpr, Scope $scope) : bool
|
||||
{
|
||||
if ($foreachExpr instanceof Expr\ArrayDimFetch && $foreachExpr->dim !== null) {
|
||||
if ($foreachExpr instanceof ArrayDimFetch && $foreachExpr->dim !== null) {
|
||||
$exprType = $this->nodeTypeResolver->getNativeType($foreachExpr->var);
|
||||
$dimType = $this->nodeTypeResolver->getNativeType($foreachExpr->dim);
|
||||
if (!$exprType->hasOffsetValueType($dimType)->yes()) {
|
||||
|
|
|
@ -19,12 +19,12 @@ final class VersionResolver
|
|||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const PACKAGE_VERSION = '9cf016cd67a9f12ebbc7ae7aaa422626eb5722a9';
|
||||
public const PACKAGE_VERSION = 'e2ba601e7ca2e8d602bfc2ffa36bf60a88b1a1f0';
|
||||
/**
|
||||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const RELEASE_DATE = '2023-10-15 00:26:09';
|
||||
public const RELEASE_DATE = '2023-10-15 09:03:46';
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue