A pre-defined set of coding standards for PHP CS Fixer.
- PHP >= 7.2
composer require --dev phlak/coding-standards
After installing in your project, create a
.php_cs.dist file in the root folder with the following contents.
<?php require __DIR__ . '/vendor/autoload.php'; $finder = PhpCsFixer\Finder::create()->in([ // List of paths you wish to include ]); return PHLAK\CodingStandards\ConfigFactory::make($finder);
Now you may run
php-cs-fixer as normal.
You can add additional rules or override pre-defined ones by passing them as the second parameter to the
ConfigFactory::make() method. These rules will be merged with the pre-defined rules.
return PHLAK\CodingStandards\ConfigFactory::make($finder, [ // Your additional rules here... ]);
Additional configuration can be achieved by chaining methods onto the
return PHLAK\CodingStandards\ConfigFactory::make($finder) ->setIndent("\t") ->setLineEnding("\r\n") ->setRiskyAllowed();
A list of changes can be found on the GitHub Releases page.
Please report bugs to the GitHub Issue Tracker.
This project is licensed under the MIT License.