Skip to content

Commit 6a54d45

Browse files
authored
Disable TypedClassConstantFixer for PHP < 8.3 (#12)
* Disable TypedClassConstantFixer for PHP < 8.3 * Disable PhpdocTagNoNamedArgumentsFixer for backward compatibility * Replace php-cs-fixer/shim with friendsofphp/php-cs-fixer * Update Psalm autoload path to vendor/autoload.php * Replace all name() calls with hardcoded fixer names * Add fixers for backward compatibility
1 parent 9a924d5 commit 6a54d45

File tree

3 files changed

+18
-26
lines changed

3 files changed

+18
-26
lines changed

composer.json

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"require": {
77
"php": "^7.4 || ^8.0",
88
"kubawerlos/php-cs-fixer-custom-fixers": "^3.16.2",
9-
"php-cs-fixer/shim": "^3.22"
9+
"friendsofphp/php-cs-fixer": "^3.22"
1010
},
1111
"require-dev": {
1212
"phpunit/phpunit": "^9.6.11",
@@ -28,10 +28,8 @@
2828
],
2929
"verify": [
3030
"php-cs-fixer fix -vvv --diff --dry-run",
31-
"mkdir -p ./var",
32-
"@composer require friendsofphp/php-cs-fixer --no-interaction --working-dir=./var",
3331
"psalm --no-progress --shepherd",
34-
"phpunit --bootstrap=./var/vendor/autoload.php --no-configuration ./tests"
32+
"phpunit --no-configuration ./tests"
3533
]
3634
}
3735
}

psalm.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
xsi:schemaLocation='https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd'
77
findUnusedBaselineEntry='true'
88
findUnusedCode='false'
9-
autoloader='./var/vendor/autoload.php'
9+
autoloader='vendor/autoload.php'
1010
>
1111
<projectFiles>
1212
<directory name='./src' />

src/Unwanted.php

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,6 @@
44

55
namespace Tpay\CodingStandards;
66

7-
use PhpCsFixerCustomFixers\Fixer\ConstructorEmptyBracesFixer;
8-
use PhpCsFixerCustomFixers\Fixer\DeclareAfterOpeningTagFixer;
9-
use PhpCsFixerCustomFixers\Fixer\EmptyFunctionBodyFixer;
10-
use PhpCsFixerCustomFixers\Fixer\NoImportFromGlobalNamespaceFixer;
11-
use PhpCsFixerCustomFixers\Fixer\NoNullableBooleanTypeFixer;
12-
use PhpCsFixerCustomFixers\Fixer\NoReferenceInFunctionDefinitionFixer;
13-
use PhpCsFixerCustomFixers\Fixer\PhpdocOnlyAllowedAnnotationsFixer;
14-
use PhpCsFixerCustomFixers\Fixer\PhpdocVarAnnotationToAssertFixer;
15-
use PhpCsFixerCustomFixers\Fixer\PromotedConstructorPropertyFixer;
16-
use PhpCsFixerCustomFixers\Fixer\ReadonlyPromotedPropertiesFixer;
17-
187
final class Unwanted
198
{
209
public static function isUnwanted(string $name): bool
@@ -35,26 +24,31 @@ public static function isUnwanted(string $name): bool
3524
'not_operator_with_space',
3625
'not_operator_with_successor_space',
3726
'octal_notation',
27+
'php_unit_attributes',
3828
'php_unit_internal_class',
3929
'php_unit_size_class',
4030
'php_unit_strict',
4131
'php_unit_test_class_requires_covers',
4232
'phpdoc_summary',
4333
'phpdoc_to_property_type',
34+
'phpdoc_to_return_type',
4435
'single_line_comment_spacing',
4536
'single_line_throw',
37+
'string_implicit_backslashes',
4638
'strict_param',
4739
'void_return',
48-
ConstructorEmptyBracesFixer::name(),
49-
DeclareAfterOpeningTagFixer::name(),
50-
EmptyFunctionBodyFixer::name(),
51-
NoImportFromGlobalNamespaceFixer::name(),
52-
NoNullableBooleanTypeFixer::name(),
53-
NoReferenceInFunctionDefinitionFixer::name(),
54-
PhpdocOnlyAllowedAnnotationsFixer::name(),
55-
PhpdocVarAnnotationToAssertFixer::name(),
56-
PromotedConstructorPropertyFixer::name(),
57-
ReadonlyPromotedPropertiesFixer::name(),
40+
'PhpCsFixerCustomFixers/constructor_empty_braces',
41+
'PhpCsFixerCustomFixers/declare_after_opening_tag',
42+
'PhpCsFixerCustomFixers/empty_function_body',
43+
'PhpCsFixerCustomFixers/no_import_from_global_namespace',
44+
'PhpCsFixerCustomFixers/no_nullable_boolean_type',
45+
'PhpCsFixerCustomFixers/no_reference_in_function_definition',
46+
'PhpCsFixerCustomFixers/phpdoc_only_allowed_annotations',
47+
'PhpCsFixerCustomFixers/phpdoc_var_annotation_to_assert',
48+
'PhpCsFixerCustomFixers/promoted_constructor_property',
49+
'PhpCsFixerCustomFixers/readonly_promoted_properties',
50+
'PhpCsFixerCustomFixers/phpdoc_tag_no_named_arguments',
51+
'PhpCsFixerCustomFixers/typed_class_constant',
5852
],
5953
true,
6054
);

0 commit comments

Comments
 (0)