Repository navigation
Keep phpdoc @param on expression statements in blink NoSuperfluousPhpdocTags - #196
Merged
TomasVotruba merged 1 commit intoOct 10, 2026
Merged
Conversation
…docTags A docblock before an expression statement (e.g. a method call taking a closure) was misread as a property declaration, so its @PARAM tags were dropped as unused params. Reject a bare variable as the first token after the docblock unless a modifier preceded it.
TomasVotruba
deleted the
fix-blink-superfluous-phpdoc-before-expression
branch
October 10, 2026 08:44
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.
Problem
Running
ecs check --blinkon the rector codebase stripped a valid closure-param docblock:The PHP engine keeps this tag. Blink removed it, leaving
/** */.Cause
signatureAfter()walks forward from a docblock to find the declaration it documents. When the first significant token is a bare variable (here$this), it was treated as a property declaration viaparseProperty(), which returns an empty parameter set. Withallow_unused_params: false(rector's config), the@param $useTypethen looked like an unused param and was dropped.A docblock before an expression statement is not attached to any function or property, so PHP-CS-Fixer leaves it alone.
Fix
Reject a bare variable as the first token after the docblock unless a property modifier/type preceded it. A property declaration never starts with a bare variable (it requires visibility/var/static/readonly or a type), so this only skips expression statements.
Added a regression test covering the closure-param-before-expression case.
Verified on rector-src: the two affected files (
AliasUsesResolver,UsedImportsResolver) are no longer mis-fixed.