Repository navigation
Drop the @phpstan-impure tip and the PossiblyImpureCallExpr entries behind it - #6771
Merged
Merged
Conversation
…ehind it The tip was the only reader of the PossiblyImpureCallExpr entries the call handlers put into the scope after every call to a possibly impure user function or method - a quarter of all expression-table entries, copied, merged, compared and freed by every later scope derivation. Remembering possibly impure values (rememberPossiblyImpureFunctionValues) is unchanged. tips.possiblyImpure stays in the schema as a no-op so existing configs keep working; RuleErrorBuilder::possiblyImpureTip() stays as @api. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MMNnG2Zo7wgvSZCzjdk17X
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.
The "If X::foo() is impure, add @phpstan-impure PHPDoc tag above its declaration" tip was the only reader of the
PossiblyImpureCallExprentries the call handlers put into the scope after every call to a possibly impure user function or method. Those entries were a quarter of all expression-table entries, and every later scope derivation copied, merged, compared and freed them.This removes the tip together with everything that only fed it:
PossiblyImpureCallExpr, itsPossiblyImpureCallExprHandlerand printer methodMethodCallHandler,StaticCallHandlerandFuncCallScopeEffectsHelperMutatingScope::findPossiblyImpureCallDescriptions()and the special cases ingetDifferingVariableRoots()PossiblyImpureTipHelperand its use in the 19 constant-condition and impossible-check rules, which return to their shape from before the tipPossibly impure values are still remembered exactly as before (
rememberPossiblyImpureFunctionValues). Only the tip text is gone, and reported errors are unchanged. Kept for backward compatibility:tips.possiblyImpurestays in the schema as a no-op, so configs that set it keep working.RuleErrorBuilder::possiblyImpureTip()stays because the class is@api.Measured against 2.3.x (a7e2b6a), both legs with their own turbo build on PHP 8.5 macOS:
🤖 Generated with Claude Code
https://claude.ai/code/session_01MMNnG2Zo7wgvSZCzjdk17X