-
-
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
Anonymous classes' constructor params are forced on one line #4628
Labels
Comments
Looks like an open issue for PSR12 support #4502 |
Hi and thanks for reporting, The fixer does this as part of PSR2:
However anonymous classes have no names, so one could reason that the fixer is to strict here. Your case can be indeed be fixed through PSR12 as well though 👍 |
closing as duplicate of #4289 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When reporting an issue (bug) please provide the following information:
The PHP version you are using (
$ php -v
):PHP 7.2.21-1+ubuntu16.04.1+deb.sury.org+1 (cli) (built: Aug 7 2019 09:53:30) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.2.21-1+ubuntu16.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies
PHP CS Fixer version you are using (
$ php-cs-fixer -V
):PHP CS Fixer 2.16.0 Yellow Bird by Fabien Potencier and Dariusz Ruminski
The command you use to run PHP CS Fixer:
php-cs-fixer fix --diff --dry-run --rules=class_definition .
The configuration file you are using, if any:
none
If applicable, please provide minimum samples of PHP code (as plain text, not screenshots):
The multiline constructor parameters are forced onto one line. This example uses short var names, using longer var names and outer class properties (like injecting mock objects in tests) makes this more obvious that creating a very long single line is not a good idea.
PSR12 states in section 8: Anonymous Classes MUST follow the same guidelines and principles as closures in the above section.
Section 7 has this example
I'd expect that using multiline argument lists like in the example code is completely correct, no changes should take place at all.
The text was updated successfully, but these errors were encountered: