|
| 1 | +<?php declare(strict_types=1); |
| 2 | + |
| 3 | +use PhpCsFixer\Config; |
| 4 | +use PhpCsFixer\Finder; |
| 5 | + |
| 6 | +$finder = Finder::create() |
| 7 | + ->ignoreUnreadableDirs() |
| 8 | + ->ignoreDotFiles(true) |
| 9 | + ->ignoreVCS(true) |
| 10 | + ->name('*.php') |
| 11 | + ->in(__DIR__) |
| 12 | + ->notName('_ide_helper.php') |
| 13 | + ->exclude('vendor') |
| 14 | + ->exclude('storage') |
| 15 | + ->exclude('bootstrap') |
| 16 | + ->sortByModifiedTime(); |
| 17 | + |
| 18 | +// https://mlocati.github.io/php-cs-fixer-configurator |
| 19 | + |
| 20 | +return (new Config()) |
| 21 | + ->setUsingCache(false) |
| 22 | + ->setRiskyAllowed(true) |
| 23 | + ->setLineEnding("\n") |
| 24 | + ->setFinder($finder) |
| 25 | + ->setRules( |
| 26 | + [ |
| 27 | + '@PSR2' => true, |
| 28 | + '@PSR12' => true, |
| 29 | + '@Symfony' => true, |
| 30 | + '@Symfony:risky' => true, |
| 31 | + '@PHP71Migration' => true, |
| 32 | + '@PHP71Migration:risky' => true, |
| 33 | + '@PHP73Migration' => false, |
| 34 | + '@PHPUnit84Migration:risky' => true, |
| 35 | + '@DoctrineAnnotation' => true, |
| 36 | + |
| 37 | + 'native_function_invocation' => false, |
| 38 | + 'phpdoc_align' => false, |
| 39 | + 'blank_line_after_opening_tag' => false, |
| 40 | + 'linebreak_after_opening_tag' => false, |
| 41 | + 'phpdoc_to_comment' => false, |
| 42 | + 'phpdoc_separation' => true, |
| 43 | + 'no_unused_imports' => true, |
| 44 | + 'single_import_per_statement' => false, |
| 45 | + 'yoda_style' => false, |
| 46 | + 'phpdoc_var_without_name' => false, |
| 47 | + 'self_accessor' => false, |
| 48 | + 'no_superfluous_phpdoc_tags' => false, |
| 49 | + 'ordered_imports' => ['imports_order' => ['class', 'function', 'const']], |
| 50 | + 'array_syntax' => ['syntax' => 'short'], |
| 51 | + 'mb_str_functions' => true, |
| 52 | + 'cast_spaces' => true, |
| 53 | + 'no_useless_return' => true, |
| 54 | + 'phpdoc_add_missing_param_annotation' => ['only_untyped' => false], |
| 55 | + 'phpdoc_order' => true, |
| 56 | + 'phpdoc_no_empty_return' => false, |
| 57 | + 'no_extra_blank_lines' => true, |
| 58 | + 'visibility_required' => true, |
| 59 | + 'single_trait_insert_per_statement' => false, |
| 60 | + 'concat_space' => ['spacing' => 'one'], |
| 61 | + 'php_unit_test_annotation' => ['style' => 'annotation'], |
| 62 | + 'combine_consecutive_unsets' => true, |
| 63 | + 'no_useless_else' => true, |
| 64 | + 'php_unit_strict' => true, |
| 65 | + 'strict_comparison' => true, |
| 66 | + 'strict_param' => true, |
| 67 | + 'explicit_string_variable' => true, |
| 68 | + 'self_static_accessor' => true, |
| 69 | + 'global_namespace_import' => true, |
| 70 | + 'multiline_comment_opening_closing' => true, |
| 71 | + 'multiline_whitespace_before_semicolons' => true, |
| 72 | + 'ordered_class_elements' => true, |
| 73 | + 'phpdoc_var_annotation_correct_order' => true, |
| 74 | + 'protected_to_private' => true, |
| 75 | + 'simple_to_complex_string_variable' => true, |
| 76 | + 'static_lambda' => false, |
| 77 | + ] |
| 78 | + ); |
0 commit comments