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
Add DeclaredClassCasingFilter #3969
Conversation
So the scope here has changed to use declared classes instead of native classes. I don't like this change because the output of the fixer can be changed depending on what classes are defined before construction, which in my case of using it as a library, it could be anything. Also, different environments will produce different results, such as:
|
I don't share that concern, if you use different PHP builds/SAPI you get different results from a range of fixers already. It is also a one way fix, so on one system it fixes more than on another, but it never reverts a good fix. |
@siad007 would you like someone to finish off this PR if you haven't got time to? It's a very useful fixer |
parent::__construct(); | ||
|
||
if (null === self::$declaredClassNames) { | ||
foreach (get_declared_classes() as $class) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm sceptical about this line - get_declared_classes
will not return classes that are declared, but those declared in the current script - depending how autoloader was called - which mean one day it will return some classes and another day more classes - adding some fixer to config might accidentally "discover" more classes.
When I was working on similar fixer I have ended with only internal classes to handle.
…Fixer into ClassCasingFixer
@ntzm i have fixed the last pending issues right now |
@siad007 thanks for the update. |
], | ||
[ | ||
'<?php | ||
use stdclass as exception; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this not be fixed to
use stdClass as exception;
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@siad007 can you pick this up? also rebase and squash this, then change the target branch to master please :)
Related to #2571