Repository navigation
Stop counting resets in test code or in closures as clearing a static - #37
Merged
Merged
Conversation
A plugin's resetWorkerState() or request-boundary listener in test code never runs in a production worker, and a closure that reset code defines runs later, if ever. Writes and calls in either no longer mark a production static as cleared.
There was a problem hiding this comment.
Tip
Verdict: APPROVED: no blocking concerns from this pass.
The changes close both false-negative paths: test-only listeners no longer contribute request-boundary edges, and calls inside closures no longer make their enclosing reset method appear to clear state. Excluding test and closure writes from reset recognition complements those call-graph changes.
The four new fixture cases cover direct writes and indirect calls, and the exact-error test now includes the test-directory fixtures. No blocking defects found in the diff.
Automated review of 4d9f554c1e5e52a82f5e8a86d17b1650de86971d by openai/gpt-6.1-sol via OpenRouter. Request a review to run it again.
Merged
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.
A reset that never runs in a production worker no longer counts as clearing a static:
resetWorkerState()or aterminating()/RequestReceivedlistener in test code;Before this, such code hid a real leak: request code could fill a production static that only a test plugin cleared, and the rule reported nothing.
Testing
phpstan/fixtures/tests/TestResetPlugin.phpand a closure inFixturePlugin::resetWorkerState()) cover each case. All four fail againstmain's rule code and pass with this change.tests/PHPStanRulesTest.phpreports exactly the 25 expected lines; PHPStan level 8 (without Larastan) and PHPCS are clean.