Skip to content

Latest commit

 

History

History
44 lines (30 loc) · 704 Bytes

README.md

File metadata and controls

44 lines (30 loc) · 704 Bytes

PHP Coding Style Guide

Guide

See Code Style Guide for more details.

Fix code style

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