Last active
April 5, 2017 23:02
-
-
Save dstollie/8eeea4258b78656b27f14e20262f156e to your computer and use it in GitHub Desktop.
PHP CS Fixer for the win
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 | |
return PhpCsFixer\Config::create() | |
->setRules([ | |
'@PSR2' => true, | |
'@Symfony' => true, | |
'@PHP70Migration' => true, | |
/* | |
* Enforce some structure! | |
*/ | |
'elseif' => true, | |
'no_closing_tag' => true, | |
'no_mixed_echo_print' => true, | |
'no_whitespace_before_comma_in_array' => true, | |
'binary_operator_spaces' => [ | |
'align_equals' => true, | |
'align_double_arrow' => true, | |
], | |
'array_syntax' => ['syntax' => 'short'], | |
'single_quote' => true, | |
'blank_line_after_namespace' => true, | |
'blank_line_after_opening_tag' => true, | |
'blank_line_before_return' => true, | |
'concat_space' => [ | |
'spacing' => 'one', | |
], | |
/* | |
* PHP7 All The Things | |
*/ | |
'ternary_to_null_coalescing' => true, // Force shorthand isset() ? : | |
/* | |
* Documentation is kewl | |
*/ | |
'phpdoc_no_useless_inheritdoc' => true, | |
'no_blank_lines_after_phpdoc' => true, | |
'phpdoc_no_package' => true, | |
'phpdoc_order' => true, | |
'phpdoc_indent' => true, //Docblocks should have the same indentation as the documented subject. | |
/* | |
* Always do usefull stuff | |
*/ | |
'no_useless_return' => true, | |
'no_useless_else' => true, | |
]) | |
->setRiskyAllowed(true) | |
->setFinder(PhpCsFixer\Finder::create()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment