Skip to content

Fix deep ArrayItem scope filling on Foreach_ value#7873

Merged
samsonasik merged 1 commit intomainfrom
handle-deep-array-item
Feb 3, 2026
Merged

Fix deep ArrayItem scope filling on Foreach_ value#7873
samsonasik merged 1 commit intomainfrom
handle-deep-array-item

Conversation

@samsonasik
Copy link
Member

Use of failing fixture on rector-phpunit:

Before

There was 1 error:

1) Rector\PHPUnit\Tests\CodeQuality\Rector\CallLike\DirectInstanceOverMockArgRector\DirectInstanceOverMockArgRectorTest::test with data set #4 ('/Users/samsonasik/www/rector-...hp.inc')
Rector\Exception\ShouldNotHappenException: Scope not available on "PhpParser\Node\ArrayItem" node. Fix scope refresh on changed nodes first

/Users/samsonasik/www/rector-phpunit/vendor/rector/rector-src/src/PHPStan/ScopeFetcher.php:26
/Users/samsonasik/www/rector-phpunit/rules/CodeQuality/Rector/CallLike/DirectInstanceOverMockArgRector.php:91

After

➜  rector-phpunit git:(add-failing) vendor/bin/phpunit rules-tests/CodeQuality/Rector/CallLike/DirectInstanceOverMockArgRector
PHPUnit 11.5.46 by Sebastian Bergmann and contributors.

Runtime:       PHP 8.4.16
Configuration: /Users/samsonasik/www/rector-phpunit/phpunit.xml

......                                                              6 / 6 (100%)

Time: 00:00.745, Memory: 80.50 MB

OK (6 tests, 7 assertions)

@samsonasik
Copy link
Member Author

All green 🎉 , @TomasVotruba let's merge ;)

@samsonasik samsonasik merged commit ca9da16 into main Feb 3, 2026
57 checks passed
@samsonasik samsonasik deleted the handle-deep-array-item branch February 3, 2026 07:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant