Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
8 changes: 2 additions & 6 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -36,8 +35,8 @@
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\PHPUnit\CodeQuality\Rector\MethodCall\AssertCountWithZeroToAssertEmptyRector;
use Rector\Privatization\Rector\Property\PrivatizeFinalClassPropertyRector;
use Rector\Strict\Rector\Empty_\DisallowedEmptyRuleFixerRector;
use Rector\Strict\Rector\If_\BooleanInIfConditionRuleFixerRector;
Expand All @@ -46,7 +45,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;
Expand Down Expand Up @@ -170,7 +168,7 @@

CompactToVariablesRector::class,

AssertCountWithZeroToAssertEmptyRector::class,
RemoveDataProviderParamKeysRector::class,
])
// auto import fully qualified class names
->withImportNames(removeUnusedImports: true)
Expand All @@ -192,7 +190,6 @@
MakeInheritedMethodVisibilitySameAsParentRector::class,
SimplifyEmptyCheckOnEmptyArrayRector::class,
TernaryEmptyArrayArrayDimFetchToCoalesceRector::class,
EmptyOnNullableObjectToInstanceOfRector::class,
DisallowedEmptyRuleFixerRector::class,
PrivatizeFinalClassPropertyRector::class,
BooleanInIfConditionRuleFixerRector::class,
Expand All @@ -202,7 +199,6 @@
AddMethodCallBasedStrictParamTypeRector::class,
TypedPropertyFromAssignsRector::class,
ClosureReturnTypeRector::class,
FlipTypeControlToUseExclusiveTypeRector::class,
AddArrowFunctionReturnTypeRector::class,
])
->withConfiguredRule(StringClassNameToClassConstantRector::class, [
Expand Down
5 changes: 5 additions & 0 deletions tests/system/CodeIgniterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
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;
Expand Down Expand Up @@ -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());
}
Expand Down Expand Up @@ -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());
Expand All @@ -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());
}
Expand Down Expand Up @@ -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());
}
Expand Down
2 changes: 2 additions & 0 deletions tests/system/Database/Live/OCI8/LastInsertIDTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand Down
8 changes: 8 additions & 0 deletions tests/system/HTTP/Files/FileCollectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
Expand All @@ -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());
}
Expand All @@ -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());
}
Expand All @@ -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());
}
Expand All @@ -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());
}
Expand All @@ -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());
}
Expand All @@ -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());
}
Expand All @@ -486,6 +493,7 @@ public function testClientPathReturnsNullWhenFullPathIsNull(): void

$collection = new FileCollection();
$file = $collection->getFile('userfile');
$this->assertInstanceOf(UploadedFile::class, $file);

$this->assertNull($file->getClientPath());
}
Expand Down
3 changes: 3 additions & 0 deletions tests/system/HTTP/Files/FileMovingTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand All @@ -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);
}

Expand Down Expand Up @@ -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);
}
}
Expand Down
2 changes: 2 additions & 0 deletions tests/system/Test/ControllerTestTraitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
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;
Expand Down Expand Up @@ -161,6 +162,7 @@ public function testRequestPassthrough(): void
->execute('popper');

$req = $result->request();
$this->assertInstanceOf(RequestInterface::class, $req);
$this->assertSame('GET', $req->getMethod());
}

Expand Down
Loading