From 260c379681afc42145f5c4e1b8ca538abe106fe8 Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Mon, 10 Jun 2024 06:20:59 +0700 Subject: [PATCH 1/2] chore: Clean up Rector skip config on SimplifyRegexPatternRector and RemoveUnusedPromotedPropertyRector --- rector.php | 8 -------- tests/system/Database/Live/OCI8/GetFieldDataTestCase.php | 2 +- tests/system/Database/RawSqlTest.php | 2 +- 3 files changed, 2 insertions(+), 10 deletions(-) diff --git a/rector.php b/rector.php index 596eb7a3da65..752cd84b195b 100644 --- a/rector.php +++ b/rector.php @@ -36,7 +36,6 @@ use Rector\Config\RectorConfig; use Rector\DeadCode\Rector\ClassMethod\RemoveUnusedConstructorParamRector; use Rector\DeadCode\Rector\ClassMethod\RemoveUnusedPrivateMethodRector; -use Rector\DeadCode\Rector\ClassMethod\RemoveUnusedPromotedPropertyRector; use Rector\DeadCode\Rector\If_\UnwrapFutureCompatibleIfPhpVersionRector; use Rector\EarlyReturn\Rector\Foreach_\ChangeNestedForeachIfsToEarlyContinueRector; use Rector\EarlyReturn\Rector\If_\ChangeIfElseValueAssignToEarlyReturnRector; @@ -107,11 +106,6 @@ YieldDataProviderRector::class, - RemoveUnusedPromotedPropertyRector::class => [ - // Bug in rector 1.0.0. See https://github.com/rectorphp/rector-src/pull/5573 - __DIR__ . '/tests/_support/Entity/CustomUser.php', - ], - RemoveUnusedPrivateMethodRector::class => [ // private method called via getPrivateMethodInvoker __DIR__ . '/tests/system/Test/ReflectionHelperTest.php', @@ -155,8 +149,6 @@ // use mt_rand instead of random_int on purpose on non-cryptographically random RandomFunctionRector::class, - SimplifyRegexPatternRector::class, - // PHP 8.0 features but cause breaking changes ClassPropertyAssignToConstructorPromotionRector::class => [ __DIR__ . '/system/Database/BaseResult.php', diff --git a/tests/system/Database/Live/OCI8/GetFieldDataTestCase.php b/tests/system/Database/Live/OCI8/GetFieldDataTestCase.php index a45c893dc3f9..2ff1f103fb33 100644 --- a/tests/system/Database/Live/OCI8/GetFieldDataTestCase.php +++ b/tests/system/Database/Live/OCI8/GetFieldDataTestCase.php @@ -58,7 +58,7 @@ public function testGetFieldDataDefault(): void $fields = $this->db->getFieldData($this->table); $idDefault = $this->getFieldMetaData('id', $this->table)->default; - $this->assertMatchesRegularExpression('/"ORACLE"."ISEQ\$\$_[0-9]+".nextval/', $idDefault); + $this->assertMatchesRegularExpression('/"ORACLE"."ISEQ\$\$_\d+".nextval/', $idDefault); $expected = [ (object) [ diff --git a/tests/system/Database/RawSqlTest.php b/tests/system/Database/RawSqlTest.php index 340e85c0ffba..fe26130cd0ee 100644 --- a/tests/system/Database/RawSqlTest.php +++ b/tests/system/Database/RawSqlTest.php @@ -49,6 +49,6 @@ public function testGetBindingKey(): void $key = $rawSql->getBindingKey(); - $this->assertMatchesRegularExpression('/\ARawSql[0-9]+\z/', $key); + $this->assertMatchesRegularExpression('/\ARawSql\d+\z/', $key); } } From 48f36ef37a2d915e6e007c7a089266b863b30921 Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Mon, 10 Jun 2024 09:17:56 +0700 Subject: [PATCH 2/2] remove SimplifyRegexPatternRector from rule() --- rector.php | 2 -- tests/system/Database/Live/OCI8/GetFieldDataTestCase.php | 2 +- tests/system/Database/RawSqlTest.php | 2 +- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/rector.php b/rector.php index 752cd84b195b..1a12e38f3223 100644 --- a/rector.php +++ b/rector.php @@ -18,7 +18,6 @@ use Rector\CodeQuality\Rector\Expression\InlineIfToExplicitIfRector; use Rector\CodeQuality\Rector\Foreach_\UnusedForeachValueToArrayKeysRector; 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; @@ -213,7 +212,6 @@ $rectorConfig->rule(ChangeArrayPushToArrayAssignRector::class); $rectorConfig->rule(UnnecessaryTernaryExpressionRector::class); $rectorConfig->rule(RemoveErrorSuppressInTryCatchStmtsRector::class); - $rectorConfig->rule(SimplifyRegexPatternRector::class); $rectorConfig->rule(FuncGetArgsToVariadicParamRector::class); $rectorConfig->rule(MakeInheritedMethodVisibilitySameAsParentRector::class); $rectorConfig->rule(SimplifyEmptyArrayCheckRector::class); diff --git a/tests/system/Database/Live/OCI8/GetFieldDataTestCase.php b/tests/system/Database/Live/OCI8/GetFieldDataTestCase.php index 2ff1f103fb33..a45c893dc3f9 100644 --- a/tests/system/Database/Live/OCI8/GetFieldDataTestCase.php +++ b/tests/system/Database/Live/OCI8/GetFieldDataTestCase.php @@ -58,7 +58,7 @@ public function testGetFieldDataDefault(): void $fields = $this->db->getFieldData($this->table); $idDefault = $this->getFieldMetaData('id', $this->table)->default; - $this->assertMatchesRegularExpression('/"ORACLE"."ISEQ\$\$_\d+".nextval/', $idDefault); + $this->assertMatchesRegularExpression('/"ORACLE"."ISEQ\$\$_[0-9]+".nextval/', $idDefault); $expected = [ (object) [ diff --git a/tests/system/Database/RawSqlTest.php b/tests/system/Database/RawSqlTest.php index fe26130cd0ee..340e85c0ffba 100644 --- a/tests/system/Database/RawSqlTest.php +++ b/tests/system/Database/RawSqlTest.php @@ -49,6 +49,6 @@ public function testGetBindingKey(): void $key = $rawSql->getBindingKey(); - $this->assertMatchesRegularExpression('/\ARawSql\d+\z/', $key); + $this->assertMatchesRegularExpression('/\ARawSql[0-9]+\z/', $key); } }