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
12 changes: 12 additions & 0 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
use Rector\DeadCode\Rector\ClassMethod\RemoveUnusedConstructorParamRector;
use Rector\DeadCode\Rector\ClassMethod\RemoveUnusedPrivateMethodRector;
use Rector\DeadCode\Rector\MethodCall\RemoveNullArgOnNullDefaultParamRector;
use Rector\DeadCode\Rector\Property\RemoveDefaultValueFromAssignedPropertyRector;
use Rector\EarlyReturn\Rector\Foreach_\ChangeNestedForeachIfsToEarlyContinueRector;
use Rector\EarlyReturn\Rector\If_\ChangeIfElseValueAssignToEarlyReturnRector;
use Rector\EarlyReturn\Rector\If_\RemoveAlwaysElseRector;
Expand All @@ -33,6 +34,7 @@
use Rector\Php71\Rector\FuncCall\RemoveExtraParametersRector;
use Rector\Php80\Rector\Class_\ClassPropertyAssignToConstructorPromotionRector;
use Rector\Php81\Rector\FuncCall\NullToStrictStringFuncCallArgRector;
use Rector\Php81\Rector\Property\ReadOnlyPropertyRector;
use Rector\PHPUnit\CodeQuality\Rector\Class_\YieldDataProviderRector;
use Rector\PHPUnit\CodeQuality\Rector\FuncCall\AssertFuncCallToPHPUnitAssertRector;
use Rector\PHPUnit\CodeQuality\Rector\StmtsAwareInterface\DeclareStrictTypesTestsRector;
Expand Down Expand Up @@ -102,6 +104,16 @@
__DIR__ . '/system/HTTP/Response.php',
],

// Keep property defaults for backward compatibility.
RemoveDefaultValueFromAssignedPropertyRector::class,

ReadOnlyPropertyRector::class => [
__DIR__ . '/system/Cache/ResponseCache.php',
__DIR__ . '/system/HotReloader/IteratorFilter.php',
__DIR__ . '/system/Router/RouteCollection.php',
__DIR__ . '/system/Security/Security.php',
],

// Exclude test file because `is_cli()` is mocked and Rector might remove needed parameters.
RemoveExtraParametersRector::class => [
__DIR__ . '/tests/system/Debug/ToolbarTest.php',
Expand Down
1 change: 0 additions & 1 deletion system/Config/Services.php
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,6 @@ public static function image(?string $handler = null, ?Images $config = null, bo
}

$config ??= config(Images::class);
assert($config instanceof Images);

$handler = in_array($handler, [null, '', '0'], true) ? $config->defaultHandler : $handler;
$class = $config->handlers[$handler];
Expand Down
4 changes: 2 additions & 2 deletions system/Router/RouteCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -1335,7 +1335,7 @@ protected function fillRouteParams(string $from, ?array $params = null): string

// Ensure that the param we're inserting matches
// the expected param type.
$pos = strpos($from, $pattern);
$pos = strpos($from, (string) $pattern);
$from = substr_replace($from, $params[$index], $pos, strlen($pattern));
}

Expand Down Expand Up @@ -1397,7 +1397,7 @@ protected function buildReverseRoute(string $from, array $params): string

// Ensure that the param we're inserting matches
// the expected param type.
$pos = strpos($from, $placeholder);
$pos = strpos($from, (string) $placeholder);
$from = substr_replace($from, (string) $params[$index], $pos, strlen($placeholder));
}

Expand Down
1 change: 0 additions & 1 deletion tests/system/AutoReview/FrameworkCodeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ public function testEachTestClassHasCorrectGroupAttributeName(string $class): vo
$unrecognizedGroups = array_diff(
array_map(static function (ReflectionAttribute $attribute): string {
$groupAttribute = $attribute->newInstance();
assert($groupAttribute instanceof Group);

return $groupAttribute->name();
}, $attributes),
Expand Down
22 changes: 0 additions & 22 deletions tests/system/Database/Live/GetNumRowsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,28 +29,6 @@ final class GetNumRowsTest extends CIUnitTestCase
protected $refresh = true;
protected $seed = CITestSeeder::class;

/**
* Added as instructed at https://codeigniter4.github.io/userguide/testing/database.html#the-test-class
* {@inheritDoc}
*
* @see \CodeIgniter\Test\CIDatabaseTestCase::setUp()
*/
protected function setUp(): void
{
parent::setUp();
}

/**
* Added as instructed at https://codeigniter4.github.io/userguide/testing/database.html#the-test-class
* {@inheritDoc}
*
* @see \CodeIgniter\Test\CIDatabaseTestCase::tearDown()
*/
protected function tearDown(): void
{
parent::tearDown();
}

/**
* tests newly added ResultInterface::getNumRows with a live db
*/
Expand Down
5 changes: 0 additions & 5 deletions tests/system/Database/Migrations/MigrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,6 @@ final class MigrationTest extends CIUnitTestCase
{
use DatabaseTestTrait;

protected function setUp(): void
{
parent::setUp();
}

public function testDBGroup(): void
{
$migration = new class () extends Migration {
Expand Down
5 changes: 0 additions & 5 deletions tests/system/Models/GeneralModelTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,6 @@ final class GeneralModelTest extends CIUnitTestCase
*/
private ?object $model = null;

protected function setUp(): void
{
parent::setUp();
}

protected function tearDown(): void
{
parent::tearDown();
Expand Down
5 changes: 0 additions & 5 deletions tests/system/Models/LiveModelTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,6 @@ abstract class LiveModelTestCase extends CIUnitTestCase

protected $seed = CITestSeeder::class;

protected function setUp(): void
{
parent::setUp();
}

protected function tearDown(): void
{
parent::tearDown();
Expand Down
5 changes: 0 additions & 5 deletions tests/system/Test/TestResponseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,6 @@ final class TestResponseTest extends CIUnitTestCase
private ?TestResponse $testResponse = null;
private Response $response;

protected function setUp(): void
{
parent::setUp();
}

#[DataProvider('provideHttpStatusCodes')]
public function testIsOK(int $code, bool $isOk): void
{
Expand Down
2 changes: 1 addition & 1 deletion utils/phpstan-baseline/empty.notAllowed.neon
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# total 212 errors
# total 205 errors

parameters:
ignoreErrors:
Expand Down
3 changes: 1 addition & 2 deletions utils/phpstan-baseline/loader.neon
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# total 1819 errors
# total 1810 errors

includes:
- argument.type.neon
Expand All @@ -16,7 +16,6 @@ includes:
- missingType.parameter.neon
- missingType.property.neon
- nullCoalesce.property.neon
- offsetAccess.notFound.neon
- property.defaultValue.neon
- property.nonObject.neon
- property.notFound.neon
Expand Down
8 changes: 0 additions & 8 deletions utils/phpstan-baseline/offsetAccess.notFound.neon

This file was deleted.

Loading