-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
PSR-12: wrong fix when instanciating an anonymous class #6536
Comments
This is likely done by If you want this fix, please fill in the bug report template, it is there so we can help you, if you don't want to fill it in I can only assume you don't want help either. |
@SpacePossum I've updated the issue description to match the template and with additional relevant information (e.g. command to run, and output of the command). The culprit is most probably To comply to the PSR-12 standard, the following configuration is required:
|
FYI it will probably be enforced in PER: |
Given the discussions, I would say that PSR-12 intended to enforce parentheses even without arguments, but provided examples inconsistent with that rule. I propose to keep |
Then this issue can be closed, no ? |
You probably can, but please keep in mind that this rule will be enforced in the upcoming PER standard: https://github.com/php-fig/per-coding-style/blob/master/spec.md#8-anonymous-classes.
This is something to keep in mind if you plan to implement the PER standard into php-cs-fixer in the future. |
Bug report
When instanciating an anonymous class, php-cs-fixer adds parentheses after the
class
keyword, which contradicts the PSR-12 rule defined here: https://www.php-fig.org/psr/psr-12/#8-anonymous-classesAdditional information:
Code snippet that reproduces the problem
test.php:
Expected behavior
Nothing to fix.
Actual behavior
The text was updated successfully, but these errors were encountered: