From 80d767a05f32ea5e88ded1237606cd0aff3d6076 Mon Sep 17 00:00:00 2001 From: michalsn Date: Mon, 7 Apr 2025 10:13:19 +0200 Subject: [PATCH 1/4] chore: update rector to 2.0.11 --- composer.json | 2 +- rector.php | 7 ----- tests/system/CodeIgniterTest.php | 5 ++++ .../Database/Live/OCI8/LastInsertIDTest.php | 2 ++ .../system/HTTP/Files/FileCollectionTest.php | 8 +++++ tests/system/HTTP/Files/FileMovingTest.php | 3 ++ tests/system/Pager/PagerRendererTest.php | 30 +++++++++---------- tests/system/Test/ControllerTestTraitTest.php | 2 ++ tests/system/Throttle/ThrottleTest.php | 18 +++++------ 9 files changed, 45 insertions(+), 32 deletions(-) diff --git a/composer.json b/composer.json index 50371dc14671..902c2bd11065 100644 --- a/composer.json +++ b/composer.json @@ -28,7 +28,7 @@ "phpunit/phpcov": "^9.0.2 || ^10.0", "phpunit/phpunit": "^10.5.16 || ^11.2", "predis/predis": "^1.1 || ^2.3", - "rector/rector": "2.0.10", + "rector/rector": "2.0.11", "shipmonk/phpstan-baseline-per-identifier": "^2.0" }, "replace": { diff --git a/rector.php b/rector.php index 7adec00da4bd..6e9a1ef5def2 100644 --- a/rector.php +++ b/rector.php @@ -18,7 +18,6 @@ use Rector\CodeQuality\Rector\FuncCall\ChangeArrayPushToArrayAssignRector; use Rector\CodeQuality\Rector\FuncCall\CompactToVariablesRector; use Rector\CodeQuality\Rector\FunctionLike\SimplifyUselessVariableRector; -use Rector\CodeQuality\Rector\Identical\FlipTypeControlToUseExclusiveTypeRector; use Rector\CodeQuality\Rector\Ternary\TernaryEmptyArrayArrayDimFetchToCoalesceRector; use Rector\CodingStyle\Rector\ClassMethod\FuncGetArgsToVariadicParamRector; use Rector\CodingStyle\Rector\ClassMethod\MakeInheritedMethodVisibilitySameAsParentRector; @@ -37,7 +36,6 @@ use Rector\Php80\Rector\Class_\ClassPropertyAssignToConstructorPromotionRector; use Rector\Php81\Rector\FuncCall\NullToStrictStringFuncCallArgRector; use Rector\PHPUnit\CodeQuality\Rector\Class_\YieldDataProviderRector; -use Rector\PHPUnit\CodeQuality\Rector\MethodCall\AssertCountWithZeroToAssertEmptyRector; use Rector\Privatization\Rector\Property\PrivatizeFinalClassPropertyRector; use Rector\Strict\Rector\Empty_\DisallowedEmptyRuleFixerRector; use Rector\Strict\Rector\If_\BooleanInIfConditionRuleFixerRector; @@ -46,7 +44,6 @@ use Rector\TypeDeclaration\Rector\ClassMethod\ReturnNeverTypeRector; use Rector\TypeDeclaration\Rector\Closure\AddClosureVoidReturnTypeWhereNoReturnRector; use Rector\TypeDeclaration\Rector\Closure\ClosureReturnTypeRector; -use Rector\TypeDeclaration\Rector\Empty_\EmptyOnNullableObjectToInstanceOfRector; use Rector\TypeDeclaration\Rector\Function_\AddFunctionVoidReturnTypeWhereNoReturnRector; use Rector\TypeDeclaration\Rector\Property\TypedPropertyFromAssignsRector; use Rector\TypeDeclaration\Rector\StmtsAwareInterface\DeclareStrictTypesRector; @@ -169,8 +166,6 @@ NullToStrictStringFuncCallArgRector::class, CompactToVariablesRector::class, - - AssertCountWithZeroToAssertEmptyRector::class, ]) // auto import fully qualified class names ->withImportNames(removeUnusedImports: true) @@ -192,7 +187,6 @@ MakeInheritedMethodVisibilitySameAsParentRector::class, SimplifyEmptyCheckOnEmptyArrayRector::class, TernaryEmptyArrayArrayDimFetchToCoalesceRector::class, - EmptyOnNullableObjectToInstanceOfRector::class, DisallowedEmptyRuleFixerRector::class, PrivatizeFinalClassPropertyRector::class, BooleanInIfConditionRuleFixerRector::class, @@ -202,7 +196,6 @@ AddMethodCallBasedStrictParamTypeRector::class, TypedPropertyFromAssignsRector::class, ClosureReturnTypeRector::class, - FlipTypeControlToUseExclusiveTypeRector::class, AddArrowFunctionReturnTypeRector::class, ]) ->withConfiguredRule(StringClassNameToClassConstantRector::class, [ diff --git a/tests/system/CodeIgniterTest.php b/tests/system/CodeIgniterTest.php index ca7819306e62..ed6ba957f90c 100644 --- a/tests/system/CodeIgniterTest.php +++ b/tests/system/CodeIgniterTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter; +use CodeIgniter\HTTP\ResponseInterface; use App\Controllers\Home; use CodeIgniter\Config\Services; use CodeIgniter\Debug\Timer; @@ -95,6 +96,7 @@ public function testRunEmptyDefaultRouteReturnResponse(): void $_SERVER['argc'] = 1; $response = $this->codeigniter->run(null, true); + $this->assertInstanceof(ResponseInterface::class, $response); $this->assertStringContainsString('Welcome to CodeIgniter', $response->getBody()); } @@ -159,6 +161,7 @@ public function testRun404OverrideControllerReturnsResponse(): void Services::injectMock('router', $router); $response = $this->codeigniter->run($routes, true); + $this->assertInstanceof(ResponseInterface::class, $response); $this->assertStringContainsString('Oops', $response->getBody()); $this->assertSame(567, $response->getStatusCode()); @@ -177,6 +180,7 @@ public function testRun404OverrideReturnResponse(): void Services::injectMock('router', $router); $response = $this->codeigniter->run($routes, true); + $this->assertInstanceof(ResponseInterface::class, $response); $this->assertStringContainsString('Oops', $response->getBody()); } @@ -467,6 +471,7 @@ public function testRunForceSecure(): void $this->assertNull($response->header('Location')); $response = $codeigniter->run(null, true); + $this->assertInstanceof(ResponseInterface::class, $response); $this->assertSame('https://example.com/index.php/', $response->header('Location')->getValue()); } diff --git a/tests/system/Database/Live/OCI8/LastInsertIDTest.php b/tests/system/Database/Live/OCI8/LastInsertIDTest.php index 33945cf7d276..525ab0456408 100644 --- a/tests/system/Database/Live/OCI8/LastInsertIDTest.php +++ b/tests/system/Database/Live/OCI8/LastInsertIDTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Database\Live\OCI8; +use CodeIgniter\Database\BasePreparedQuery; use CodeIgniter\Database\Query; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\DatabaseTestTrait; @@ -83,6 +84,7 @@ public function testGetInsertIDWithPreparedQuery(): void return (new Query($db))->setQuery($sql); }); + $this->assertInstanceof(BasePreparedQuery::class, $query); $query->execute('foo', 'bar'); $actual = $this->db->insertID(); diff --git a/tests/system/HTTP/Files/FileCollectionTest.php b/tests/system/HTTP/Files/FileCollectionTest.php index 7be7fcfe546e..c611edbcbf9e 100644 --- a/tests/system/HTTP/Files/FileCollectionTest.php +++ b/tests/system/HTTP/Files/FileCollectionTest.php @@ -359,6 +359,7 @@ public function testErrorString(): void $collection = new FileCollection(); $file = $collection->getFile('userfile'); + $this->assertInstanceof(UploadedFile::class, $file); $this->assertSame($expected, $file->getErrorString()); } @@ -379,6 +380,7 @@ public function testErrorStringWithUnknownError(): void $collection = new FileCollection(); $file = $collection->getFile('userfile'); + $this->assertInstanceof(UploadedFile::class, $file); $this->assertSame($expected, $file->getErrorString()); } @@ -398,6 +400,7 @@ public function testErrorStringWithNoError(): void $collection = new FileCollection(); $file = $collection->getFile('userfile'); + $this->assertInstanceof(UploadedFile::class, $file); $this->assertSame($expected, $file->getErrorString()); } @@ -416,6 +419,7 @@ public function testError(): void $collection = new FileCollection(); $file = $collection->getFile('userfile'); + $this->assertInstanceof(UploadedFile::class, $file); $this->assertSame(UPLOAD_ERR_INI_SIZE, $file->getError()); } @@ -433,6 +437,7 @@ public function testErrorWithUnknownError(): void $collection = new FileCollection(); $file = $collection->getFile('userfile'); + $this->assertInstanceof(UploadedFile::class, $file); $this->assertSame(0, $file->getError()); } @@ -451,6 +456,7 @@ public function testErrorWithNoError(): void $collection = new FileCollection(); $file = $collection->getFile('userfile'); + $this->assertInstanceof(UploadedFile::class, $file); $this->assertSame(UPLOAD_ERR_OK, $file->getError()); } @@ -469,6 +475,7 @@ public function testClientPathReturnsValidFullPath(): void $collection = new FileCollection(); $file = $collection->getFile('userfile'); + $this->assertInstanceof(UploadedFile::class, $file); $this->assertSame('someDir/someFile.txt', $file->getClientPath()); } @@ -486,6 +493,7 @@ public function testClientPathReturnsNullWhenFullPathIsNull(): void $collection = new FileCollection(); $file = $collection->getFile('userfile'); + $this->assertInstanceof(UploadedFile::class, $file); $this->assertNull($file->getClientPath()); } diff --git a/tests/system/HTTP/Files/FileMovingTest.php b/tests/system/HTTP/Files/FileMovingTest.php index 9624ecd78a06..05a5096fba2a 100644 --- a/tests/system/HTTP/Files/FileMovingTest.php +++ b/tests/system/HTTP/Files/FileMovingTest.php @@ -264,6 +264,7 @@ public function testInvalidFile(): void $this->expectException(HTTPException::class); $file = $collection->getFile('userfile'); + $this->assertInstanceof(UploadedFile::class, $file); $file->move($destination, $file->getName(), false); } @@ -290,6 +291,7 @@ public function testFailedMoveBecauseOfWarning(): void $this->expectException(HTTPException::class); $file = $collection->getFile('userfile'); + $this->assertInstanceof(UploadedFile::class, $file); $file->move($destination, $file->getName(), false); } @@ -321,6 +323,7 @@ public function testFailedMoveBecauseOfFalseReturned(): void $this->expectExceptionMessage('move_uploaded_file() returned false'); $file = $collection->getFile('userfile1'); + $this->assertInstanceof(UploadedFile::class, $file); $file->move($destination, $file->getName(), false); } } diff --git a/tests/system/Pager/PagerRendererTest.php b/tests/system/Pager/PagerRendererTest.php index d06a040a7925..d29539c3ed67 100644 --- a/tests/system/Pager/PagerRendererTest.php +++ b/tests/system/Pager/PagerRendererTest.php @@ -643,59 +643,59 @@ public static function providePageStartEnd(): iterable return [ 'first page' => [ - 'details' => [ + [ 'uri' => $uri, 'pageCount' => 3, 'total' => 25, 'currentPage' => 1, 'perPage' => 10, ], - 'pageStart' => 1, - 'pageEnd' => 10, + 1, + 10, ], 'second page' => [ - 'details' => [ + [ 'uri' => $uri, 'pageCount' => 3, 'total' => 25, 'currentPage' => 2, 'perPage' => 10, ], - 'pageStart' => 11, - 'pageEnd' => 20, + 11, + 20, ], 'last page' => [ - 'details' => [ + [ 'uri' => $uri, 'pageCount' => 3, 'total' => 25, 'currentPage' => 3, 'perPage' => 10, ], - 'pageStart' => 21, - 'pageEnd' => 25, + 21, + 25, ], 'current greater last page' => [ - 'details' => [ + [ 'uri' => $uri, 'pageCount' => 3, 'total' => 25, 'currentPage' => 5, 'perPage' => 10, ], - 'pageStart' => 41, - 'pageEnd' => 50, + 41, + 50, ], 'current equal last page' => [ - 'details' => [ + [ 'uri' => $uri, 'pageCount' => 1, 'total' => 10, 'currentPage' => 1, 'perPage' => 10, ], - 'pageStart' => 1, - 'pageEnd' => 10, + 1, + 10, ], ]; } diff --git a/tests/system/Test/ControllerTestTraitTest.php b/tests/system/Test/ControllerTestTraitTest.php index aa130ba85cab..4e81e35925ad 100644 --- a/tests/system/Test/ControllerTestTraitTest.php +++ b/tests/system/Test/ControllerTestTraitTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Test; +use CodeIgniter\HTTP\RequestInterface; use App\Controllers\Home; use App\Controllers\NeverHeardOfIt; use CodeIgniter\Controller; @@ -161,6 +162,7 @@ public function testRequestPassthrough(): void ->execute('popper'); $req = $result->request(); + $this->assertInstanceof(RequestInterface::class, $req); $this->assertSame('GET', $req->getMethod()); } diff --git a/tests/system/Throttle/ThrottleTest.php b/tests/system/Throttle/ThrottleTest.php index 655cc21dfcfa..a5a71631c594 100644 --- a/tests/system/Throttle/ThrottleTest.php +++ b/tests/system/Throttle/ThrottleTest.php @@ -213,9 +213,9 @@ public static function provideTokenTimeCalculationUCs(): iterable { return [ '2 capacity / 200 seconds (100s refresh, 0.01 tokens/s) -> 5 checks, 1 cost each' => [ - 'capacity' => 2, - 'seconds' => 200, - 'checkInputs' => [ + 2, + 200, + [ [ // 2 -> 1 'testTime' => 0, 'cost' => 1, @@ -255,9 +255,9 @@ public static function provideTokenTimeCalculationUCs(): iterable ], ], '1 capacity / 3600 seconds (3600s refresh, 2.77e-4 tokens/s) -> 2 checks with 1 cost each' => [ - 'capacity' => 1, - 'seconds' => 3600, - 'checkInputs' => [ + 1, + 3600, + [ [ // 1 -> 0 'testTime' => 0, 'cost' => 1, @@ -273,9 +273,9 @@ public static function provideTokenTimeCalculationUCs(): iterable ], ], '10 capacity / 200 seconds (20s refresh, 0.05 tokens/s) -> 7 checks with different costs (RNG)' => [ - 'capacity' => 10, - 'seconds' => 200, - 'checkInputs' => [ + 10, + 200, + [ [ // -2t / 10 -> 8 'testTime' => 0, 'cost' => 2, From 9cc2a5e93749b48c47a14dc27dcbbaa956e82f27 Mon Sep 17 00:00:00 2001 From: michalsn Date: Mon, 7 Apr 2025 10:16:00 +0200 Subject: [PATCH 2/4] cs-fix --- tests/system/CodeIgniterTest.php | 2 +- tests/system/Test/ControllerTestTraitTest.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/system/CodeIgniterTest.php b/tests/system/CodeIgniterTest.php index ed6ba957f90c..a240726132c8 100644 --- a/tests/system/CodeIgniterTest.php +++ b/tests/system/CodeIgniterTest.php @@ -13,13 +13,13 @@ namespace CodeIgniter; -use CodeIgniter\HTTP\ResponseInterface; use App\Controllers\Home; use CodeIgniter\Config\Services; use CodeIgniter\Debug\Timer; use CodeIgniter\Exceptions\PageNotFoundException; use CodeIgniter\HTTP\Method; use CodeIgniter\HTTP\Response; +use CodeIgniter\HTTP\ResponseInterface; use CodeIgniter\Router\RouteCollection; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\Filters\CITestStreamFilter; diff --git a/tests/system/Test/ControllerTestTraitTest.php b/tests/system/Test/ControllerTestTraitTest.php index 4e81e35925ad..671b477bd001 100644 --- a/tests/system/Test/ControllerTestTraitTest.php +++ b/tests/system/Test/ControllerTestTraitTest.php @@ -13,12 +13,12 @@ namespace CodeIgniter\Test; -use CodeIgniter\HTTP\RequestInterface; use App\Controllers\Home; use App\Controllers\NeverHeardOfIt; use CodeIgniter\Controller; use CodeIgniter\Exceptions\InvalidArgumentException; use CodeIgniter\Exceptions\RuntimeException; +use CodeIgniter\HTTP\RequestInterface; use CodeIgniter\Log\Logger; use CodeIgniter\Test\Mock\MockLogger as LoggerConfig; use Config\App; From 896bc2b7ad39a7f15c07b9d2744cb5e6e4758009 Mon Sep 17 00:00:00 2001 From: michalsn Date: Mon, 7 Apr 2025 10:27:21 +0200 Subject: [PATCH 3/4] fix phpstan --- tests/system/CodeIgniterTest.php | 8 ++++---- .../Database/Live/OCI8/LastInsertIDTest.php | 2 +- tests/system/HTTP/Files/FileCollectionTest.php | 16 ++++++++-------- tests/system/HTTP/Files/FileMovingTest.php | 6 +++--- tests/system/Pager/PagerRendererTest.php | 2 +- tests/system/Test/ControllerTestTraitTest.php | 2 +- 6 files changed, 18 insertions(+), 18 deletions(-) diff --git a/tests/system/CodeIgniterTest.php b/tests/system/CodeIgniterTest.php index a240726132c8..df2f217eb68a 100644 --- a/tests/system/CodeIgniterTest.php +++ b/tests/system/CodeIgniterTest.php @@ -96,7 +96,7 @@ public function testRunEmptyDefaultRouteReturnResponse(): void $_SERVER['argc'] = 1; $response = $this->codeigniter->run(null, true); - $this->assertInstanceof(ResponseInterface::class, $response); + $this->assertInstanceOf(ResponseInterface::class, $response); $this->assertStringContainsString('Welcome to CodeIgniter', $response->getBody()); } @@ -161,7 +161,7 @@ public function testRun404OverrideControllerReturnsResponse(): void Services::injectMock('router', $router); $response = $this->codeigniter->run($routes, true); - $this->assertInstanceof(ResponseInterface::class, $response); + $this->assertInstanceOf(ResponseInterface::class, $response); $this->assertStringContainsString('Oops', $response->getBody()); $this->assertSame(567, $response->getStatusCode()); @@ -180,7 +180,7 @@ public function testRun404OverrideReturnResponse(): void Services::injectMock('router', $router); $response = $this->codeigniter->run($routes, true); - $this->assertInstanceof(ResponseInterface::class, $response); + $this->assertInstanceOf(ResponseInterface::class, $response); $this->assertStringContainsString('Oops', $response->getBody()); } @@ -471,7 +471,7 @@ public function testRunForceSecure(): void $this->assertNull($response->header('Location')); $response = $codeigniter->run(null, true); - $this->assertInstanceof(ResponseInterface::class, $response); + $this->assertInstanceOf(ResponseInterface::class, $response); $this->assertSame('https://example.com/index.php/', $response->header('Location')->getValue()); } diff --git a/tests/system/Database/Live/OCI8/LastInsertIDTest.php b/tests/system/Database/Live/OCI8/LastInsertIDTest.php index 525ab0456408..716cef2ff09d 100644 --- a/tests/system/Database/Live/OCI8/LastInsertIDTest.php +++ b/tests/system/Database/Live/OCI8/LastInsertIDTest.php @@ -84,7 +84,7 @@ public function testGetInsertIDWithPreparedQuery(): void return (new Query($db))->setQuery($sql); }); - $this->assertInstanceof(BasePreparedQuery::class, $query); + $this->assertInstanceOf(BasePreparedQuery::class, $query); $query->execute('foo', 'bar'); $actual = $this->db->insertID(); diff --git a/tests/system/HTTP/Files/FileCollectionTest.php b/tests/system/HTTP/Files/FileCollectionTest.php index c611edbcbf9e..daebf98fc314 100644 --- a/tests/system/HTTP/Files/FileCollectionTest.php +++ b/tests/system/HTTP/Files/FileCollectionTest.php @@ -359,7 +359,7 @@ public function testErrorString(): void $collection = new FileCollection(); $file = $collection->getFile('userfile'); - $this->assertInstanceof(UploadedFile::class, $file); + $this->assertInstanceOf(UploadedFile::class, $file); $this->assertSame($expected, $file->getErrorString()); } @@ -380,7 +380,7 @@ public function testErrorStringWithUnknownError(): void $collection = new FileCollection(); $file = $collection->getFile('userfile'); - $this->assertInstanceof(UploadedFile::class, $file); + $this->assertInstanceOf(UploadedFile::class, $file); $this->assertSame($expected, $file->getErrorString()); } @@ -400,7 +400,7 @@ public function testErrorStringWithNoError(): void $collection = new FileCollection(); $file = $collection->getFile('userfile'); - $this->assertInstanceof(UploadedFile::class, $file); + $this->assertInstanceOf(UploadedFile::class, $file); $this->assertSame($expected, $file->getErrorString()); } @@ -419,7 +419,7 @@ public function testError(): void $collection = new FileCollection(); $file = $collection->getFile('userfile'); - $this->assertInstanceof(UploadedFile::class, $file); + $this->assertInstanceOf(UploadedFile::class, $file); $this->assertSame(UPLOAD_ERR_INI_SIZE, $file->getError()); } @@ -437,7 +437,7 @@ public function testErrorWithUnknownError(): void $collection = new FileCollection(); $file = $collection->getFile('userfile'); - $this->assertInstanceof(UploadedFile::class, $file); + $this->assertInstanceOf(UploadedFile::class, $file); $this->assertSame(0, $file->getError()); } @@ -456,7 +456,7 @@ public function testErrorWithNoError(): void $collection = new FileCollection(); $file = $collection->getFile('userfile'); - $this->assertInstanceof(UploadedFile::class, $file); + $this->assertInstanceOf(UploadedFile::class, $file); $this->assertSame(UPLOAD_ERR_OK, $file->getError()); } @@ -475,7 +475,7 @@ public function testClientPathReturnsValidFullPath(): void $collection = new FileCollection(); $file = $collection->getFile('userfile'); - $this->assertInstanceof(UploadedFile::class, $file); + $this->assertInstanceOf(UploadedFile::class, $file); $this->assertSame('someDir/someFile.txt', $file->getClientPath()); } @@ -493,7 +493,7 @@ public function testClientPathReturnsNullWhenFullPathIsNull(): void $collection = new FileCollection(); $file = $collection->getFile('userfile'); - $this->assertInstanceof(UploadedFile::class, $file); + $this->assertInstanceOf(UploadedFile::class, $file); $this->assertNull($file->getClientPath()); } diff --git a/tests/system/HTTP/Files/FileMovingTest.php b/tests/system/HTTP/Files/FileMovingTest.php index 05a5096fba2a..2d43c775f949 100644 --- a/tests/system/HTTP/Files/FileMovingTest.php +++ b/tests/system/HTTP/Files/FileMovingTest.php @@ -264,7 +264,7 @@ public function testInvalidFile(): void $this->expectException(HTTPException::class); $file = $collection->getFile('userfile'); - $this->assertInstanceof(UploadedFile::class, $file); + $this->assertInstanceOf(UploadedFile::class, $file); $file->move($destination, $file->getName(), false); } @@ -291,7 +291,7 @@ public function testFailedMoveBecauseOfWarning(): void $this->expectException(HTTPException::class); $file = $collection->getFile('userfile'); - $this->assertInstanceof(UploadedFile::class, $file); + $this->assertInstanceOf(UploadedFile::class, $file); $file->move($destination, $file->getName(), false); } @@ -323,7 +323,7 @@ public function testFailedMoveBecauseOfFalseReturned(): void $this->expectExceptionMessage('move_uploaded_file() returned false'); $file = $collection->getFile('userfile1'); - $this->assertInstanceof(UploadedFile::class, $file); + $this->assertInstanceOf(UploadedFile::class, $file); $file->move($destination, $file->getName(), false); } } diff --git a/tests/system/Pager/PagerRendererTest.php b/tests/system/Pager/PagerRendererTest.php index d29539c3ed67..7d9d94e49303 100644 --- a/tests/system/Pager/PagerRendererTest.php +++ b/tests/system/Pager/PagerRendererTest.php @@ -635,7 +635,7 @@ public function testPageStartEnd(array $details, int $pageStart, int $pageEnd): } /** - * @return array> $details + * @return array|int>> $details */ public static function providePageStartEnd(): iterable { diff --git a/tests/system/Test/ControllerTestTraitTest.php b/tests/system/Test/ControllerTestTraitTest.php index 671b477bd001..44301afa376d 100644 --- a/tests/system/Test/ControllerTestTraitTest.php +++ b/tests/system/Test/ControllerTestTraitTest.php @@ -162,7 +162,7 @@ public function testRequestPassthrough(): void ->execute('popper'); $req = $result->request(); - $this->assertInstanceof(RequestInterface::class, $req); + $this->assertInstanceOf(RequestInterface::class, $req); $this->assertSame('GET', $req->getMethod()); } From 8b30ca32a2665b429ebba95526e010c3daa057ce Mon Sep 17 00:00:00 2001 From: michalsn Date: Mon, 7 Apr 2025 10:56:25 +0200 Subject: [PATCH 4/4] skip rector rule RemoveDataProviderParamKeysRector --- rector.php | 3 +++ tests/system/Pager/PagerRendererTest.php | 32 ++++++++++++------------ tests/system/Throttle/ThrottleTest.php | 18 ++++++------- 3 files changed, 28 insertions(+), 25 deletions(-) diff --git a/rector.php b/rector.php index 6e9a1ef5def2..b8b5e1ccc73f 100644 --- a/rector.php +++ b/rector.php @@ -35,6 +35,7 @@ use Rector\Php70\Rector\FuncCall\RandomFunctionRector; use Rector\Php80\Rector\Class_\ClassPropertyAssignToConstructorPromotionRector; use Rector\Php81\Rector\FuncCall\NullToStrictStringFuncCallArgRector; +use Rector\PHPUnit\CodeQuality\Rector\Class_\RemoveDataProviderParamKeysRector; use Rector\PHPUnit\CodeQuality\Rector\Class_\YieldDataProviderRector; use Rector\Privatization\Rector\Property\PrivatizeFinalClassPropertyRector; use Rector\Strict\Rector\Empty_\DisallowedEmptyRuleFixerRector; @@ -166,6 +167,8 @@ NullToStrictStringFuncCallArgRector::class, CompactToVariablesRector::class, + + RemoveDataProviderParamKeysRector::class, ]) // auto import fully qualified class names ->withImportNames(removeUnusedImports: true) diff --git a/tests/system/Pager/PagerRendererTest.php b/tests/system/Pager/PagerRendererTest.php index 7d9d94e49303..d06a040a7925 100644 --- a/tests/system/Pager/PagerRendererTest.php +++ b/tests/system/Pager/PagerRendererTest.php @@ -635,7 +635,7 @@ public function testPageStartEnd(array $details, int $pageStart, int $pageEnd): } /** - * @return array|int>> $details + * @return array> $details */ public static function providePageStartEnd(): iterable { @@ -643,59 +643,59 @@ public static function providePageStartEnd(): iterable return [ 'first page' => [ - [ + 'details' => [ 'uri' => $uri, 'pageCount' => 3, 'total' => 25, 'currentPage' => 1, 'perPage' => 10, ], - 1, - 10, + 'pageStart' => 1, + 'pageEnd' => 10, ], 'second page' => [ - [ + 'details' => [ 'uri' => $uri, 'pageCount' => 3, 'total' => 25, 'currentPage' => 2, 'perPage' => 10, ], - 11, - 20, + 'pageStart' => 11, + 'pageEnd' => 20, ], 'last page' => [ - [ + 'details' => [ 'uri' => $uri, 'pageCount' => 3, 'total' => 25, 'currentPage' => 3, 'perPage' => 10, ], - 21, - 25, + 'pageStart' => 21, + 'pageEnd' => 25, ], 'current greater last page' => [ - [ + 'details' => [ 'uri' => $uri, 'pageCount' => 3, 'total' => 25, 'currentPage' => 5, 'perPage' => 10, ], - 41, - 50, + 'pageStart' => 41, + 'pageEnd' => 50, ], 'current equal last page' => [ - [ + 'details' => [ 'uri' => $uri, 'pageCount' => 1, 'total' => 10, 'currentPage' => 1, 'perPage' => 10, ], - 1, - 10, + 'pageStart' => 1, + 'pageEnd' => 10, ], ]; } diff --git a/tests/system/Throttle/ThrottleTest.php b/tests/system/Throttle/ThrottleTest.php index a5a71631c594..655cc21dfcfa 100644 --- a/tests/system/Throttle/ThrottleTest.php +++ b/tests/system/Throttle/ThrottleTest.php @@ -213,9 +213,9 @@ public static function provideTokenTimeCalculationUCs(): iterable { return [ '2 capacity / 200 seconds (100s refresh, 0.01 tokens/s) -> 5 checks, 1 cost each' => [ - 2, - 200, - [ + 'capacity' => 2, + 'seconds' => 200, + 'checkInputs' => [ [ // 2 -> 1 'testTime' => 0, 'cost' => 1, @@ -255,9 +255,9 @@ public static function provideTokenTimeCalculationUCs(): iterable ], ], '1 capacity / 3600 seconds (3600s refresh, 2.77e-4 tokens/s) -> 2 checks with 1 cost each' => [ - 1, - 3600, - [ + 'capacity' => 1, + 'seconds' => 3600, + 'checkInputs' => [ [ // 1 -> 0 'testTime' => 0, 'cost' => 1, @@ -273,9 +273,9 @@ public static function provideTokenTimeCalculationUCs(): iterable ], ], '10 capacity / 200 seconds (20s refresh, 0.05 tokens/s) -> 7 checks with different costs (RNG)' => [ - 10, - 200, - [ + 'capacity' => 10, + 'seconds' => 200, + 'checkInputs' => [ [ // -2t / 10 -> 8 'testTime' => 0, 'cost' => 2,