Skip to content

Commit 80d767a

Browse files
committed
chore: update rector to 2.0.11
1 parent c377646 commit 80d767a

File tree

9 files changed

+45
-32
lines changed

9 files changed

+45
-32
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"phpunit/phpcov": "^9.0.2 || ^10.0",
2929
"phpunit/phpunit": "^10.5.16 || ^11.2",
3030
"predis/predis": "^1.1 || ^2.3",
31-
"rector/rector": "2.0.10",
31+
"rector/rector": "2.0.11",
3232
"shipmonk/phpstan-baseline-per-identifier": "^2.0"
3333
},
3434
"replace": {

rector.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
use Rector\CodeQuality\Rector\FuncCall\ChangeArrayPushToArrayAssignRector;
1919
use Rector\CodeQuality\Rector\FuncCall\CompactToVariablesRector;
2020
use Rector\CodeQuality\Rector\FunctionLike\SimplifyUselessVariableRector;
21-
use Rector\CodeQuality\Rector\Identical\FlipTypeControlToUseExclusiveTypeRector;
2221
use Rector\CodeQuality\Rector\Ternary\TernaryEmptyArrayArrayDimFetchToCoalesceRector;
2322
use Rector\CodingStyle\Rector\ClassMethod\FuncGetArgsToVariadicParamRector;
2423
use Rector\CodingStyle\Rector\ClassMethod\MakeInheritedMethodVisibilitySameAsParentRector;
@@ -37,7 +36,6 @@
3736
use Rector\Php80\Rector\Class_\ClassPropertyAssignToConstructorPromotionRector;
3837
use Rector\Php81\Rector\FuncCall\NullToStrictStringFuncCallArgRector;
3938
use Rector\PHPUnit\CodeQuality\Rector\Class_\YieldDataProviderRector;
40-
use Rector\PHPUnit\CodeQuality\Rector\MethodCall\AssertCountWithZeroToAssertEmptyRector;
4139
use Rector\Privatization\Rector\Property\PrivatizeFinalClassPropertyRector;
4240
use Rector\Strict\Rector\Empty_\DisallowedEmptyRuleFixerRector;
4341
use Rector\Strict\Rector\If_\BooleanInIfConditionRuleFixerRector;
@@ -46,7 +44,6 @@
4644
use Rector\TypeDeclaration\Rector\ClassMethod\ReturnNeverTypeRector;
4745
use Rector\TypeDeclaration\Rector\Closure\AddClosureVoidReturnTypeWhereNoReturnRector;
4846
use Rector\TypeDeclaration\Rector\Closure\ClosureReturnTypeRector;
49-
use Rector\TypeDeclaration\Rector\Empty_\EmptyOnNullableObjectToInstanceOfRector;
5047
use Rector\TypeDeclaration\Rector\Function_\AddFunctionVoidReturnTypeWhereNoReturnRector;
5148
use Rector\TypeDeclaration\Rector\Property\TypedPropertyFromAssignsRector;
5249
use Rector\TypeDeclaration\Rector\StmtsAwareInterface\DeclareStrictTypesRector;
@@ -169,8 +166,6 @@
169166
NullToStrictStringFuncCallArgRector::class,
170167

171168
CompactToVariablesRector::class,
172-
173-
AssertCountWithZeroToAssertEmptyRector::class,
174169
])
175170
// auto import fully qualified class names
176171
->withImportNames(removeUnusedImports: true)
@@ -192,7 +187,6 @@
192187
MakeInheritedMethodVisibilitySameAsParentRector::class,
193188
SimplifyEmptyCheckOnEmptyArrayRector::class,
194189
TernaryEmptyArrayArrayDimFetchToCoalesceRector::class,
195-
EmptyOnNullableObjectToInstanceOfRector::class,
196190
DisallowedEmptyRuleFixerRector::class,
197191
PrivatizeFinalClassPropertyRector::class,
198192
BooleanInIfConditionRuleFixerRector::class,
@@ -202,7 +196,6 @@
202196
AddMethodCallBasedStrictParamTypeRector::class,
203197
TypedPropertyFromAssignsRector::class,
204198
ClosureReturnTypeRector::class,
205-
FlipTypeControlToUseExclusiveTypeRector::class,
206199
AddArrowFunctionReturnTypeRector::class,
207200
])
208201
->withConfiguredRule(StringClassNameToClassConstantRector::class, [

tests/system/CodeIgniterTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
namespace CodeIgniter;
1515

16+
use CodeIgniter\HTTP\ResponseInterface;
1617
use App\Controllers\Home;
1718
use CodeIgniter\Config\Services;
1819
use CodeIgniter\Debug\Timer;
@@ -95,6 +96,7 @@ public function testRunEmptyDefaultRouteReturnResponse(): void
9596
$_SERVER['argc'] = 1;
9697

9798
$response = $this->codeigniter->run(null, true);
99+
$this->assertInstanceof(ResponseInterface::class, $response);
98100

99101
$this->assertStringContainsString('Welcome to CodeIgniter', $response->getBody());
100102
}
@@ -159,6 +161,7 @@ public function testRun404OverrideControllerReturnsResponse(): void
159161
Services::injectMock('router', $router);
160162

161163
$response = $this->codeigniter->run($routes, true);
164+
$this->assertInstanceof(ResponseInterface::class, $response);
162165

163166
$this->assertStringContainsString('Oops', $response->getBody());
164167
$this->assertSame(567, $response->getStatusCode());
@@ -177,6 +180,7 @@ public function testRun404OverrideReturnResponse(): void
177180
Services::injectMock('router', $router);
178181

179182
$response = $this->codeigniter->run($routes, true);
183+
$this->assertInstanceof(ResponseInterface::class, $response);
180184

181185
$this->assertStringContainsString('Oops', $response->getBody());
182186
}
@@ -467,6 +471,7 @@ public function testRunForceSecure(): void
467471
$this->assertNull($response->header('Location'));
468472

469473
$response = $codeigniter->run(null, true);
474+
$this->assertInstanceof(ResponseInterface::class, $response);
470475

471476
$this->assertSame('https://example.com/index.php/', $response->header('Location')->getValue());
472477
}

tests/system/Database/Live/OCI8/LastInsertIDTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
namespace CodeIgniter\Database\Live\OCI8;
1515

16+
use CodeIgniter\Database\BasePreparedQuery;
1617
use CodeIgniter\Database\Query;
1718
use CodeIgniter\Test\CIUnitTestCase;
1819
use CodeIgniter\Test\DatabaseTestTrait;
@@ -83,6 +84,7 @@ public function testGetInsertIDWithPreparedQuery(): void
8384

8485
return (new Query($db))->setQuery($sql);
8586
});
87+
$this->assertInstanceof(BasePreparedQuery::class, $query);
8688

8789
$query->execute('foo', 'bar');
8890
$actual = $this->db->insertID();

tests/system/HTTP/Files/FileCollectionTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,7 @@ public function testErrorString(): void
359359

360360
$collection = new FileCollection();
361361
$file = $collection->getFile('userfile');
362+
$this->assertInstanceof(UploadedFile::class, $file);
362363

363364
$this->assertSame($expected, $file->getErrorString());
364365
}
@@ -379,6 +380,7 @@ public function testErrorStringWithUnknownError(): void
379380

380381
$collection = new FileCollection();
381382
$file = $collection->getFile('userfile');
383+
$this->assertInstanceof(UploadedFile::class, $file);
382384

383385
$this->assertSame($expected, $file->getErrorString());
384386
}
@@ -398,6 +400,7 @@ public function testErrorStringWithNoError(): void
398400

399401
$collection = new FileCollection();
400402
$file = $collection->getFile('userfile');
403+
$this->assertInstanceof(UploadedFile::class, $file);
401404

402405
$this->assertSame($expected, $file->getErrorString());
403406
}
@@ -416,6 +419,7 @@ public function testError(): void
416419

417420
$collection = new FileCollection();
418421
$file = $collection->getFile('userfile');
422+
$this->assertInstanceof(UploadedFile::class, $file);
419423

420424
$this->assertSame(UPLOAD_ERR_INI_SIZE, $file->getError());
421425
}
@@ -433,6 +437,7 @@ public function testErrorWithUnknownError(): void
433437

434438
$collection = new FileCollection();
435439
$file = $collection->getFile('userfile');
440+
$this->assertInstanceof(UploadedFile::class, $file);
436441

437442
$this->assertSame(0, $file->getError());
438443
}
@@ -451,6 +456,7 @@ public function testErrorWithNoError(): void
451456

452457
$collection = new FileCollection();
453458
$file = $collection->getFile('userfile');
459+
$this->assertInstanceof(UploadedFile::class, $file);
454460

455461
$this->assertSame(UPLOAD_ERR_OK, $file->getError());
456462
}
@@ -469,6 +475,7 @@ public function testClientPathReturnsValidFullPath(): void
469475

470476
$collection = new FileCollection();
471477
$file = $collection->getFile('userfile');
478+
$this->assertInstanceof(UploadedFile::class, $file);
472479

473480
$this->assertSame('someDir/someFile.txt', $file->getClientPath());
474481
}
@@ -486,6 +493,7 @@ public function testClientPathReturnsNullWhenFullPathIsNull(): void
486493

487494
$collection = new FileCollection();
488495
$file = $collection->getFile('userfile');
496+
$this->assertInstanceof(UploadedFile::class, $file);
489497

490498
$this->assertNull($file->getClientPath());
491499
}

tests/system/HTTP/Files/FileMovingTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,7 @@ public function testInvalidFile(): void
264264
$this->expectException(HTTPException::class);
265265

266266
$file = $collection->getFile('userfile');
267+
$this->assertInstanceof(UploadedFile::class, $file);
267268
$file->move($destination, $file->getName(), false);
268269
}
269270

@@ -290,6 +291,7 @@ public function testFailedMoveBecauseOfWarning(): void
290291
$this->expectException(HTTPException::class);
291292

292293
$file = $collection->getFile('userfile');
294+
$this->assertInstanceof(UploadedFile::class, $file);
293295
$file->move($destination, $file->getName(), false);
294296
}
295297

@@ -321,6 +323,7 @@ public function testFailedMoveBecauseOfFalseReturned(): void
321323
$this->expectExceptionMessage('move_uploaded_file() returned false');
322324

323325
$file = $collection->getFile('userfile1');
326+
$this->assertInstanceof(UploadedFile::class, $file);
324327
$file->move($destination, $file->getName(), false);
325328
}
326329
}

tests/system/Pager/PagerRendererTest.php

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -643,59 +643,59 @@ public static function providePageStartEnd(): iterable
643643

644644
return [
645645
'first page' => [
646-
'details' => [
646+
[
647647
'uri' => $uri,
648648
'pageCount' => 3,
649649
'total' => 25,
650650
'currentPage' => 1,
651651
'perPage' => 10,
652652
],
653-
'pageStart' => 1,
654-
'pageEnd' => 10,
653+
1,
654+
10,
655655
],
656656
'second page' => [
657-
'details' => [
657+
[
658658
'uri' => $uri,
659659
'pageCount' => 3,
660660
'total' => 25,
661661
'currentPage' => 2,
662662
'perPage' => 10,
663663
],
664-
'pageStart' => 11,
665-
'pageEnd' => 20,
664+
11,
665+
20,
666666
],
667667
'last page' => [
668-
'details' => [
668+
[
669669
'uri' => $uri,
670670
'pageCount' => 3,
671671
'total' => 25,
672672
'currentPage' => 3,
673673
'perPage' => 10,
674674
],
675-
'pageStart' => 21,
676-
'pageEnd' => 25,
675+
21,
676+
25,
677677
],
678678
'current greater last page' => [
679-
'details' => [
679+
[
680680
'uri' => $uri,
681681
'pageCount' => 3,
682682
'total' => 25,
683683
'currentPage' => 5,
684684
'perPage' => 10,
685685
],
686-
'pageStart' => 41,
687-
'pageEnd' => 50,
686+
41,
687+
50,
688688
],
689689
'current equal last page' => [
690-
'details' => [
690+
[
691691
'uri' => $uri,
692692
'pageCount' => 1,
693693
'total' => 10,
694694
'currentPage' => 1,
695695
'perPage' => 10,
696696
],
697-
'pageStart' => 1,
698-
'pageEnd' => 10,
697+
1,
698+
10,
699699
],
700700
];
701701
}

tests/system/Test/ControllerTestTraitTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
namespace CodeIgniter\Test;
1515

16+
use CodeIgniter\HTTP\RequestInterface;
1617
use App\Controllers\Home;
1718
use App\Controllers\NeverHeardOfIt;
1819
use CodeIgniter\Controller;
@@ -161,6 +162,7 @@ public function testRequestPassthrough(): void
161162
->execute('popper');
162163

163164
$req = $result->request();
165+
$this->assertInstanceof(RequestInterface::class, $req);
164166
$this->assertSame('GET', $req->getMethod());
165167
}
166168

tests/system/Throttle/ThrottleTest.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -213,9 +213,9 @@ public static function provideTokenTimeCalculationUCs(): iterable
213213
{
214214
return [
215215
'2 capacity / 200 seconds (100s refresh, 0.01 tokens/s) -> 5 checks, 1 cost each' => [
216-
'capacity' => 2,
217-
'seconds' => 200,
218-
'checkInputs' => [
216+
2,
217+
200,
218+
[
219219
[ // 2 -> 1
220220
'testTime' => 0,
221221
'cost' => 1,
@@ -255,9 +255,9 @@ public static function provideTokenTimeCalculationUCs(): iterable
255255
],
256256
],
257257
'1 capacity / 3600 seconds (3600s refresh, 2.77e-4 tokens/s) -> 2 checks with 1 cost each' => [
258-
'capacity' => 1,
259-
'seconds' => 3600,
260-
'checkInputs' => [
258+
1,
259+
3600,
260+
[
261261
[ // 1 -> 0
262262
'testTime' => 0,
263263
'cost' => 1,
@@ -273,9 +273,9 @@ public static function provideTokenTimeCalculationUCs(): iterable
273273
],
274274
],
275275
'10 capacity / 200 seconds (20s refresh, 0.05 tokens/s) -> 7 checks with different costs (RNG)' => [
276-
'capacity' => 10,
277-
'seconds' => 200,
278-
'checkInputs' => [
276+
10,
277+
200,
278+
[
279279
[ // -2t / 10 -> 8
280280
'testTime' => 0,
281281
'cost' => 2,

0 commit comments

Comments
 (0)