Skip to main content

Linting

PHP Code

We use php-cs-fixer to automatically fix code style issues according to Symfony coding standard.

Install tooling via:

composer -d tools install

Try to automatically fix linting errors:

./tools/vendor/bin/php-cs-fixer fix

Note: First time you run the linter, it might take a while. After a hot cache, linting will be much faster.

JavaScript Code

For JavaScript inside the assets/ directory, we use ESLint for linting and potentially fix the code style issues.

Install Eslint and its required packages by:

npm install

Run the following command to perform linting:

npm run lint

Run the following command to attempt auto-fix linting issues:

npm run lint-fix

Note that unlike PHP-CS-Fixer, not all linting problems could be automatically fixed, some of these would requires manually fixing them as appropriate, be sure to do those.