@@ -55,7 +55,7 @@ public static function create(array $rules = []): self
5555 );
5656 }
5757
58- public function per (null | float |int $ version = null , bool $ risky = false ): self
58+ public function per (float |int | null $ version = null , bool $ risky = false ): self
5959 {
6060 $ candidates = null !== $ version
6161 ? ['@PER-CS ' .number_format ($ version , 1 , '. ' , '' )]
@@ -73,45 +73,55 @@ public function per(null|float|int $version = null, bool $risky = false): self
7373 continue ;
7474 }
7575
76- return self ::create (array_merge (
77- $ this ->rules ,
78- [$ candidate => true ],
79- ));
76+ return self ::create (
77+ array_merge (
78+ $ this ->rules ,
79+ [$ candidate => true ],
80+ )
81+ );
8082 }
8183
8284 throw new Exception ('RuleSet not found: ' .implode (', ' , $ candidates ));
8385 }
8486
8587 public function psr0 (): self
8688 {
87- return self ::create (array_merge (
88- $ this ->rules ,
89- ['@psr0 ' => true ]
90- ));
89+ return self ::create (
90+ array_merge (
91+ $ this ->rules ,
92+ ['@psr0 ' => true ]
93+ )
94+ );
9195 }
9296
9397 public function psr1 (): self
9498 {
95- return self ::create (array_merge (
96- $ this ->rules ,
97- ['@psr1 ' => true ]
98- ));
99+ return self ::create (
100+ array_merge (
101+ $ this ->rules ,
102+ ['@psr1 ' => true ]
103+ )
104+ );
99105 }
100106
101107 public function psr2 (): self
102108 {
103- return self ::create (array_merge (
104- $ this ->rules ,
105- ['@psr2 ' => true ]
106- ));
109+ return self ::create (
110+ array_merge (
111+ $ this ->rules ,
112+ ['@psr2 ' => true ]
113+ )
114+ );
107115 }
108116
109117 public function psr4 (): self
110118 {
111- return self ::create (array_merge (
112- $ this ->rules ,
113- ['@psr4 ' => true ]
114- ));
119+ return self ::create (
120+ array_merge (
121+ $ this ->rules ,
122+ ['@psr4 ' => true ]
123+ )
124+ );
115125 }
116126
117127 public function symfony (bool $ risky = false ): self
@@ -122,10 +132,12 @@ public function symfony(bool $risky = false): self
122132 $ rules ['@Symfony:risky ' ] = true ;
123133 }
124134
125- return self ::create (array_merge (
126- $ this ->rules ,
127- $ rules
128- ));
135+ return self ::create (
136+ array_merge (
137+ $ this ->rules ,
138+ $ rules
139+ )
140+ );
129141 }
130142
131143 public function phpCsFixer (bool $ risky = false ): self
@@ -136,18 +148,22 @@ public function phpCsFixer(bool $risky = false): self
136148 $ rules ['@PhpCsFixer:risky ' ] = true ;
137149 }
138150
139- return self ::create (array_merge (
140- $ this ->rules ,
141- $ rules
142- ));
151+ return self ::create (
152+ array_merge (
153+ $ this ->rules ,
154+ $ rules
155+ )
156+ );
143157 }
144158
145159 public function doctrineAnnotation (): self
146160 {
147- return self ::create (array_merge (
148- $ this ->rules ,
149- ['@DoctrineAnnotation ' => true ]
150- ));
161+ return self ::create (
162+ array_merge (
163+ $ this ->rules ,
164+ ['@DoctrineAnnotation ' => true ]
165+ )
166+ );
151167 }
152168
153169 public function php (float $ version , bool $ risky = false ): self
@@ -165,10 +181,12 @@ public function php(float $version, bool $risky = false): self
165181 $ config ['array_syntax ' ] = ['syntax ' => 'short ' ];
166182 }
167183
168- return self ::create (array_merge (
169- $ this ->rules ,
170- $ config
171- ));
184+ return self ::create (
185+ array_merge (
186+ $ this ->rules ,
187+ $ config
188+ )
189+ );
172190 }
173191
174192 public function phpUnit (float $ version , bool $ risky = false ): self
@@ -192,26 +210,32 @@ public function pedrotroller(bool $risky = false): self
192210 $ rules [$ fixer ->getName ()] = true ;
193211 }
194212
195- return self ::create (array_merge (
196- $ this ->rules ,
197- $ rules
198- ));
213+ return self ::create (
214+ array_merge (
215+ $ this ->rules ,
216+ $ rules
217+ )
218+ );
199219 }
200220
201221 public function enable (string $ name , ?array $ config = null ): self
202222 {
203- return self ::create (array_merge (
204- $ this ->rules ,
205- [$ name => \is_array ($ config ) ? $ config : true ]
206- ));
223+ return self ::create (
224+ array_merge (
225+ $ this ->rules ,
226+ [$ name => \is_array ($ config ) ? $ config : true ]
227+ )
228+ );
207229 }
208230
209231 public function disable (string $ name ): self
210232 {
211- return self ::create (array_merge (
212- $ this ->rules ,
213- [$ name => false ]
214- ));
233+ return self ::create (
234+ array_merge (
235+ $ this ->rules ,
236+ [$ name => false ]
237+ )
238+ );
215239 }
216240
217241 private function migration (string $ package , float $ version , bool $ risky ): self
@@ -228,31 +252,42 @@ static function ($name) {
228252
229253 $ rules = array_filter ($ rules );
230254
231- $ rules = array_filter ($ rules , static function ($ versionAndRisky ) use ($ package ) {
232- [$ rule , $ rulePackage , $ ruleVersion , $ ruleRisky ] = $ versionAndRisky ;
255+ $ rules = array_filter (
256+ $ rules ,
257+ static function ($ versionAndRisky ) use ($ package ) {
258+ [$ rule , $ rulePackage , $ ruleVersion , $ ruleRisky ] = $ versionAndRisky ;
233259
234- return strtoupper ($ package ) === strtoupper ($ rulePackage );
235- });
260+ return strtoupper ($ package ) === strtoupper ($ rulePackage );
261+ }
262+ );
236263
237- $ rules = array_filter ($ rules , static function ($ versionAndRisky ) use ($ version ) {
238- [$ rule , $ rulePackage , $ ruleVersion , $ ruleRisky ] = $ versionAndRisky ;
264+ $ rules = array_filter (
265+ $ rules ,
266+ static function ($ versionAndRisky ) use ($ version ) {
267+ [$ rule , $ rulePackage , $ ruleVersion , $ ruleRisky ] = $ versionAndRisky ;
239268
240- return ((float ) $ ruleVersion / 10 ) <= $ version ;
241- });
269+ return ((float ) $ ruleVersion / 10 ) <= $ version ;
270+ }
271+ );
242272
243- $ rules = array_filter ($ rules , static function ($ versionAndRisky ) use ($ risky ) {
244- [$ rule , $ rulePackage , $ ruleVersion , $ ruleRisky ] = $ versionAndRisky ;
273+ $ rules = array_filter (
274+ $ rules ,
275+ static function ($ versionAndRisky ) use ($ risky ) {
276+ [$ rule , $ rulePackage , $ ruleVersion , $ ruleRisky ] = $ versionAndRisky ;
245277
246- if ($ risky ) {
247- return true ;
248- }
278+ if ($ risky ) {
279+ return true ;
280+ }
249281
250- return empty ($ ruleRisky );
251- });
282+ return empty ($ ruleRisky );
283+ }
284+ );
252285
253- return self ::create (array_merge (
254- $ this ->rules ,
255- array_map (static fn () => true , $ rules )
256- ));
286+ return self ::create (
287+ array_merge (
288+ $ this ->rules ,
289+ array_map (static fn () => true , $ rules )
290+ )
291+ );
257292 }
258293}
0 commit comments