Last active
January 14, 2019 12:05
-
-
Save lcdss/c3da8184369b4caced871df6129daa1d to your computer and use it in GitHub Desktop.
PHP CS Fixer
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() | |
->in('app') | |
// ->except(['vendor', 'storage', 'bootstrap']) | |
->name('*.php') | |
->notName('*.blade.php') | |
->ignoreDotFiles(true) | |
->ignoreVCS(true); | |
return PhpCsFixer\Config::create() | |
->setRules([ | |
'@PSR2' => true, | |
// '@Symfony' => true, | |
'@PHP70Migration' => true, | |
'@PHP71Migration' => true, | |
'array_indentation' => true, | |
'array_syntax' => ['syntax' => 'short'], | |
'fully_qualified_strict_types' => true, | |
'linebreak_after_opening_tag' => true, | |
'list_syntax' => ['syntax' => 'short'], | |
'logical_operators' => true, | |
'method_chaining_indentation' => true, | |
'phpdoc_no_empty_return' => false, | |
'ordered_class_elements' => true, | |
'ordered_imports' => ['sortAlgorithm' => 'length'], | |
]) | |
->setFinder($finder); |
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
{ | |
"scripts": { | |
"format": "php-cs-fixer --ansi fix" | |
} | |
} |
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
{ | |
"devDependencies": { | |
"husky": "^1.1.3", | |
"lint-staged": "^8.0.4" | |
}, | |
"husky": { | |
"hooks": { | |
"pre-commit": "lint-staged" | |
} | |
}, | |
"lint-staged": { | |
"*.php": ["composer format"] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment