Skip to content

Fix deep ArrayItem scope filling on Foreach_ value - #7873

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

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

Conversation

@samsonasik

Copy link
Copy Markdown
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
Copy Markdown
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
@github-actions

Copy link
Copy Markdown
Contributor

This pull request has been automatically locked because it has been closed for 150 days. Please open a new PR if you want to continue the work.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Aug 23, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant