Repository navigation
Perf: Skip the methods without PHPUnit metadata in the per-class method loops - #290
Merged
alies-dev merged 3 commits intoNov 24, 2026
Conversation
psalm#289 afterClassLikeVisit() records the methods a class-like declares with an attribute or a docblock that may hold a tag PHPUnit 11 reads, next to the before methods. Both AfterClassLikeAnalysis loops over declaring_method_ids skip the other methods, unless the test case names them test*: PHPUnit reads nothing from them. DocblockSpecials parses only the docblocks that pass the same check.
alies-dev
marked this pull request as ready for review
November 24, 2026 00:55
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.
Psalm spent time proportional to test classes × inherited methods in the
AfterClassLikeAnalysishooks ofTestCaseHandlerandDocblockMetadataHandler, recomputing the same trait and parent method checks for every test class. The visit hook now records the methods with an attribute or a docblock that may hold a PHPUnit 11 tag, and both loops skip the other methods unless the test case names themtest*. Reported issues are unchanged.400 generated test classes on a base test case with 16 traits of 22 methods, PHPUnit 13,
--threads=1 --debug-performance, median of 3:TestCaseHandlerAfterClassLikeAnalysisDocblockMetadataHandlerAfterClassLikeAnalysisTestCaseHandlerAfterClassLikeVisitFixes #289