-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
PSR12.Classes.ClassInstantiation incorrectly fix when using member vars and some variable formats #2053
Comments
I'm working on this sniff right now due to another bug report, so I can take these ones. Thanks for reporting them.
They are good checks, but I don't think they belong in the PSR-12 sniff. I prefer these PSR ones to be as focused as possible due to the arguments that they tend to bring up. |
…en using member vars and some variable formats
I've fixed these cases. If you find others, please report new issues and I'll fix them up too. |
@gsherwood Thanks for the quick turn-around. ❤️
So leave off ? or would you like me to pull these as separate sniffs in the |
If you want to contrib them, and these checks don't exist elsewhere, then absolutely. |
WPCS already contained a
ClassInstantiation
sniff, so after seeing #2047 I've run the PSR12 version over the WPCS unit tests for the sniff to see if we could switch over at some point.The test run identified a number of bugs in the PSR12 sniffs:
Test cases:
Fixed as:
Expected fixes:
👉 Would you like me to look into fixing these ?
It also raises the question Why does FIG ignore this rule for anonymous classes ?, though that's outside the scope of PHPCS.
Other than the above, the WPCS sniff has some additional features.
👉 Would you be interested in any of these ?
The text was updated successfully, but these errors were encountered: