|
| 1 | +<?php |
| 2 | + |
| 3 | +$finder = Symfony\Component\Finder\Finder::create() |
| 4 | + ->in([ |
| 5 | + __DIR__, |
| 6 | + ]) |
| 7 | + ->name('*.php') |
| 8 | + ->notName('*.blade.php') |
| 9 | + ->ignoreDotFiles(true) |
| 10 | + ->ignoreVCS(true) |
| 11 | + ->exclude(['vendor', 'node_modules']); |
| 12 | + |
| 13 | +$config = new PhpCsFixer\Config(); |
| 14 | + |
| 15 | +// Rules from: https://cs.symfony.com/doc/rules/index.html |
| 16 | + |
| 17 | +return $config->setRules([ |
| 18 | + '@PSR2' => true, |
| 19 | + 'array_syntax' => ['syntax' => 'short'], |
| 20 | + 'ordered_imports' => ['sort_algorithm' => 'length'], |
| 21 | + 'no_unused_imports' => true, |
| 22 | + 'not_operator_with_successor_space' => true, |
| 23 | + 'trailing_comma_in_multiline' => true, |
| 24 | + 'single_quote' => ['strings_containing_single_quote_chars' => true], |
| 25 | + 'phpdoc_scalar' => true, |
| 26 | + 'unary_operator_spaces' => true, |
| 27 | + 'binary_operator_spaces' => true, |
| 28 | + 'blank_line_before_statement' => [ |
| 29 | + 'statements' => ['declare', 'return', 'throw', 'try'], |
| 30 | + ], |
| 31 | + 'phpdoc_single_line_var_spacing' => true, |
| 32 | + 'phpdoc_var_without_name' => true, |
| 33 | + 'method_argument_space' => [ |
| 34 | + 'on_multiline' => 'ensure_fully_multiline', |
| 35 | + 'keep_multiple_spaces_after_comma' => true, |
| 36 | + ], |
| 37 | + 'return_type_declaration' => [ |
| 38 | + 'space_before' => 'none' |
| 39 | + ], |
| 40 | + 'declare_strict_types' => true, |
| 41 | + 'blank_line_after_opening_tag' => true, |
| 42 | + 'single_import_per_statement' => true, |
| 43 | + 'mb_str_functions' => true, |
| 44 | + 'no_superfluous_phpdoc_tags' => true, |
| 45 | + 'no_blank_lines_after_phpdoc' => true, |
| 46 | + 'no_empty_phpdoc' => true, |
| 47 | + 'phpdoc_trim' => true, |
| 48 | +])->setFinder($finder); |
0 commit comments