Skip to content

Commit 237757c

Browse files
committed
fix
1 parent d1c38c7 commit 237757c

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

rules/Php85/Rector/ArrayDimFetch/ArrayFirstLastRector.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use PhpParser\Node;
88
use PhpParser\Node\Expr\ArrayDimFetch;
99
use PhpParser\Node\Expr\FuncCall;
10+
use Rector\NodeTypeResolver\Node\AttributeKey;
1011
use Rector\PHPStan\ScopeFetcher;
1112
use Rector\Rector\AbstractRector;
1213
use Rector\ValueObject\PhpVersionFeature;
@@ -88,6 +89,10 @@ public function refactor(Node $node): ?FuncCall
8889
return null;
8990
}
9091

92+
if ($node->getAttribute(AttributeKey::IS_UNSET_VAR)) {
93+
return null;
94+
}
95+
9196
$functionName = $this->isName($node->dim, self::ARRAY_KEY_FIRST)
9297
? 'array_first'
9398
: 'array_last';

0 commit comments

Comments
 (0)