Coding Standard & Linters
We currently use three separate linters to make sure your code stays in shape:
- Psalm - a static analysis tool for PHP
- PHPStan - PHP Static Analysis Tool
- PHP CS Fixer - PHP Coding Standards Fixer
To invoke the linters we provide the following commands in all our PHP projects:
composer cs
- will run CS Fixer and shows planned changescomposer cs-fix
- will apply the changes shown bycomposer cs
composer psalm
- run Psalmcomposer phpstan
- run PHPStancomposer lint
- will run all linters (cs/psalm/phpstan)
In some cases we run the linters as a git pre-commit hook using brainmaestro/composer-git-hooks
You can see an example configuration for all the linters and the pre-commit hook in our example bundle: