CI Pipeline: Unifying and automating code using Coding Style Fixer

This tool will automatically fix your PHP code style. You can run it manually, or set it as pre-commit hook and it will run automatically.

Installation

{% raw %}composer require friendsofphp/php-cs-fixer
{% endraw %}

Usage:

Default configuration will apply PSR1 and PSR2 rules. To run the default configuration:
If you would like to apply specific rules, you can set the rules argument of these command.

{% raw %}--dry-run lets you run the fixer without making changes.
--diff will output all the changes made by the fixer.
{% endraw %}

If you want to set the configuration statically in the codebase to be used by developers as a guideline, you can add this file to the root directory. When detected php-cs-fixer will apply the rules defined there. .php_cs.dist

References:
Github repository: https://github.com/friendsofphp/php-cs-fixer
Composer: https://packagist.org/packages/friendsofphp/php-cs-fixer