We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d1c38c7 commit 237757cCopy full SHA for 237757c
1 file changed
rules/Php85/Rector/ArrayDimFetch/ArrayFirstLastRector.php
@@ -7,6 +7,7 @@
7
use PhpParser\Node;
8
use PhpParser\Node\Expr\ArrayDimFetch;
9
use PhpParser\Node\Expr\FuncCall;
10
+use Rector\NodeTypeResolver\Node\AttributeKey;
11
use Rector\PHPStan\ScopeFetcher;
12
use Rector\Rector\AbstractRector;
13
use Rector\ValueObject\PhpVersionFeature;
@@ -88,6 +89,10 @@ public function refactor(Node $node): ?FuncCall
88
89
return null;
90
}
91
92
+ if ($node->getAttribute(AttributeKey::IS_UNSET_VAR)) {
93
+ return null;
94
+ }
95
+
96
$functionName = $this->isName($node->dim, self::ARRAY_KEY_FIRST)
97
? 'array_first'
98
: 'array_last';
0 commit comments