See Code Style Guide for more details.
To manage code style, use PHP-CS-Fixer.
composer require "ba/php-cs"
Add the file .php-cs-fixer.dist.php
to the root folder of the project:
<?php
use PhpCsFixer\Finder;
use function BACodeStyle\styles;
$finder = (new Finder())->in([
__DIR__.'/src'
]);
$config = styles($finder);
return $config
->setUsingCache(true)
->setCacheFile(__DIR__.'/.php-cs-fixer.cache');
Add PHP-CS-Fixer temporary files to git ignore (.gitignore
):
+.php-cs-fixer.php
+.php-cs-fixer.cache
Run fixer:
./vendor/bin/php-cs-fixer fix -vvv