@@ -11,7 +11,9 @@ final class Config extends CsFixerConfig
1111
1212 private $ extraRules ;
1313
14- public function __construct ($ useRisky = true , array $ extraRules = [])
14+ private bool $ disablePrettierRules ;
15+
16+ public function __construct ($ useRisky = true , array $ extraRules = [], bool $ disablePrettierRules = false )
1517 {
1618 parent ::__construct ('Mapado ' );
1719
@@ -20,6 +22,7 @@ public function __construct($useRisky = true, array $extraRules = [])
2022 $ this ->setRiskyAllowed (true );
2123 $ this ->useRisky = $ useRisky ;
2224 $ this ->extraRules = $ extraRules ;
25+ $ this ->disablePrettierRules = $ disablePrettierRules ;
2326 }
2427
2528 public function getRules (): array
@@ -89,7 +92,6 @@ public function getRules(): array
8992 // https://cs.symfony.com/doc/rules/return_notation/simplified_null_return.html
9093 'simplified_null_return ' => true ,
9194
92-
9395 // List (array destructuring) assignment should be declared using the configured syntax.
9496 // https://cs.symfony.com/doc/rules/list_notation/list_syntax.html
9597 'list_syntax ' => ['syntax ' => 'short ' ],
@@ -134,13 +136,9 @@ public function getRules(): array
134136 // Comparing to Symfony let prettier handle `as` like it wants
135137 // https://cs.symfony.com/doc/rules/language_construct/single_space_around_construct.html
136138 'single_space_around_construct ' => [
137- 'constructs_preceded_by_a_single_space ' => ['use_lambda ' ]
138-
139+ 'constructs_preceded_by_a_single_space ' => ['use_lambda ' ],
139140 ],
140141
141- // until prettier fixes https://github.com/prettier/plugin-php/issues/2400
142- 'single_line_empty_body ' => false ,
143-
144142 // === Doctrine ===
145143
146144 // Rules covering Doctrine annotations with configuration based on examples found in Doctrine Annotation documentation and Symfony documentation.
@@ -170,6 +168,18 @@ public function getRules(): array
170168 ];
171169 }
172170
171+ if ($ this ->disablePrettierRules ) {
172+ $ out = array_merge ($ out , [
173+ 'class_definition ' => false ,
174+ 'statement_indentation ' => false ,
175+ 'no_unneeded_control_parentheses ' => false ,
176+ 'no_multiline_whitespace_around_double_arrow ' => false ,
177+ 'types_spaces ' => false , // not that clear in PER
178+ 'single_space_around_construct ' => false ,
179+ 'method_argument_space ' => false ,
180+ ]);
181+ }
182+
173183 // do not use array_merge or `+` to put new key at the end
174184 foreach ($ this ->extraRules as $ key => $ value ) {
175185 $ out [$ key ] = $ value ;
0 commit comments