Closed azdanov closed 6 years ago
Hi @azdanov, thanks for your idea. I also think that code quality is important. I worked with PHP_CodeSniffer in the past. I'll evaluate your idea a little further.
Also feel free to send a PR.
Cheers Sebastian
I am wondering which coding-standard rulesets would fit.
There are antonioribeiro/laravelcs, which hasn't been updated for a while, and stechstudio/Laravel-PHP-CS-Fixer which looks quite ok.
I am wondering which coding-standard rulesets would fit.
Well, that's a good question. You're right, antonioribeiro/laravelcs is too old. The other one looks promising. I also like the fact that it can be run with an artisan command. Maybe I can give it a try on Monday on one of my projects.
Another interesting alternative is symplify/easyCodingStandard.
EDIT:
I found this config working well for me:
imports:
- { resource: "vendor/symplify/easy-coding-standard/config/clean-code.yml" }
- { resource: "vendor/symplify/easy-coding-standard/config/common.yml" }
- { resource: "vendor/symplify/easy-coding-standard/config/psr12.yml" }
- { resource: "vendor/symplify/easy-coding-standard/config/php71.yml" }
- { resource: "vendor/symplify/easy-coding-standard/config/symfony.yml" }
- { resource: "vendor/symplify/easy-coding-standard/config/symfony-risky.yml" }
- { resource: "vendor/symplify/easy-coding-standard/config/symplify.yml" }
parameters:
exclude_checkers:
- 'PhpCsFixer\Fixer\Operator\NotOperatorWithSuccessorSpaceFixer'
- 'SlevomatCodingStandard\Sniffs\Exceptions\ReferenceThrowableOnlySniff'
- 'SlevomatCodingStandard\Sniffs\TypeHints\TypeHintDeclarationSniff'
Might be a little too strict for a default though.
Nice, thanks. I'll take it into consideration.
Hi @azdanov, I found some time to check your suggestion of ECS. I like it and I'll integrate it in the next release 1.5.0.
Concerning the default checks, I'll choose a less strict check. Developers can then select their preferred config.
Thanks again for pointing me at this tool.
Cheers Sebastian
What I am thinking is to either to include
PHP_CodeSniffer
and/orPHP-CS-Fixer
with a default set of rules.For
PHP-CS-Fixer
I use this config. And forPHP_CodeSniffer
I use doctrine/coding-standard.It would be cool to create something similar for a Laravel project which works out of the box.