Skip to content

Commit d33327c

Browse files
authored
Merge pull request codeigniter4#9507 from michalsn/rector-update
chore: update rector to 2.0.11
2 parents c377646 + 8b30ca3 commit d33327c

File tree

7 files changed

+23
-7
lines changed

7 files changed

+23
-7
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: 2 additions & 6 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;
@@ -36,8 +35,8 @@
3635
use Rector\Php70\Rector\FuncCall\RandomFunctionRector;
3736
use Rector\Php80\Rector\Class_\ClassPropertyAssignToConstructorPromotionRector;
3837
use Rector\Php81\Rector\FuncCall\NullToStrictStringFuncCallArgRector;
38+
use Rector\PHPUnit\CodeQuality\Rector\Class_\RemoveDataProviderParamKeysRector;
3939
use Rector\PHPUnit\CodeQuality\Rector\Class_\YieldDataProviderRector;
40-
use Rector\PHPUnit\CodeQuality\Rector\MethodCall\AssertCountWithZeroToAssertEmptyRector;
4140
use Rector\Privatization\Rector\Property\PrivatizeFinalClassPropertyRector;
4241
use Rector\Strict\Rector\Empty_\DisallowedEmptyRuleFixerRector;
4342
use Rector\Strict\Rector\If_\BooleanInIfConditionRuleFixerRector;
@@ -46,7 +45,6 @@
4645
use Rector\TypeDeclaration\Rector\ClassMethod\ReturnNeverTypeRector;
4746
use Rector\TypeDeclaration\Rector\Closure\AddClosureVoidReturnTypeWhereNoReturnRector;
4847
use Rector\TypeDeclaration\Rector\Closure\ClosureReturnTypeRector;
49-
use Rector\TypeDeclaration\Rector\Empty_\EmptyOnNullableObjectToInstanceOfRector;
5048
use Rector\TypeDeclaration\Rector\Function_\AddFunctionVoidReturnTypeWhereNoReturnRector;
5149
use Rector\TypeDeclaration\Rector\Property\TypedPropertyFromAssignsRector;
5250
use Rector\TypeDeclaration\Rector\StmtsAwareInterface\DeclareStrictTypesRector;
@@ -170,7 +168,7 @@
170168

171169
CompactToVariablesRector::class,
172170

173-
AssertCountWithZeroToAssertEmptyRector::class,
171+
RemoveDataProviderParamKeysRector::class,
174172
])
175173
// auto import fully qualified class names
176174
->withImportNames(removeUnusedImports: true)
@@ -192,7 +190,6 @@
192190
MakeInheritedMethodVisibilitySameAsParentRector::class,
193191
SimplifyEmptyCheckOnEmptyArrayRector::class,
194192
TernaryEmptyArrayArrayDimFetchToCoalesceRector::class,
195-
EmptyOnNullableObjectToInstanceOfRector::class,
196193
DisallowedEmptyRuleFixerRector::class,
197194
PrivatizeFinalClassPropertyRector::class,
198195
BooleanInIfConditionRuleFixerRector::class,
@@ -202,7 +199,6 @@
202199
AddMethodCallBasedStrictParamTypeRector::class,
203200
TypedPropertyFromAssignsRector::class,
204201
ClosureReturnTypeRector::class,
205-
FlipTypeControlToUseExclusiveTypeRector::class,
206202
AddArrowFunctionReturnTypeRector::class,
207203
])
208204
->withConfiguredRule(StringClassNameToClassConstantRector::class, [

tests/system/CodeIgniterTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
use CodeIgniter\Exceptions\PageNotFoundException;
2020
use CodeIgniter\HTTP\Method;
2121
use CodeIgniter\HTTP\Response;
22+
use CodeIgniter\HTTP\ResponseInterface;
2223
use CodeIgniter\Router\RouteCollection;
2324
use CodeIgniter\Test\CIUnitTestCase;
2425
use CodeIgniter\Test\Filters\CITestStreamFilter;
@@ -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/Test/ControllerTestTraitTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
use CodeIgniter\Controller;
1919
use CodeIgniter\Exceptions\InvalidArgumentException;
2020
use CodeIgniter\Exceptions\RuntimeException;
21+
use CodeIgniter\HTTP\RequestInterface;
2122
use CodeIgniter\Log\Logger;
2223
use CodeIgniter\Test\Mock\MockLogger as LoggerConfig;
2324
use Config\App;
@@ -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

0 commit comments

Comments
 (0)