|
| 1 | +<?php |
| 2 | + |
| 3 | + $finder = PhpCsFixer\Finder::create() |
| 4 | + ->exclude('vendor') |
| 5 | + ->ignoreDotFiles(true) |
| 6 | + ->in(__DIR__); |
| 7 | + |
| 8 | + $config = new PhpCsFixer\Config(); |
| 9 | + return $config |
| 10 | + ->setUsingCache(true) |
| 11 | + ->setCacheFile(__DIR__ . '/.cache/.php-cs-fixer.cache') |
| 12 | + ->setRules([ |
| 13 | + '@PSR12' => true, |
| 14 | + 'align_multiline_comment' => ['comment_type' => 'phpdocs_only'], |
| 15 | + 'array_indentation' => true, |
| 16 | + 'array_syntax' => ['syntax' => 'short'], |
| 17 | + 'assign_null_coalescing_to_coalesce_equal' => true, |
| 18 | + 'blank_line_after_opening_tag' => true, |
| 19 | + 'cast_spaces' => ['space' => 'none'], |
| 20 | + 'combine_consecutive_issets' => true, |
| 21 | + 'combine_consecutive_unsets' => true, |
| 22 | + 'combine_nested_dirname' => true, |
| 23 | + 'concat_space' => ['spacing' => 'one'], |
| 24 | + 'declare_equal_normalize' => ['space' => 'single'], |
| 25 | + 'dir_constant' => true, |
| 26 | + 'explicit_string_variable' => true, |
| 27 | + 'full_opening_tag' => true, |
| 28 | + 'function_declaration' => ['closure_function_spacing' => 'one', 'closure_fn_spacing' => 'one'], |
| 29 | + 'function_typehint_space' => true, |
| 30 | + 'include' => true, |
| 31 | + 'logical_operators' => true, |
| 32 | + 'magic_constant_casing' => true, |
| 33 | + 'magic_method_casing' => true, |
| 34 | + 'method_chaining_indentation' => true, |
| 35 | + 'modernize_types_casting' => true, |
| 36 | + 'multiline_comment_opening_closing' => true, |
| 37 | + 'native_function_casing' => true, |
| 38 | + 'native_function_type_declaration_casing' => true, |
| 39 | + 'new_with_braces' => true, |
| 40 | + 'no_blank_lines_after_phpdoc' => true, |
| 41 | + 'no_empty_comment' => true, |
| 42 | + 'no_empty_phpdoc' => true, |
| 43 | + 'no_empty_statement' => true, |
| 44 | + 'no_leading_namespace_whitespace' => true, |
| 45 | + 'no_mixed_echo_print' => ['use' => 'echo'], |
| 46 | + 'no_short_bool_cast' => true, |
| 47 | + 'no_superfluous_elseif' => true, |
| 48 | + 'no_superfluous_phpdoc_tags' => ['allow_unused_params' => true], |
| 49 | + 'no_unneeded_braces' => true, |
| 50 | + 'no_unneeded_control_parentheses' => true, |
| 51 | + 'no_unneeded_import_alias' => true, |
| 52 | + 'no_unused_imports' => true, |
| 53 | + 'no_useless_else' => true, |
| 54 | + 'no_useless_nullsafe_operator' => true, |
| 55 | + 'no_useless_return' => true, |
| 56 | + 'no_whitespace_before_comma_in_array' => true, |
| 57 | + 'nullable_type_declaration_for_default_null_value' => true, |
| 58 | + 'nullable_type_declaration' => ['syntax' => 'union'], |
| 59 | + 'object_operator_without_whitespace' => true, |
| 60 | + 'operator_linebreak' => ['position' => 'end', 'only_booleans' => true], |
| 61 | + 'ordered_imports' => ['sort_algorithm' => 'alpha'], |
| 62 | + 'ordered_types' => ['sort_algorithm' => 'none', 'null_adjustment' => 'always_last'], |
| 63 | + 'phpdoc_align' => ['align' => 'left'], |
| 64 | + 'phpdoc_indent' => true, |
| 65 | + 'phpdoc_param_order' => true, |
| 66 | + 'phpdoc_scalar' => true, |
| 67 | + 'phpdoc_trim' => true, |
| 68 | + 'single_line_comment_style' => true, |
| 69 | + 'single_quote' => true, |
| 70 | + 'statement_indentation' => ['stick_comment_to_next_continuous_control_statement' => true], |
| 71 | + 'ternary_to_null_coalescing' => true, |
| 72 | + 'trim_array_spaces' => true, |
| 73 | + 'whitespace_after_comma_in_array' => true |
| 74 | + ]) |
| 75 | + ->setRiskyAllowed(true) |
| 76 | + ->setIndent("\t") |
| 77 | + ->setFinder($finder); |
0 commit comments