Add PHP CS Fixer for consistent code style
This commit is contained in:
parent
ba5a8dc8ea
commit
4b23dfd18b
|
|
@ -13,3 +13,6 @@ var/
|
||||||
# PHPUnit caches:
|
# PHPUnit caches:
|
||||||
.phpunit.cache/
|
.phpunit.cache/
|
||||||
.phpunit.result.cache
|
.phpunit.result.cache
|
||||||
|
|
||||||
|
# PHP CS Fixer caches:
|
||||||
|
.php-cs-fixer.cache
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,34 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use PhpCsFixer\Config;
|
||||||
|
use PhpCsFixer\Finder;
|
||||||
|
|
||||||
|
$finder = Finder::create()
|
||||||
|
->in(__DIR__ . '/src')
|
||||||
|
->in(__DIR__ . '/tests')
|
||||||
|
->in(__DIR__ . '/public')
|
||||||
|
->in(__DIR__ . '/config')
|
||||||
|
->exclude('vendor')
|
||||||
|
->name('*.php')
|
||||||
|
->ignoreDotFiles(true)
|
||||||
|
->ignoreVCS(true);
|
||||||
|
|
||||||
|
return (new Config())
|
||||||
|
->setIndent("\t")
|
||||||
|
->setRiskyAllowed(true)
|
||||||
|
->setRules([
|
||||||
|
'@PSR12' => true,
|
||||||
|
'array_syntax' => ['syntax' => 'short'],
|
||||||
|
'blank_line_before_statement' => ['statements' => ['return', 'throw', 'break', 'continue', 'exit']],
|
||||||
|
'braces_position' => ['control_structures_opening_brace' => 'next_line_unless_newline_at_signature_end'],
|
||||||
|
'control_structure_continuation_position' => ['position' => 'next_line'],
|
||||||
|
'indentation_type' => true,
|
||||||
|
'no_extra_blank_lines' => true,
|
||||||
|
'no_trailing_whitespace' => true,
|
||||||
|
'no_unused_imports' => true,
|
||||||
|
'ordered_imports' => true,
|
||||||
|
'single_blank_line_at_eof' => true,
|
||||||
|
'single_import_per_statement' => true,
|
||||||
|
'trailing_comma_in_multiline' => ['elements' => ['arrays', 'arguments']],
|
||||||
|
])
|
||||||
|
->setFinder($finder);
|
||||||
|
|
@ -13,6 +13,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"phpunit/phpunit": "^12.5"
|
"phpunit/phpunit": "^12.5",
|
||||||
|
"friendsofphp/php-cs-fixer": "^3.94"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue