|
| 1 | +<?php |
| 2 | + |
| 3 | +declare(strict_types=1); |
| 4 | + |
| 5 | +use PhpCsFixer\Config; |
| 6 | +use PhpCsFixer\Finder; |
| 7 | + |
| 8 | +$finder = Finder::create() |
| 9 | + ->in([__DIR__]) |
| 10 | + ->exclude(['vendor']) |
| 11 | + ->ignoreDotFiles(false); |
| 12 | + |
| 13 | +return (new Config()) |
| 14 | + ->setRiskyAllowed(true) |
| 15 | + ->setRules([ |
| 16 | + '@PhpCsFixer' => true, |
| 17 | + '@PhpCsFixer:risky' => true, |
| 18 | + '@PHP74Migration' => true, |
| 19 | + '@PHP74Migration:risky' => true, |
| 20 | + |
| 21 | + // required by PSR-12 |
| 22 | + 'concat_space' => [ |
| 23 | + 'spacing' => 'one', |
| 24 | + ], |
| 25 | + |
| 26 | + // disable some too strict rules |
| 27 | + 'phpdoc_types_order' => [ |
| 28 | + 'null_adjustment' => 'always_last', |
| 29 | + 'sort_algorithm' => 'none', |
| 30 | + ], |
| 31 | + 'single_line_throw' => false, |
| 32 | + 'yoda_style' => [ |
| 33 | + 'equal' => false, |
| 34 | + 'identical' => false, |
| 35 | + ], |
| 36 | + 'native_constant_invocation' => true, |
| 37 | + 'native_function_invocation' => false, |
| 38 | + 'void_return' => false, |
| 39 | + 'blank_line_before_statement' => [ |
| 40 | + 'statements' => ['break', 'continue', 'declare', 'return', 'throw', 'exit'], |
| 41 | + ], |
| 42 | + 'final_internal_class' => false, |
| 43 | + 'combine_consecutive_issets' => false, |
| 44 | + 'combine_consecutive_unsets' => false, |
| 45 | + 'multiline_whitespace_before_semicolons' => false, |
| 46 | + 'no_superfluous_elseif' => false, |
| 47 | + 'ordered_class_elements' => false, |
| 48 | + 'php_unit_internal_class' => false, |
| 49 | + 'php_unit_test_class_requires_covers' => false, |
| 50 | + 'phpdoc_add_missing_param_annotation' => false, |
| 51 | + 'return_assignment' => false, |
| 52 | + 'comment_to_phpdoc' => false, |
| 53 | + 'general_phpdoc_annotation_remove' => [ |
| 54 | + 'annotations' => ['author', 'copyright', 'throws'], |
| 55 | + ], |
| 56 | + |
| 57 | + // fn => without curly brackets is less readable, |
| 58 | + // also prevent bounding of unwanted variables for GC |
| 59 | + 'use_arrow_functions' => false, |
| 60 | + |
| 61 | + # TODO |
| 62 | + 'align_multiline_comment' => false, |
| 63 | + 'array_indentation' => false, |
| 64 | + 'binary_operator_spaces' => false, |
| 65 | + 'blank_line_after_opening_tag' => false, |
| 66 | + 'blank_line_before_statement' => false, |
| 67 | + 'concat_space' => false, |
| 68 | + 'control_structure_continuation_position' => false, |
| 69 | + 'declare_strict_types' => false, |
| 70 | + 'explicit_string_variable' => false, |
| 71 | + 'function_declaration' => false, |
| 72 | + 'function_to_constant' => false, |
| 73 | + 'general_phpdoc_annotation_remove' => false, |
| 74 | + 'include' => false, |
| 75 | + 'list_syntax' => false, |
| 76 | + 'method_argument_space' => false, |
| 77 | + 'native_constant_invocation' => false, |
| 78 | + 'new_with_parentheses' => false, |
| 79 | + 'no_alias_functions' => false, |
| 80 | + 'no_empty_phpdoc' => false, |
| 81 | + 'no_spaces_after_function_name' => false, |
| 82 | + 'no_superfluous_phpdoc_tags' => false, |
| 83 | + 'ordered_imports' => false, |
| 84 | + 'phpdoc_indent' => false, |
| 85 | + 'phpdoc_no_alias_tag' => false, |
| 86 | + 'phpdoc_no_package' => false, |
| 87 | + 'phpdoc_separation' => false, |
| 88 | + 'phpdoc_summary' => false, |
| 89 | + 'single_line_empty_body' => false, |
| 90 | + 'single_quote' => false, |
| 91 | + 'single_space_around_construct' => false, |
| 92 | + 'spaces_inside_parentheses' => false, |
| 93 | + 'static_lambda' => false, |
| 94 | + 'strict_comparison' => false, |
| 95 | + 'strict_param' => false, |
| 96 | + 'string_implicit_backslashes' => false, |
| 97 | + 'yoda_style' => false, |
| 98 | + ]) |
| 99 | + ->setFinder($finder) |
| 100 | + ->setCacheFile(sys_get_temp_dir() . '/php-cs-fixer.' . md5(__DIR__) . '.cache'); |
0 commit comments