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
42 changes: 4 additions & 38 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,17 @@
use Rector\CodingStyle\Rector\FuncCall\CountArrayToEmptyArrayComparisonRector;
use Rector\CodingStyle\Rector\FuncCall\VersionCompareFuncCallToConstantRector;
use Rector\Config\RectorConfig;
use Rector\DeadCode\Rector\ClassMethod\RemoveUnusedConstructorParamRector;
use Rector\DeadCode\Rector\ClassMethod\RemoveUnusedPrivateMethodRector;
use Rector\DeadCode\Rector\If_\UnwrapFutureCompatibleIfPhpVersionRector;
use Rector\DeadCode\Rector\MethodCall\RemoveNullArgOnNullDefaultParamRector;
use Rector\EarlyReturn\Rector\Foreach_\ChangeNestedForeachIfsToEarlyContinueRector;
use Rector\EarlyReturn\Rector\If_\ChangeIfElseValueAssignToEarlyReturnRector;
use Rector\EarlyReturn\Rector\If_\RemoveAlwaysElseRector;
use Rector\EarlyReturn\Rector\Return_\PreparedValueToEarlyReturnRector;
use Rector\Php70\Rector\FuncCall\RandomFunctionRector;
use Rector\Php70\Rector\StaticCall\StaticCallOnNonStaticToInstanceCallRector;
use Rector\Php71\Rector\FuncCall\RemoveExtraParametersRector;
use Rector\Php80\Rector\Class_\ClassPropertyAssignToConstructorPromotionRector;
use Rector\Php81\Rector\FuncCall\NullToStrictStringFuncCallArgRector;
use Rector\PHPUnit\CodeQuality\Rector\Class_\YieldDataProviderRector;
use Rector\PHPUnit\CodeQuality\Rector\FuncCall\AssertFuncCallToPHPUnitAssertRector;
use Rector\PHPUnit\CodeQuality\Rector\StmtsAwareInterface\DeclareStrictTypesTestsRector;
use Rector\Privatization\Rector\Class_\FinalizeTestCaseClassRector;
use Rector\Privatization\Rector\Property\PrivatizeFinalClassPropertyRector;
Expand Down Expand Up @@ -99,26 +95,11 @@
__DIR__ . '/tests/_support/Test/TestForReflectionHelper.php',
],

RemoveUnusedConstructorParamRector::class => [
// there are deprecated parameters
__DIR__ . '/system/Debug/Exceptions.php',
// @TODO remove if deprecated $httpVerb is removed
__DIR__ . '/system/Router/AutoRouterImproved.php',
// @TODO remove if deprecated $config is removed
__DIR__ . '/system/HTTP/Request.php',
__DIR__ . '/system/HTTP/Response.php',
],

// Exclude test file because `is_cli()` is mocked and Rector might remove needed parameters.
RemoveExtraParametersRector::class => [
__DIR__ . '/tests/system/Debug/ToolbarTest.php',
],

// check on constant compare
UnwrapFutureCompatibleIfPhpVersionRector::class => [
__DIR__ . '/system/Autoloader/Autoloader.php',
],

UnderscoreToCamelCaseVariableNameRector::class => [
// session handlers have the gc() method with underscored parameter `$max_lifetime`
__DIR__ . '/system/Session/Handlers',
Expand All @@ -137,6 +118,10 @@
__DIR__ . '/tests/system/Debug/ExceptionsTest.php',
],

DeclareStrictTypesTestsRector::class => [
__DIR__ . '/tests/system/Debug/ExceptionsTest.php',
],

// use mt_rand instead of random_int on purpose on non-cryptographically random
RandomFunctionRector::class,

Expand All @@ -153,19 +138,13 @@
],

ReturnNeverTypeRector::class => [
__DIR__ . '/system/Cache/Handlers/BaseHandler.php',
__DIR__ . '/system/Cache/Handlers/MemcachedHandler.php',
__DIR__ . '/system/Cache/Handlers/WincacheHandler.php',
__DIR__ . '/system/CodeIgniter.php',
__DIR__ . '/system/Database/MySQLi/Utils.php',
__DIR__ . '/system/Database/OCI8/Utils.php',
__DIR__ . '/system/Database/Postgre/Utils.php',
__DIR__ . '/system/Database/SQLSRV/Utils.php',
__DIR__ . '/system/Database/SQLite3/Utils.php',
__DIR__ . '/system/HTTP/DownloadResponse.php',
__DIR__ . '/system/HTTP/SiteURI.php',
__DIR__ . '/system/Helpers/kint_helper.php',
__DIR__ . '/tests/_support/Autoloader/FatalLocator.php',
],

// Unnecessary (string) is inserted
Expand All @@ -176,28 +155,15 @@
// possibly isset() on purpose, on updated Config classes property accross versions
IssetOnPropertyObjectToPropertyExistsRector::class,

AssertFuncCallToPHPUnitAssertRector::class => [
// use $this inside static closure
__DIR__ . '/tests/system/AutoReview/FrameworkCodeTest.php',
],

// some tests extended by other tests
FinalizeTestCaseClassRector::class,

DeclareStrictTypesTestsRector::class => [
__DIR__ . '/tests/system/Debug/ExceptionsTest.php',
],

RemoveNullArgOnNullDefaultParamRector::class => [
// skip form query usage, easier to read
__DIR__ . '/system/Model.php',
__DIR__ . '/tests/system/Database',
__DIR__ . '/tests/system/Models',
],

StaticCallOnNonStaticToInstanceCallRector::class => [
__DIR__ . '/tests/_support/Config/Services.php',
],
])
// auto import fully qualified class names
->withImportNames(removeUnusedImports: true)
Expand Down
2 changes: 1 addition & 1 deletion tests/_support/Config/Services.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public static function uri(?string $uri = null, bool $getShared = true): URI

if ($uri === null) {
$appConfig = config(App::class);
$factory = new SiteURIFactory($appConfig, Services::superglobals());
$factory = new SiteURIFactory($appConfig, static::superglobals());

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

return $groupAttribute->name();
}, $attributes),
Expand Down
Loading