Created
April 5, 2017 22:49
-
-
Save dstollie/8642a1f7717a315591098000b4631bea to your computer and use it in GitHub Desktop.
PHP CS Fixer for the win
This file contains 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 | |
$finder = PhpCsFixer\Finder::create(); | |
return PhpCsFixer\Config::create() | |
->setRules([ | |
'@PSR2' => true, | |
'@Symfony' => true, | |
'@PHP70Migration' => true, | |
//'indentation_type', | |
'elseif' => true, | |
'no_closing_tag' => true, | |
'no_whitespace_before_comma_in_array' => true, | |
'binary_operator_spaces' => [ | |
'align_equals' => true, | |
'align_double_arrow' => true, // Align TODO | |
], | |
'blank_line_after_namespace' => true, | |
'blank_line_after_opening_tag' => true, | |
'blank_line_before_return' => true, | |
'concat_space' => [ | |
'spacing' => 'one', | |
], | |
'array_syntax' => ['syntax' => 'short'], | |
'single_quote' => true, | |
/* | |
* 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) | |
//->setIndent("\t") | |
->setLineEnding("\n") | |
->setFinder($finder) | |
; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment