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
TASK: Replace PHPCS with PHP-CS-Fixer to enforce coding guidelines #4949
base: 9.0
Are you sure you want to change the base?
Conversation
This build will fail.
When I run
|
Its a bit sad that we really need another dev dependency for this :/ That makes stuff just needless complex 😅 i currently only use |
It's just a dev dependency, it doesn't affect complexity of our code and in the mid-term can even help us to keep complexity lower.
You are free to ignore it, but our CI won't and IMO that's a good thing that helps us to establish a common coding style. Long story short: I think it's valuable to have the namespace imports cleaned up by a tool (and it was you that brought this up *g). PHPCS won't be able to do this, and from reading the comments on squizlabs/PHP_CodeSniffer#1106 it will most likely never support it. Having said this, maybe PHP-CS-Fixer supports the other checks that we currently do with PHPCS, so we could at least replace it!? |
That's seems to be the case.. Note: This is just an experiment. We should all agree if whether want to switch the quality tools |
Thanks a lot @bwaidelich ! I must say this looks good in my eyes, but i have only used phpstan so far and let php cs be handled by the ci (rather i forget about its existence all the time). Getting rid of php cs might be a good idea as they have a super slow release cycle and no clear maintainer, which lead to weird hotfixes and lost time in the past. So overall im not opinionated in which tool to learn / use but do plead for simplicity so 1 tool should be enough 😅 |
A super great goal would be imo to then get also rid of our So if we can reduce the complexity from two linters to only php cs fixer that would great and im happy to assist. |
Adds PHP-CS-Fixer as dev dependency as replacement for PHPCS and configures the following rules:
PSR12
PSR-12 Coding Guideline – that was previously covered by PHPCSno_unused_imports
disallows unused PHP namespace importsordered_imports
requiresuse
statements to be ordered alphabeticallyIt makes those checks part of our
composer:lint
script and adds:composer lint:php-cs-fixer
to check them andcomposer lint:php-cs-fixer:fix
to fix violationscomposer lint:fix
to fix any linter violations (currently the same)Resolves: #4580