Skip to content

Fix ArrayItem scope filling on Foreach_ value - #7858

Merged
samsonasik merged 2 commits into
mainfrom
fix-array-item
Jan 26, 2026
Merged

Fix ArrayItem scope filling on Foreach_ value#7858
samsonasik merged 2 commits into
mainfrom
fix-array-item

Conversation

@samsonasik

@samsonasik samsonasik commented Jan 26, 2026

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 #3 ('/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-fixture-crash) 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

.....                                                               5 / 5 (100%)

Time: 00:00.619, Memory: 76.50 MB

OK (5 tests, 6 assertions)

@samsonasik

Copy link
Copy Markdown
Member Author

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

@samsonasik
samsonasik merged commit ea5089e into main Jan 26, 2026
58 of 59 checks passed
@samsonasik
samsonasik deleted the fix-array-item branch January 26, 2026 17:48
@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.

2 participants