Skip to content

Commit 9148265

Browse files
committed
Replace all name() calls with hardcoded fixer names
1 parent 7805efd commit 9148265

File tree

1 file changed

+38
-67
lines changed

1 file changed

+38
-67
lines changed

src/Unwanted.php

Lines changed: 38 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -4,79 +4,50 @@
44

55
namespace Tpay\CodingStandards;
66

7-
use PhpCsFixerCustomFixers\Fixer\AbstractFixer;
8-
use PhpCsFixerCustomFixers\Fixer\ConstructorEmptyBracesFixer;
9-
use PhpCsFixerCustomFixers\Fixer\DeclareAfterOpeningTagFixer;
10-
use PhpCsFixerCustomFixers\Fixer\EmptyFunctionBodyFixer;
11-
use PhpCsFixerCustomFixers\Fixer\NoImportFromGlobalNamespaceFixer;
12-
use PhpCsFixerCustomFixers\Fixer\NoNullableBooleanTypeFixer;
13-
use PhpCsFixerCustomFixers\Fixer\NoReferenceInFunctionDefinitionFixer;
14-
use PhpCsFixerCustomFixers\Fixer\PhpdocOnlyAllowedAnnotationsFixer;
15-
use PhpCsFixerCustomFixers\Fixer\PhpdocVarAnnotationToAssertFixer;
16-
use PhpCsFixerCustomFixers\Fixer\PromotedConstructorPropertyFixer;
17-
use PhpCsFixerCustomFixers\Fixer\ReadonlyPromotedPropertiesFixer;
18-
197
final class Unwanted
208
{
219
public static function isUnwanted(string $name): bool
2210
{
23-
/** @var list<string> $unwanted */
24-
$unwanted = [
25-
'braces',
26-
'combine_consecutive_issets',
27-
'combine_consecutive_unsets',
28-
'date_time_immutable',
29-
'final_class',
30-
'general_phpdoc_annotation_remove',
31-
'group_import',
32-
'heredoc_indentation',
33-
'mb_str_functions',
34-
'no_blank_lines_before_namespace',
35-
'not_operator_with_space',
36-
'not_operator_with_successor_space',
37-
'octal_notation',
38-
'php_unit_attributes',
39-
'php_unit_internal_class',
40-
'php_unit_size_class',
41-
'php_unit_strict',
42-
'php_unit_test_class_requires_covers',
43-
'phpdoc_summary',
44-
'phpdoc_to_property_type',
45-
'phpdoc_to_return_type',
46-
'single_line_comment_spacing',
47-
'single_line_throw',
48-
'strict_param',
49-
'string_implicit_backslashes',
50-
'void_return',
51-
52-
ConstructorEmptyBracesFixer::name(),
53-
DeclareAfterOpeningTagFixer::name(),
54-
EmptyFunctionBodyFixer::name(),
55-
NoImportFromGlobalNamespaceFixer::name(),
56-
NoNullableBooleanTypeFixer::name(),
57-
NoReferenceInFunctionDefinitionFixer::name(),
58-
PhpdocOnlyAllowedAnnotationsFixer::name(),
59-
PhpdocVarAnnotationToAssertFixer::name(),
60-
PromotedConstructorPropertyFixer::name(),
61-
ReadonlyPromotedPropertiesFixer::name(),
62-
];
63-
64-
$unwantedIfExists = [
65-
'PhpCsFixerCustomFixers\\Fixer\\PhpdocTagNoNamedArgumentsFixer',
66-
'PhpCsFixerCustomFixers\\Fixer\\TypedClassConstantFixer',
67-
];
68-
69-
while ($class = array_shift($unwantedIfExists)) {
70-
if (class_exists($class) && is_a($class, AbstractFixer::class, true)) {
71-
$fixerName = $class::name();
72-
$unwanted[] = $fixerName;
73-
}
74-
}
75-
7611
return in_array(
7712
$name,
78-
$unwanted,
79-
true
13+
[
14+
'braces',
15+
'combine_consecutive_issets',
16+
'combine_consecutive_unsets',
17+
'date_time_immutable',
18+
'final_class',
19+
'general_phpdoc_annotation_remove',
20+
'group_import',
21+
'heredoc_indentation',
22+
'mb_str_functions',
23+
'no_blank_lines_before_namespace',
24+
'not_operator_with_space',
25+
'not_operator_with_successor_space',
26+
'octal_notation',
27+
'php_unit_internal_class',
28+
'php_unit_size_class',
29+
'php_unit_strict',
30+
'php_unit_test_class_requires_covers',
31+
'phpdoc_summary',
32+
'phpdoc_to_property_type',
33+
'single_line_comment_spacing',
34+
'single_line_throw',
35+
'strict_param',
36+
'void_return',
37+
'PhpCsFixerCustomFixers/constructor_empty_braces',
38+
'PhpCsFixerCustomFixers/declare_after_opening_tag',
39+
'PhpCsFixerCustomFixers/empty_function_body',
40+
'PhpCsFixerCustomFixers/no_import_from_global_namespace',
41+
'PhpCsFixerCustomFixers/no_nullable_boolean_type',
42+
'PhpCsFixerCustomFixers/no_reference_in_function_definition',
43+
'PhpCsFixerCustomFixers/phpdoc_only_allowed_annotations',
44+
'PhpCsFixerCustomFixers/phpdoc_var_annotation_to_assert',
45+
'PhpCsFixerCustomFixers/promoted_constructor_property',
46+
'PhpCsFixerCustomFixers/readonly_promoted_properties',
47+
'PhpCsFixerCustomFixers/phpdoc_tag_no_named_arguments',
48+
'PhpCsFixerCustomFixers/typed_class_constant',
49+
],
50+
true,
8051
);
8152
}
8253
}

0 commit comments

Comments
 (0)