Skip to content

Commit 413f2cf

Browse files
committed
Updated Rector to commit c2be58d6df9eb6aa5dfc6707cf397a80dd39fefd
rectorphp/rector-src@c2be58d [CodeQuality] Skip possibly undefined variable on SimplifyEmptyCheckOnEmptyArrayRector (#8006)
1 parent f87e84c commit 413f2cf

2 files changed

Lines changed: 14 additions & 2 deletions

File tree

src/Application/VersionResolver.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ final class VersionResolver
1919
* @api
2020
* @var string
2121
*/
22-
public const PACKAGE_VERSION = '74c490771253f9cba68cf92c2adb02ba78524193';
22+
public const PACKAGE_VERSION = 'c2be58d6df9eb6aa5dfc6707cf397a80dd39fefd';
2323
/**
2424
* @api
2525
* @var string
2626
*/
27-
public const RELEASE_DATE = '2026-05-24 01:15:30';
27+
public const RELEASE_DATE = '2026-05-24 20:34:08';
2828
/**
2929
* @var int
3030
*/

src/NodeAnalyzer/ExprAnalyzer.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,18 @@
5353
use PHPStan\Type\ObjectWithoutClassType;
5454
use PHPStan\Type\UnionType;
5555
use Rector\Enum\ObjectReference;
56+
use Rector\NodeNameResolver\NodeNameResolver;
5657
use Rector\NodeTypeResolver\Node\AttributeKey;
5758
final class ExprAnalyzer
5859
{
60+
/**
61+
* @readonly
62+
*/
63+
private NodeNameResolver $nodeNameResolver;
64+
public function __construct(NodeNameResolver $nodeNameResolver)
65+
{
66+
$this->nodeNameResolver = $nodeNameResolver;
67+
}
5968
public function isBoolExpr(Expr $expr): bool
6069
{
6170
return $expr instanceof BooleanNot || $expr instanceof Empty_ || $expr instanceof Isset_ || $expr instanceof Instanceof_ || $expr instanceof Bool_ || $expr instanceof Equal || $expr instanceof NotEqual || $expr instanceof Identical || $expr instanceof NotIdentical || $expr instanceof Greater || $expr instanceof GreaterOrEqual || $expr instanceof Smaller || $expr instanceof SmallerOrEqual || $expr instanceof BooleanAnd || $expr instanceof BooleanOr || $expr instanceof LogicalAnd || $expr instanceof LogicalOr || $expr instanceof LogicalXor;
@@ -107,6 +116,9 @@ public function isNonTypedFromParam(Expr $expr): bool
107116
if ($nativeType instanceof ObjectWithoutClassType && !$type instanceof ObjectWithoutClassType) {
108117
return \true;
109118
}
119+
if (!$scope->hasVariableType((string) $this->nodeNameResolver->getName($expr))->yes()) {
120+
return \true;
121+
}
110122
if ($nativeType instanceof UnionType) {
111123
return !$nativeType->equals($type);
112124
}

0 commit comments

Comments
 (0)