Exclude phpstorm-stubs test suite from function metadata generation - #6439
Merged
Conversation
The Finder in bin/generate-function-metadata.php scanned every PHP file in vendor/jetbrains/phpstorm-stubs, including the package's own tests/ directory. The latest stubs master added anonymous classes with methods there, and NameResolver does not assign namespacedName to anonymous classes, so the script died with "Call to a member function toString() on null" and the "Update PhpStorm stubs" workflow failed. Exclude tests/ from the scan and skip methods of anonymous classes. Regenerating drops four bogus StubTests\* entries that had leaked into resources/functionMetadata.php, and the generator now writes the trailing newline that .editorconfig requires. ob_get_level() was flipped to hasSideEffects => false by hand in #5909 (its level is tracked in the scope, so the call result must stay narrowable) without teaching the generator, so any regeneration would have reverted it. Add it to the list of scope-managed functions and align bin/functionMetadata_original.php, so the generated file is stable. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RM7vts9eefx5pyNFj7jRKY
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 scheduled "Update PhpStorm stubs" workflow has been failing in the "Update function metadata" step: https://github.com/phpstan/phpstan-src/actions/runs/34172166172/job/101894414480
Cause: the Finder scanned every PHP file in
vendor/jetbrains/phpstorm-stubs, including the package's owntests/directory. The latest stubs master rewrote those tests using anonymous classes with methods, andNameResolverdoes not assignnamespacedNameto anonymous classes.Fix:
tests/from the scan and skip methods of anonymous classes.StubTests\*entries that had leaked intoresources/functionMetadata.php..editorconfigrequires, so regeneration no longer produces whitespace churn.ob_get_level()was flipped tohasSideEffects => falseby hand in Narrowob_get_contents()/ob_get_clean()/ob_get_flush()/ob_get_length()to non-falsewhile output buffering is active #5909 (its level is tracked in the scope, so the call result must stay narrowable) without teaching the generator, so any regeneration would have reverted it and brokennsrt/output-buffering.php. It is now in the list of scope-managed functions andbin/functionMetadata_original.phpis aligned, making the generated file stable.Verified locally: with the fix, the generator runs cleanly against both the locked stubs (output identical apart from the four removed
StubTests\*entries) and the current stubs master (three new intl functions only). This PR intentionally does not bump the stubs; the workflow will do that once it passes again.🤖 Generated with Claude Code
https://claude.ai/code/session_01RM7vts9eefx5pyNFj7jRKY