suin / symplify-cs-fixer
Make Symplify Coding Standard's fixers work with PHP-CS-Fixer
v2.2.0
2019-07-22 09:32 UTC
Requires
- php: >=7.1 <7.4.0
- symfony/finder: >=4.2 <5.0.0
- symplify/better-phpdoc-parser: >=5.0 <=5.4.2
- symplify/coding-standard: >=5.0 <=5.4.2
- symplify/easy-coding-standard: >=5.0 <=5.4.2
README
Make Symplify Coding Standard's fixers work with PHP-CS-Fixer.
Since Symplify Coding Standard's fixers designed for EasyCodingStandard, its don't work in PHP-CS-Fixer config (.php_cs
or .php_cs.dist
). This library provide an adaptor layer that bridge the gap between PHP-CS-Fixer and Symplify Coding Standard.
Installation
composer require --dev suin/symplify-cs-fixer
Usage
At first, create a PHP-CS-Fixer ruleset XML (.php_cs.dist
or .php_cs
) file in the root of your project.
<?php declare(strict_types=1); return PhpCsFixer\Config::create() ->registerCustomFixers(new SymplifyCsFixer\SymplifyCsFixers()) ->setRules( [ SymplifyCsFixer\ArrayPropertyDefaultValueFixer::NAME => true, SymplifyCsFixer\BlankLineAfterStrictTypesFixer::NAME => true, SymplifyCsFixer\BlockPropertyCommentFixer::NAME => true, SymplifyCsFixer\ClassStringToClassConstantFixer::NAME => true, SymplifyCsFixer\FinalInterfaceFixer::NAME => true, SymplifyCsFixer\LineLengthFixer::NAME => [ 'line_length' => 80, 'break_long_lines' => true, 'inline_short_lines' => true, ], SymplifyCsFixer\MethodOrderByTypeFixer::NAME => true, SymplifyCsFixer\ParamReturnAndVarTagMalformsFixer::NAME => true, SymplifyCsFixer\PrivateMethodOrderByUseFixer::NAME => true, SymplifyCsFixer\PropertyNameMatchingTypeFixer::NAME => true, SymplifyCsFixer\PropertyOrderByComplexityFixer::NAME => true, SymplifyCsFixer\RemoveEmptyDocBlockFixer::NAME => true, SymplifyCsFixer\RemoveEndOfFunctionCommentFixer::NAME => true, SymplifyCsFixer\RemoveSuperfluousDocBlockWhitespaceFixer::NAME => true, SymplifyCsFixer\RemoveUselessDocBlockFixer::NAME => true, SymplifyCsFixer\RequireFollowedByAbsolutePathFixer::NAME => true, SymplifyCsFixer\StandaloneLineInMultilineArrayFixer::NAME => true, ] ) // ... ;
Then run it with the command:
vendor/bin/php-cs-fixer fix --dry-run --diff --diff-format=udiff --verbose
Changelog
Please see CHANGELOG for more details.
Contributing
Send issue or pull-request to main repository.