|
| 1 | +<?php |
| 2 | + |
| 3 | +require_once __DIR__.'/vendor/autoload.php'; |
| 4 | + |
| 5 | +return (new PhpCsFixer\Config()) |
| 6 | + ->setRiskyAllowed(true) |
| 7 | + ->setIndent("\t") |
| 8 | + ->setLineEnding("\n") |
| 9 | + ->setRules([ |
| 10 | + '@PSR2' => true, |
| 11 | + 'function_declaration' => [ |
| 12 | + 'closure_function_spacing' => 'none', |
| 13 | + ], |
| 14 | + 'ordered_imports' => [ |
| 15 | + 'sort_algorithm' => 'alpha', |
| 16 | + ], |
| 17 | + 'array_indentation' => true, |
| 18 | + 'braces' => [ |
| 19 | + 'allow_single_line_closure' => true, |
| 20 | + ], |
| 21 | + 'no_break_comment' => false, |
| 22 | + 'return_type_declaration' => [ |
| 23 | + 'space_before' => 'none', |
| 24 | + ], |
| 25 | + 'blank_line_after_opening_tag' => true, |
| 26 | + 'compact_nullable_typehint' => true, |
| 27 | + 'cast_spaces' => true, |
| 28 | + 'concat_space' => [ |
| 29 | + 'spacing' => 'none', |
| 30 | + ], |
| 31 | + 'declare_equal_normalize' => [ |
| 32 | + 'space' => 'none', |
| 33 | + ], |
| 34 | + 'function_typehint_space' => true, |
| 35 | + 'new_with_braces' => true, |
| 36 | + 'method_argument_space' => true, |
| 37 | + 'no_empty_statement' => true, |
| 38 | + 'no_empty_comment' => true, |
| 39 | + 'no_empty_phpdoc' => true, |
| 40 | + 'no_extra_blank_lines' => [ |
| 41 | + 'tokens' => [ |
| 42 | + 'extra', |
| 43 | + 'use', |
| 44 | + 'use_trait', |
| 45 | + 'return', |
| 46 | + ], |
| 47 | + ], |
| 48 | + 'no_leading_import_slash' => true, |
| 49 | + 'no_leading_namespace_whitespace' => true, |
| 50 | + 'no_blank_lines_after_class_opening' => true, |
| 51 | + 'no_blank_lines_after_phpdoc' => true, |
| 52 | + 'no_whitespace_in_blank_line' => false, |
| 53 | + 'no_whitespace_before_comma_in_array' => true, |
| 54 | + 'no_useless_else' => true, |
| 55 | + 'no_useless_return' => true, |
| 56 | + 'single_trait_insert_per_statement' => true, |
| 57 | + 'psr_autoloading' => true, |
| 58 | + 'dir_constant' => true, |
| 59 | + 'single_line_comment_style' => [ |
| 60 | + 'comment_types' => ['hash'], |
| 61 | + ], |
| 62 | + 'include' => true, |
| 63 | + 'is_null' => true, |
| 64 | + 'linebreak_after_opening_tag' => true, |
| 65 | + 'lowercase_cast' => true, |
| 66 | + 'lowercase_static_reference' => true, |
| 67 | + 'magic_constant_casing' => true, |
| 68 | + 'magic_method_casing' => true, |
| 69 | + 'class_attributes_separation' => [ |
| 70 | + // TODO: This can be reverted when https://github.com/FriendsOfPHP/PHP-CS-Fixer/pull/5869 is merged |
| 71 | + 'elements' => ['const' => 'one', 'method' => 'one', 'property' => 'one'], |
| 72 | + ], |
| 73 | + 'modernize_types_casting' => true, |
| 74 | + 'native_function_casing' => true, |
| 75 | + 'native_function_type_declaration_casing' => true, |
| 76 | + 'no_alias_functions' => true, |
| 77 | + 'no_multiline_whitespace_around_double_arrow' => true, |
| 78 | + 'multiline_whitespace_before_semicolons' => true, |
| 79 | + 'no_short_bool_cast' => true, |
| 80 | + 'no_unused_imports' => true, |
| 81 | + 'no_php4_constructor' => true, |
| 82 | + 'no_singleline_whitespace_before_semicolons' => true, |
| 83 | + 'no_spaces_around_offset' => true, |
| 84 | + 'no_trailing_comma_in_list_call' => true, |
| 85 | + 'no_trailing_comma_in_singleline_array' => true, |
| 86 | + 'normalize_index_brace' => true, |
| 87 | + 'object_operator_without_whitespace' => true, |
| 88 | + 'phpdoc_annotation_without_dot' => true, |
| 89 | + 'phpdoc_indent' => true, |
| 90 | + 'phpdoc_no_package' => true, |
| 91 | + 'phpdoc_no_access' => true, |
| 92 | + 'phpdoc_no_useless_inheritdoc' => true, |
| 93 | + 'phpdoc_single_line_var_spacing' => true, |
| 94 | + 'phpdoc_trim' => true, |
| 95 | + 'phpdoc_types' => true, |
| 96 | + 'semicolon_after_instruction' => true, |
| 97 | + 'array_syntax' => [ |
| 98 | + 'syntax' => 'short', |
| 99 | + ], |
| 100 | + 'list_syntax' => [ |
| 101 | + 'syntax' => 'short', |
| 102 | + ], |
| 103 | + 'short_scalar_cast' => true, |
| 104 | + 'single_blank_line_before_namespace' => true, |
| 105 | + 'single_quote' => true, |
| 106 | + 'standardize_not_equals' => true, |
| 107 | + 'ternary_operator_spaces' => true, |
| 108 | + 'whitespace_after_comma_in_array' => true, |
| 109 | + 'not_operator_with_successor_space' => true, |
| 110 | + 'trailing_comma_in_multiline' => true, |
| 111 | + 'trim_array_spaces' => true, |
| 112 | + 'binary_operator_spaces' => true, |
| 113 | + 'unary_operator_spaces' => true, |
| 114 | + 'php_unit_method_casing' => [ |
| 115 | + 'case' => 'snake_case', |
| 116 | + ], |
| 117 | + 'php_unit_test_annotation' => [ |
| 118 | + 'style' => 'prefix', |
| 119 | + ], |
| 120 | + ]) |
| 121 | + ->setFinder( |
| 122 | + PhpCsFixer\Finder::create() |
| 123 | + ->exclude('.circleci') |
| 124 | + ->exclude('bin') |
| 125 | + ->exclude('node_modules') |
| 126 | + ->exclude('vendor') |
| 127 | + ->notPath('.phpstorm.meta.php') |
| 128 | + ->notPath('_ide_helper.php') |
| 129 | + ->notPath('artisan') |
| 130 | + ->in(__DIR__) |
| 131 | + ); |
0 commit comments