Created
July 11, 2022 04:50
-
-
Save leek/6b7254937a46797c579d44621907dbce to your computer and use it in GitHub Desktop.
Personal ideal PHP CS Fixer configuration
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* PHP Coding Standards fixer configuration | |
*/ | |
$finder = PhpCsFixer\Finder::create() | |
->ignoreDotFiles(true) | |
->ignoreVCSIgnored(true) | |
->exclude('node_modules') | |
->exclude('vendor') | |
; | |
$config = new PhpCsFixer\Config(); | |
$config | |
->setRiskyAllowed(false) | |
->setFinder($finder) | |
->setRules([ | |
/** | |
* @link https://github.com/FriendsOfPHP/PHP-CS-Fixer/blob/master/doc/ruleSets/PhpCsFixer.rst | |
*/ | |
'@PhpCsFixer' => true, | |
/** | |
* @link https://github.com/FriendsOfPHP/PHP-CS-Fixer/blob/master/doc/rules/class_notation/visibility_required.rst | |
*/ | |
'visibility_required' => [ | |
'elements' => [ | |
'method', | |
'property' | |
] | |
], | |
/** | |
* @link https://github.com/FriendsOfPHP/PHP-CS-Fixer/blob/master/doc/rules/operator/concat_space.rst | |
*/ | |
'concat_space' => ['spacing' => 'one'], | |
/** | |
* @link https://github.com/FriendsOfPHP/PHP-CS-Fixer/blob/master/doc/rules/operator/binary_operator_spaces.rst | |
*/ | |
'binary_operator_spaces' => [ | |
'operators' => [ | |
'=' => 'align_single_space_minimal', | |
'=>' => 'align_single_space_minimal', | |
] | |
], | |
/** | |
* @link https://github.com/FriendsOfPHP/PHP-CS-Fixer/blob/master/doc/rules/control_structure/yoda_style.rst | |
*/ | |
'yoda_style' => false, | |
/** | |
* @link https://github.com/FriendsOfPHP/PHP-CS-Fixer/blob/master/doc/rules/control_structure/no_useless_else.rst | |
*/ | |
'no_useless_else' => false, | |
/** | |
* @link https://github.com/FriendsOfPHP/PHP-CS-Fixer/blob/master/doc/rules/php_tag/echo_tag_syntax.rst | |
*/ | |
'echo_tag_syntax' => [ | |
'format' => 'short', | |
], | |
/** | |
* @link https://github.com/FriendsOfPHP/PHP-CS-Fixer/blob/master/doc/rules/control_structure/no_alternative_syntax.rst | |
*/ | |
'no_alternative_syntax' => [ | |
'fix_non_monolithic_code' => false, | |
], | |
]) | |
; | |
return $config; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment