From 35809b0a5906c9557c9141c9ed1e367723a1d3f7 Mon Sep 17 00:00:00 2001 From: kenjis Date: Fri, 5 Apr 2024 11:13:37 +0900 Subject: [PATCH 1/6] Update rector.php --- rector.php | 8 ++++++++ src/Template/rector.php | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/rector.php b/rector.php index b4ec593..fc38cff 100644 --- a/rector.php +++ b/rector.php @@ -11,8 +11,10 @@ use Rector\CodeQuality\Rector\FuncCall\ChangeArrayPushToArrayAssignRector; use Rector\CodeQuality\Rector\FuncCall\SimplifyRegexPatternRector; use Rector\CodeQuality\Rector\FuncCall\SimplifyStrposLowerRector; +use Rector\CodeQuality\Rector\FuncCall\SingleInArrayToCompareRector; use Rector\CodeQuality\Rector\FunctionLike\SimplifyUselessVariableRector; use Rector\CodeQuality\Rector\If_\CombineIfRector; +use Rector\CodeQuality\Rector\If_\ExplicitBoolCompareRector; use Rector\CodeQuality\Rector\If_\ShortenElseIfRector; use Rector\CodeQuality\Rector\If_\SimplifyIfElseToTernaryRector; use Rector\CodeQuality\Rector\If_\SimplifyIfReturnBoolRector; @@ -21,6 +23,7 @@ use Rector\CodingStyle\Rector\ClassMethod\FuncGetArgsToVariadicParamRector; use Rector\CodingStyle\Rector\ClassMethod\MakeInheritedMethodVisibilitySameAsParentRector; use Rector\CodingStyle\Rector\FuncCall\CountArrayToEmptyArrayComparisonRector; +use Rector\CodingStyle\Rector\FuncCall\VersionCompareFuncCallToConstantRector; use Rector\Config\RectorConfig; use Rector\DeadCode\Rector\ClassMethod\RemoveUnusedPromotedPropertyRector; use Rector\EarlyReturn\Rector\Foreach_\ChangeNestedForeachIfsToEarlyContinueRector; @@ -37,6 +40,7 @@ use Rector\Set\ValueObject\LevelSetList; use Rector\Set\ValueObject\SetList; use Rector\Strict\Rector\Empty_\DisallowedEmptyRuleFixerRector; +use Rector\Strict\Rector\If_\BooleanInIfConditionRuleFixerRector; use Rector\TypeDeclaration\Rector\Empty_\EmptyOnNullableObjectToInstanceOfRector; use Rector\TypeDeclaration\Rector\Property\TypedPropertyFromAssignsRector; use Rector\ValueObject\PhpVersion; @@ -137,4 +141,8 @@ $rectorConfig->rule(StringClassNameToClassConstantRector::class); $rectorConfig->rule(PrivatizeFinalClassPropertyRector::class); $rectorConfig->rule(CompleteDynamicPropertiesRector::class); + $rectorConfig->rule(BooleanInIfConditionRuleFixerRector::class); + $rectorConfig->rule(SingleInArrayToCompareRector::class); + $rectorConfig->rule(VersionCompareFuncCallToConstantRector::class); + $rectorConfig->rule(ExplicitBoolCompareRector::class); }; diff --git a/src/Template/rector.php b/src/Template/rector.php index d67af9d..9487ad3 100644 --- a/src/Template/rector.php +++ b/src/Template/rector.php @@ -11,8 +11,10 @@ use Rector\CodeQuality\Rector\FuncCall\ChangeArrayPushToArrayAssignRector; use Rector\CodeQuality\Rector\FuncCall\SimplifyRegexPatternRector; use Rector\CodeQuality\Rector\FuncCall\SimplifyStrposLowerRector; +use Rector\CodeQuality\Rector\FuncCall\SingleInArrayToCompareRector; use Rector\CodeQuality\Rector\FunctionLike\SimplifyUselessVariableRector; use Rector\CodeQuality\Rector\If_\CombineIfRector; +use Rector\CodeQuality\Rector\If_\ExplicitBoolCompareRector; use Rector\CodeQuality\Rector\If_\ShortenElseIfRector; use Rector\CodeQuality\Rector\If_\SimplifyIfElseToTernaryRector; use Rector\CodeQuality\Rector\If_\SimplifyIfReturnBoolRector; @@ -21,6 +23,7 @@ use Rector\CodingStyle\Rector\ClassMethod\FuncGetArgsToVariadicParamRector; use Rector\CodingStyle\Rector\ClassMethod\MakeInheritedMethodVisibilitySameAsParentRector; use Rector\CodingStyle\Rector\FuncCall\CountArrayToEmptyArrayComparisonRector; +use Rector\CodingStyle\Rector\FuncCall\VersionCompareFuncCallToConstantRector; use Rector\Config\RectorConfig; use Rector\DeadCode\Rector\ClassMethod\RemoveUnusedPromotedPropertyRector; use Rector\EarlyReturn\Rector\Foreach_\ChangeNestedForeachIfsToEarlyContinueRector; @@ -37,6 +40,7 @@ use Rector\Set\ValueObject\LevelSetList; use Rector\Set\ValueObject\SetList; use Rector\Strict\Rector\Empty_\DisallowedEmptyRuleFixerRector; +use Rector\Strict\Rector\If_\BooleanInIfConditionRuleFixerRector; use Rector\TypeDeclaration\Rector\Empty_\EmptyOnNullableObjectToInstanceOfRector; use Rector\TypeDeclaration\Rector\Property\TypedPropertyFromAssignsRector; use Rector\ValueObject\PhpVersion; @@ -138,4 +142,8 @@ $rectorConfig->rule(StringClassNameToClassConstantRector::class); $rectorConfig->rule(PrivatizeFinalClassPropertyRector::class); $rectorConfig->rule(CompleteDynamicPropertiesRector::class); + $rectorConfig->rule(BooleanInIfConditionRuleFixerRector::class); + $rectorConfig->rule(SingleInArrayToCompareRector::class); + $rectorConfig->rule(VersionCompareFuncCallToConstantRector::class); + $rectorConfig->rule(ExplicitBoolCompareRector::class); }; From c5ae210567f410ec7c86ef0c409dfdea44d694a1 Mon Sep 17 00:00:00 2001 From: kenjis Date: Sun, 28 Apr 2024 10:25:24 +0900 Subject: [PATCH 2/6] Copy phpunit.xml.dist as phpunit9.xml.dist --- src/Template/phpunit9.xml.dist | 102 +++++++++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 src/Template/phpunit9.xml.dist diff --git a/src/Template/phpunit9.xml.dist b/src/Template/phpunit9.xml.dist new file mode 100644 index 0000000..665bdc4 --- /dev/null +++ b/src/Template/phpunit9.xml.dist @@ -0,0 +1,102 @@ + + + + + + ./app/ + + + ./app/Config + ./app/Views + + + + + + + + + + + + + ./tests + + + + + + + + + 0.50 + + + 30 + + + 2 + + + true + + + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 1be5d6a49845ece3f239a0e841b578a0adc85f95 Mon Sep 17 00:00:00 2001 From: kenjis Date: Sun, 28 Apr 2024 10:27:11 +0900 Subject: [PATCH 3/6] vendor/bin/phpunit --migrate-configuration -c src/Template/phpunit.xml.dist --- src/Template/phpunit.xml.dist | 160 ++++++++++++++-------------------- 1 file changed, 67 insertions(+), 93 deletions(-) diff --git a/src/Template/phpunit.xml.dist b/src/Template/phpunit.xml.dist index 665bdc4..ab30ada 100644 --- a/src/Template/phpunit.xml.dist +++ b/src/Template/phpunit.xml.dist @@ -1,96 +1,61 @@ - - - - - ./app/ - - - ./app/Config - ./app/Views - - - - - - - - - - - - - ./tests - - - - - - - - - 0.50 - - - 30 - - - 2 - - - true - - - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + - + + + + ./app/ + + + ./app/Config + ./app/Views + + From 2a0f990500a876c4ce071ce6ff31dff653a81259 Mon Sep 17 00:00:00 2001 From: kenjis Date: Sun, 28 Apr 2024 10:27:21 +0900 Subject: [PATCH 4/6] Add support PHPUnit10 --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 555ec7a..0d5e77f 100644 --- a/composer.json +++ b/composer.json @@ -27,12 +27,12 @@ "fakerphp/faker": "^1.9", "mikey179/vfsstream": "^1.6", "nexusphp/cs-config": "^3.6", - "nexusphp/tachycardia": "^1.3", + "nexusphp/tachycardia": "^1.3 || ^2.0", "phpstan/extension-installer": "^1.1", "phpstan/phpstan": "^1.0", "phpstan/phpstan-deprecation-rules": "^1.0", "phpstan/phpstan-phpunit": "^1.0", - "phpunit/phpunit": "^9.3", + "phpunit/phpunit": "^9.3 || ^10.5.16", "rector/rector": "^0.19 || ^1.0.0", "roave/security-advisories": "dev-latest", "vimeo/psalm": "^5.0" From f6e404045df184633081b68ed1b4c1615f65f225 Mon Sep 17 00:00:00 2001 From: kenjis Date: Sun, 28 Apr 2024 10:30:38 +0900 Subject: [PATCH 5/6] Reformat phpunit.xml.dist --- src/Template/phpunit.xml.dist | 162 ++++++++++++++++++---------------- 1 file changed, 88 insertions(+), 74 deletions(-) diff --git a/src/Template/phpunit.xml.dist b/src/Template/phpunit.xml.dist index ab30ada..db8945f 100644 --- a/src/Template/phpunit.xml.dist +++ b/src/Template/phpunit.xml.dist @@ -1,76 +1,90 @@ - - - - - - - - - - - - - ./tests - - - - - - - - 0.50 - - - 30 - - - 2 - - - true - - - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - ./app/ - - - ./app/Config - ./app/Views - - + + + + + + + + + + + + + ./tests + + + + + + + + 0.50 + + + 30 + + + 2 + + + true + + + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + ./app/ + + + ./app/Config + ./app/Views + + From 06707af2cefd702a3f3f12bec14f2b4202291f20 Mon Sep 17 00:00:00 2001 From: kenjis Date: Sun, 28 Apr 2024 10:37:06 +0900 Subject: [PATCH 6/6] Update Nexus Tachycardia config --- src/Template/phpunit.xml.dist | 26 +++++--------------------- 1 file changed, 5 insertions(+), 21 deletions(-) diff --git a/src/Template/phpunit.xml.dist b/src/Template/phpunit.xml.dist index db8945f..21a5f6e 100644 --- a/src/Template/phpunit.xml.dist +++ b/src/Template/phpunit.xml.dist @@ -29,27 +29,11 @@ - - - - - 0.50 - - - 30 - - - 2 - - - true - - - true - - - - + + + + +