3
3
namespace Narrowspark \CS \Config \Tests ;
4
4
5
5
use Narrowspark \CS \Config \Config ;
6
- use PedroTroller \CS \Fixer \Fixers ;
7
6
use PhpCsFixer \ConfigInterface ;
8
7
use PhpCsFixer \FixerFactory ;
9
8
use PhpCsFixer \RuleSet ;
9
+ use PhpCsFixerCustomFixers \Fixer \InternalClassCasingFixer ;
10
+ use PhpCsFixerCustomFixers \Fixer \MultilineCommentOpeningClosingAloneFixer ;
11
+ use PhpCsFixerCustomFixers \Fixer \NoCommentedOutCodeFixer ;
12
+ use PhpCsFixerCustomFixers \Fixer \NoDoctrineMigrationsGeneratedCommentFixer ;
13
+ use PhpCsFixerCustomFixers \Fixer \NoImportFromGlobalNamespaceFixer ;
14
+ use PhpCsFixerCustomFixers \Fixer \NoLeadingSlashInGlobalNamespaceFixer ;
15
+ use PhpCsFixerCustomFixers \Fixer \NoNullableBooleanTypeFixer ;
16
+ use PhpCsFixerCustomFixers \Fixer \NoPhpStormGeneratedCommentFixer ;
17
+ use PhpCsFixerCustomFixers \Fixer \NoReferenceInFunctionDefinitionFixer ;
18
+ use PhpCsFixerCustomFixers \Fixer \NoUnneededConcatenationFixer ;
19
+ use PhpCsFixerCustomFixers \Fixer \NoUselessCommentFixer ;
20
+ use PhpCsFixerCustomFixers \Fixer \NoUselessDoctrineRepositoryCommentFixer ;
21
+ use PhpCsFixerCustomFixers \Fixer \NullableParamStyleFixer ;
22
+ use PhpCsFixerCustomFixers \Fixer \OperatorLinebreakFixer ;
23
+ use PhpCsFixerCustomFixers \Fixer \PhpdocNoIncorrectVarAnnotationFixer ;
24
+ use PhpCsFixerCustomFixers \Fixer \PhpdocNoSuperfluousParamFixer ;
25
+ use PhpCsFixerCustomFixers \Fixer \PhpdocParamOrderFixer ;
26
+ use PhpCsFixerCustomFixers \Fixer \PhpdocParamTypeFixer ;
27
+ use PhpCsFixerCustomFixers \Fixer \PhpdocSelfAccessorFixer ;
28
+ use PhpCsFixerCustomFixers \Fixer \PhpdocSingleLineVarFixer ;
29
+ use PhpCsFixerCustomFixers \Fixer \SingleSpaceAfterStatementFixer ;
30
+ use PhpCsFixerCustomFixers \Fixer \SingleSpaceBeforeStatementFixer ;
10
31
use PHPUnit \Framework \TestCase ;
11
32
use ReflectionProperty ;
12
33
@@ -63,7 +84,8 @@ public function testIfAllRulesAreTested(): void
63
84
$ this ->getPhp71Rules (),
64
85
$ this ->getPhp73Rules (),
65
86
$ this ->getPHPUnitRules (),
66
- $ this ->getPedroTrollerRules ()
87
+ $ this ->getPedroTrollerRules (),
88
+ $ this ->getKubawerlosRules ()
67
89
);
68
90
$ rules = (new Config ())->getRules ();
69
91
@@ -107,17 +129,23 @@ public function testAllConfiguredRulesAreBuiltIn(): void
107
129
{
108
130
$ pedroTrollerRules = [];
109
131
110
- foreach (new Fixers () as $ fixer ) {
132
+ foreach (new \ PedroTroller \ CS \ Fixer \ Fixers () as $ fixer ) {
111
133
if ($ fixer ->isDeprecated ()) {
112
134
continue ;
113
135
}
114
136
115
137
$ pedroTrollerRules [] = $ fixer ->getName ();
116
138
}
117
139
140
+ $ kubawerlosRules = [];
141
+
142
+ foreach (new \PhpCsFixerCustomFixers \Fixers () as $ fixer ) {
143
+ $ kubawerlosRules [] = $ fixer ->getName ();
144
+ }
145
+
118
146
$ fixersNotBuiltIn = \array_diff (
119
147
$ this ->configuredFixers (),
120
- \array_merge ($ this ->builtInFixers (), $ pedroTrollerRules )
148
+ \array_merge ($ this ->builtInFixers (), $ pedroTrollerRules, $ kubawerlosRules )
121
149
);
122
150
123
151
$ this ->assertEmpty ($ fixersNotBuiltIn , \sprintf (
@@ -245,6 +273,37 @@ public function getPedroTrollerRules(): array
245
273
];
246
274
}
247
275
276
+ /**
277
+ * @return array
278
+ */
279
+ public function getKubawerlosRules (): array
280
+ {
281
+ return [
282
+ InternalClassCasingFixer::name () => true ,
283
+ MultilineCommentOpeningClosingAloneFixer::name () => false ,
284
+ NoCommentedOutCodeFixer::name () => true ,
285
+ NoDoctrineMigrationsGeneratedCommentFixer::name () => true ,
286
+ NoImportFromGlobalNamespaceFixer::name () => false ,
287
+ NoLeadingSlashInGlobalNamespaceFixer::name () => true ,
288
+ NoNullableBooleanTypeFixer::name () => false ,
289
+ NoPhpStormGeneratedCommentFixer::name () => true ,
290
+ NoReferenceInFunctionDefinitionFixer::name () => false ,
291
+ NoUnneededConcatenationFixer::name () => true ,
292
+ NoUselessCommentFixer::name () => false ,
293
+ NoUselessDoctrineRepositoryCommentFixer::name () => true ,
294
+ NullableParamStyleFixer::name () => false ,
295
+ OperatorLinebreakFixer::name () => true ,
296
+ PhpdocNoIncorrectVarAnnotationFixer::name () => true ,
297
+ PhpdocNoSuperfluousParamFixer::name () => true ,
298
+ PhpdocParamOrderFixer::name () => true ,
299
+ PhpdocParamTypeFixer::name () => true ,
300
+ PhpdocSelfAccessorFixer::name () => true ,
301
+ PhpdocSingleLineVarFixer::name () => true ,
302
+ SingleSpaceAfterStatementFixer::name () => true ,
303
+ SingleSpaceBeforeStatementFixer::name () => true ,
304
+ ];
305
+ }
306
+
248
307
/**
249
308
* @return array
250
309
*/
@@ -277,6 +336,7 @@ protected function getContribRules(): array
277
336
'escape_implicit_backslashes ' => true ,
278
337
'explicit_indirect_variable ' => true ,
279
338
'explicit_string_variable ' => true ,
339
+ 'final_class ' => true ,
280
340
'final_internal_class ' => true ,
281
341
'fully_qualified_strict_types ' => true ,
282
342
'general_phpdoc_annotation_remove ' => false ,
@@ -314,6 +374,7 @@ protected function getContribRules(): array
314
374
'no_unset_cast ' => true ,
315
375
'ordered_class_elements ' => true ,
316
376
'ordered_imports ' => true ,
377
+ 'ordered_interfaces ' => true ,
317
378
'php_unit_strict ' => false ,
318
379
'php_unit_method_casing ' => true ,
319
380
'php_unit_test_class_requires_covers ' => false ,
@@ -354,8 +415,10 @@ private function getPHPUnitRules(): array
354
415
'php_unit_expectation ' => [
355
416
'target ' => 'newest ' ,
356
417
],
357
- 'php_unit_mock ' => true ,
358
- 'php_unit_namespaced ' => [
418
+ 'php_unit_dedicate_assert_internal_type ' => true ,
419
+ 'php_unit_mock ' => true ,
420
+ 'php_unit_mock_short_will_return ' => true ,
421
+ 'php_unit_namespaced ' => [
359
422
'target ' => 'newest ' ,
360
423
],
361
424
'php_unit_no_expectation_annotation ' => [
@@ -375,6 +438,7 @@ private function getPHPUnitRules(): array
375
438
'php_unit_ordered_covers ' => true ,
376
439
'php_unit_set_up_tear_down_visibility ' => true ,
377
440
'php_unit_strict ' => false ,
441
+ 'php_unit_size_class ' => true ,
378
442
'php_unit_test_annotation ' => true ,
379
443
'php_unit_test_class_requires_covers ' => false ,
380
444
];
@@ -471,6 +535,7 @@ private function getSymfonyRules(): array
471
535
'native_function_casing ' => true ,
472
536
'native_function_invocation ' => true ,
473
537
'new_with_braces ' => true ,
538
+ 'native_function_type_declaration_casing ' => true ,
474
539
'no_alias_functions ' => true ,
475
540
'no_blank_lines_after_class_opening ' => true ,
476
541
'no_blank_lines_after_phpdoc ' => true ,
@@ -540,8 +605,10 @@ private function getSymfonyRules(): array
540
605
'self_accessor ' => false ,
541
606
'short_scalar_cast ' => true ,
542
607
'silenced_deprecation_error ' => false ,
608
+ 'simple_to_complex_string_variable ' => true ,
543
609
'single_blank_line_before_namespace ' => false ,
544
610
'single_quote ' => true ,
611
+ 'single_trait_insert_per_statement ' => true ,
545
612
'space_after_semicolon ' => true ,
546
613
'single_line_comment_style ' => false ,
547
614
'standardize_not_equals ' => true ,
@@ -596,6 +663,8 @@ private function configuredFixers(): array
596
663
}
597
664
598
665
/**
666
+ * @throws \ReflectionException
667
+ *
599
668
* @return string[]
600
669
*/
601
670
private function builtInFixers (): array
0 commit comments