Last active
March 4, 2024 09:22
-
-
Save aozisik/554bb847b193198357a0a6fe282808b7 to your computer and use it in GitHub Desktop.
Swiftmade's php-cs-fixer (v3) config.
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 | |
$finder = Symfony\Component\Finder\Finder::create() | |
->notPath('bootstrap/*') | |
->notPath('storage/*') | |
->notPath('vendor') | |
->notPath('nova') | |
->notPath('spark') | |
->in([ | |
__DIR__ . '/app', | |
__DIR__ . '/tests', | |
__DIR__ . '/database', | |
]) | |
->name('*.php') | |
->notName('*.blade.php') | |
->ignoreDotFiles(true) | |
->ignoreVCS(true); | |
$config = new PhpCsFixer\Config(); | |
return $config->setRules([ | |
'@PSR2' => true, | |
'array_syntax' => ['syntax' => 'short'], | |
'ordered_imports' => ['sort_algorithm' => 'length'], | |
'no_unused_imports' => true, | |
'no_whitespace_in_blank_line' => true, | |
'not_operator_with_successor_space' => true, | |
'trailing_comma_in_multiline' => true, | |
'phpdoc_scalar' => true, | |
'unary_operator_spaces' => true, | |
'binary_operator_spaces' => true, | |
'blank_line_before_statement' => [ | |
'statements' => ['break', 'continue', 'declare', 'return', 'throw', 'try'], | |
], | |
'phpdoc_single_line_var_spacing' => true, | |
'phpdoc_var_without_name' => true, | |
'class_attributes_separation' => [ | |
'elements' => [ | |
'method' => 'one', | |
], | |
], | |
'method_argument_space' => [ | |
'on_multiline' => 'ensure_fully_multiline', | |
'keep_multiple_spaces_after_comma' => true, | |
], | |
'single_trait_insert_per_statement' => true, | |
]) | |
->setFinder($finder); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment