Ask the node-callback scope directly instead of toMutatingScope() - #789
Merged
Conversation
Member
|
You have to require ^2.2.10 at the same time 😊 |
phpstan-src deprecated Scope::toMutatingScope() - the callback scope now answers every ask itself - so this call fails phpstan-doctrine's own `make phpstan` on the extension-tests lane of every phpstan-src pull request. Calling getType() on the scope is what the deprecation message recommends. It answers from the walk's stored results from 2.2.10 onwards, so the constraint moves with it. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
SanderMuller
force-pushed
the
scope-direct-ask
branch
from
August 26, 2026 08:19
7655b4d to
7a94de8
Compare
Contributor
Author
|
Done - Note the install will not resolve until 2.2.10 is tagged, so CI here stays red until then. |
Member
|
Thank you! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
phpstan-src deprecated
Scope::toMutatingScope()(4cc5e5e51, kept as an alias ina7a9bb794), somake phpstanhere fails on theextension-tests / phpstan-doctrinelane of every phpstan-src pull request:The deprecation message says: "The scope answers every ask directly - call the methods on the scope itself, or
toWalkScope()for the engine-facing walk scope." SinceOtherMethodQueryBuilderParseronly wants the type of areturnexpression inside a node callback, asking the scope directly is the whole change:The advantage over
toWalkScope()is that this works on the PHPStan already required here, so"phpstan/phpstan": "^2.2.2"stays as it is and nothing has to wait for a release.toWalkScope()does not exist in any release yet - 2.2.9 predates the rename - so that route needs^2.2.10first, as @ondrejmirtes noted in phpstan/phpstan#15110.Verification (against the installed 2.2.9)
vendor/bin/phpstan analyse -c phpstan.neon:[OK] No errors.One caveat I could not close locally: the extension-tests lane runs against a compiled phar of phpstan-src, which I cannot build here, so I have not executed this against dev phpstan-src - only reasoned from the deprecation's own guidance plus the covered tests on 2.2.9. If you would rather take the route @ondrejmirtes suggested (
^2.2.10plustoWalkScope()), say so and I will switch it.Refs phpstan/phpstan#15110