-
-
Notifications
You must be signed in to change notification settings - Fork 699
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[CodeQuality] Add rule to move attributes under comment #7225
Comments
Stmts/Exprs that have \PhpParser\Internal\PrintableNewAnonClassNode;
\PhpParser\Node\Param;
\PhpParser\Node\Expr\ArrowFunction;
\PhpParser\Node\Expr\Closure;
\PhpParser\Node\Expr\ClassConst;
\PhpParser\Node\Expr\ClassLike;
\PhpParser\Node\Expr\ClassMethod;
\PhpParser\Node\Expr\EnumCase;
\PhpParser\Node\Expr\Function_;
\PhpParser\Node\Expr\Property; it seems |
Point of order: FIG has not addressed it yet. The question has been brought up to the working group. I agree putting the attribute after the comment is probably a good idea, but as of yet FIG has not made a statement one way or another. |
Sure, it is motivation to move forward. We've seen this bug since first native attributes release. |
After some reasearch and experiment, it's clear the php-parser resolves attributes correctly, even if separated by comment: So there is no need for such rule. |
The attributes are part of code, while docblock is comment above them. The other order will crash.
This was addressed in PHP FIG Per coding style:
php-fig/per-coding-style#8
And php-parser: nikic/PHP-Parser#762
Looking at code sample, maybe we could deal with this mess with Rector rule :)
The text was updated successfully, but these errors were encountered: