-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
class_definition fails with initialising anonymous class #5463
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
Comments
I cannot reproduce it, your example always is fixed once (space after |
Sorry, I think this was my fault. I thought I had isolated everything while testing but it seems CodeSniffer formatter was applied by IDE after CS Fixer run. Closing the ticket. |
Should the space after
I'm facing the same problem regarding PSR12 rules, where PHPCS tries to add the space between |
Hi @juuuuuu , Could you report this as a new FR for PSR12 suport? Currently PHP-CS-Fixer will indeed remove the space, thanks! |
Sorry for late response, I'll do it. |
…Possum) This PR was merged into the master branch. Discussion ---------- ClassDefinitionFixer - PSR12 for anonymous class Adds PSR12 support for `anonymous class` notation with a space following `new class`, like `new class (1,2) {}` (note that `new class {}` is currently already covered) Closes: #5463 (comment) Also reported here loophp/collection#102 (comment) (cc `@drupol` ) Closes one of the points here #4502 New feature so targets `master`, no BC break, new behavior through configuration (by default configuration acts the same) Commits ------- 4d84a83 ClassDefinitionFixer - PSR12 for anonymous class
I have a similar issue where PHP-CS-Fixer and PHPCS fight over the space between $instance = new class ($var) extends \Foo {}; It looks like the quoted part of the documentation was removed and I cannot find a clear position of what to allow/forbid here. There was some work in the php-fig/fig-standards#1206 PR that seems to remove the space, but it was not merged. |
Bug report
Found an issue where php-cs-fixer keeps reporting issues with anonymous classes and not fixing them. Managed to reduce the bug to snippet below.
Code snippet that reproduces the problem
The text was updated successfully, but these errors were encountered: