1111final class Rules
1212{
1313 // phpcs:disable SlevomatCodingStandard.Functions.FunctionLength.FunctionLength -- a flat rule list, not logic
14- // phpcs:ignore SlevomatCodingStandard.TypeHints.DisallowMixedTypeHint.DisallowedMixedTypeHint
15- /** @return array<string, array<string, mixed>|bool> */
14+ // phpcs:disable SlevomatCodingStandard.TypeHints.DisallowMixedTypeHint.DisallowedMixedTypeHint
15+ /**
16+ * @see https://mlocati.github.io/php-cs-fixer-configurator/
17+ * @return array<string, array<string, mixed>|bool>
18+ */
1619 public static function get (): array
1720 {
21+ // phpcs:enable SlevomatCodingStandard.TypeHints.DisallowMixedTypeHint.DisallowedMixedTypeHint
1822 return [
1923 // Basic PER Coding Style 3.0 ruleset plus our overrides for it, see https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/master/doc/ruleSets/PER-CS3x0.rst
2024 '@PER-CS3x0 ' => true , // https://www.php-fig.org/per/coding-style/
@@ -36,10 +40,11 @@ public static function get(): array
3640 'binary_operator_spaces ' => ['default ' => 'single_space ' ],
3741 'cast_spaces ' => ['space ' => 'single ' ],
3842 'class_attributes_separation ' => ['elements ' => ['method ' => 'one ' ]],
39- 'declare_strict_types ' => true ,
43+ 'declare_strict_types ' => true , // risky
4044 'explicit_string_variable ' => true ,
41- 'final_class ' => true ,
42- 'final_public_method_for_abstract_class ' => true ,
45+ // 'final_class' is deliberately NOT enabled: it cannot see subclasses in other files and finalizes extended classes.
46+ // The report-only SlevomatCodingStandard.Classes.RequireAbstractOrFinal sniff enforces the same policy safely.
47+ 'final_public_method_for_abstract_class ' => true , // risky
4348 'general_phpdoc_annotation_remove ' => [
4449 'annotations ' => [
4550 // '@api' is intentionally NOT removed: it marks the supported public/BC surface.
@@ -66,19 +71,19 @@ public static function get(): array
6671 'import_constants ' => false ,
6772 ],
6873 'heredoc_to_nowdoc ' => true ,
69- 'is_null ' => true ,
70- 'logical_operators ' => true ,
71- 'modernize_types_casting ' => true ,
72- 'mb_str_functions ' => true ,
74+ 'is_null ' => true , // risky
75+ 'logical_operators ' => true , // risky
76+ 'modernize_types_casting ' => true , // risky
77+ 'mb_str_functions ' => true , // risky
7378 'multiline_whitespace_before_semicolons ' => ['strategy ' => 'no_multi_line ' ],
74- 'native_constant_invocation ' => ['strict ' => false ], // non-strict: keep `\` on userland global constants (e.g. PHPCS token constants)
79+ 'native_constant_invocation ' => ['strict ' => false ], // risky; non-strict: keep `\` on userland global constants (e.g. PHPCS token constants)
7580 'native_function_casing ' => true ,
7681 'no_binary_string ' => true ,
7782 'no_empty_comment ' => true ,
7883 'no_empty_phpdoc ' => true ,
7984 'no_empty_statement ' => true ,
8085 'no_extra_blank_lines ' => ['tokens ' => ['extra ' , 'curly_brace_block ' ]],
81- 'no_homoglyph_names ' => true ,
86+ 'no_homoglyph_names ' => true , // risky
8287 'no_leading_namespace_whitespace ' => true ,
8388 'no_mixed_echo_print ' => true ,
8489 'no_short_bool_cast ' => true ,
@@ -91,8 +96,8 @@ public static function get(): array
9196 'no_unneeded_braces ' => true ,
9297 'no_unneeded_control_parentheses ' => true ,
9398 'no_unneeded_import_alias ' => true ,
94- 'no_unneeded_final_method ' => true ,
95- 'no_unreachable_default_argument_value ' => true ,
99+ 'no_unneeded_final_method ' => true , // risky
100+ 'no_unreachable_default_argument_value ' => true , // risky
96101 'no_unused_imports ' => true ,
97102 'no_useless_concat_operator ' => true ,
98103 'no_useless_return ' => true ,
@@ -112,17 +117,17 @@ public static function get(): array
112117 ],
113118 ],
114119 'php_unit_attributes ' => true ,
115- 'php_unit_construct ' => true ,
116- 'php_unit_dedicate_assert ' => ['target ' => 'newest ' ],
117- 'php_unit_expectation ' => true ,
120+ 'php_unit_construct ' => true , // risky
121+ 'php_unit_dedicate_assert ' => ['target ' => 'newest ' ], // risky
122+ 'php_unit_expectation ' => true , // risky
118123 'php_unit_fqcn_annotation ' => true ,
119124 'php_unit_method_casing ' => ['case ' => 'snake_case ' ],
120- 'php_unit_no_expectation_annotation ' => true ,
121- 'php_unit_set_up_tear_down_visibility ' => true ,
122- 'php_unit_strict ' => true ,
123- 'php_unit_test_annotation ' => ['style ' => 'annotation ' ],
125+ 'php_unit_no_expectation_annotation ' => true , // risky
126+ 'php_unit_set_up_tear_down_visibility ' => true , // risky
127+ 'php_unit_strict ' => true , // risky
128+ 'php_unit_test_annotation ' => ['style ' => 'annotation ' ], // risky
124129 'phpdoc_align ' => ['align ' => 'left ' ],
125- 'phpdoc_array_type ' => true ,
130+ 'phpdoc_array_type ' => true , // risky
126131 'phpdoc_indent ' => true ,
127132 'phpdoc_line_span ' => [
128133 'case ' => 'single ' ,
@@ -141,17 +146,18 @@ public static function get(): array
141146 'phpdoc_types ' => true ,
142147 'phpdoc_types_order ' => ['null_adjustment ' => 'always_last ' , 'sort_algorithm ' => 'none ' ],
143148 'protected_to_private ' => true ,
144- 'psr_autoloading ' => true ,
145- 'self_accessor ' => true ,
149+ 'psr_autoloading ' => true , // risky
150+ 'self_accessor ' => true , // risky
146151 'self_static_accessor ' => true ,
147152 'single_line_comment_spacing ' => true ,
148153 'single_line_comment_style ' => ['comment_types ' => ['asterisk ' , 'hash ' ]],
149154 'single_quote ' => true ,
150155 'space_after_semicolon ' => true ,
151156 'standardize_not_equals ' => true ,
152- 'static_lambda ' => true ,
153- 'strict_param ' => true ,
154- 'ternary_to_elvis_operator ' => true ,
157+ // 'static_lambda' is deliberately NOT enabled: Laravel rebinds closures via Closure::bind (macros, Blade, Pest), static closures break there.
158+ // The report-only SlevomatCodingStandard.Functions.StaticClosure sniff enforces the same policy safely.
159+ 'strict_param ' => true , // risky
160+ 'ternary_to_elvis_operator ' => true , // risky
155161 'ternary_to_null_coalescing ' => true ,
156162 'trim_array_spaces ' => true ,
157163 // Deliberately narrower than PER-CS 2.0+ (arrays only, not arguments/parameters/match):
0 commit comments