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 @@ -29,7 +29,7 @@
"phpunit/phpcov": "^9.0.2 || ^10.0",
"phpunit/phpunit": "^10.5.16 || ^11.2",
"predis/predis": "^3.0",
"rector/rector": "2.4.6",
"rector/rector": "2.5.2",
"shipmonk/phpstan-baseline-per-identifier": "^2.0"
},
"replace": {
Expand Down
34 changes: 7 additions & 27 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,19 @@
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\PostRector\Rector\UnusedImportRemovingPostRector;
use Rector\Privatization\Rector\Class_\FinalizeTestCaseClassRector;
use Rector\Privatization\Rector\Property\PrivatizeFinalClassPropertyRector;
use Rector\Renaming\Rector\ConstFetch\RenameConstantRector;
Expand Down Expand Up @@ -96,17 +95,10 @@

RemoveUnusedPrivateMethodRector::class => [
// private method called via getPrivateMethodInvoker
__DIR__ . '/tests/system/Test/ReflectionHelperTest.php',
__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',
],

Expand All @@ -115,11 +107,6 @@
__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 @@ -130,10 +117,7 @@
__DIR__ . '/app',
__DIR__ . '/system/CodeIgniter.php',
__DIR__ . '/system/Config/BaseConfig.php',
__DIR__ . '/system/Commands/Generators/Views',
__DIR__ . '/system/Pager/Views',
__DIR__ . '/system/Test/ControllerTestTrait.php',
__DIR__ . '/system/Validation/Views',
__DIR__ . '/system/View/Parser.php',
__DIR__ . '/tests/system/Debug/ExceptionsTest.php',
],
Expand All @@ -149,15 +133,11 @@
__DIR__ . '/system/Filters/Filters.php',
__DIR__ . '/system/HTTP/CURLRequest.php',
__DIR__ . '/system/HTTP/DownloadResponse.php',
__DIR__ . '/system/HTTP/IncomingRequest.php',
__DIR__ . '/system/Security/Security.php',
__DIR__ . '/system/Session/Session.php',
],

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',
Expand All @@ -166,8 +146,6 @@
__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 Down Expand Up @@ -197,12 +175,13 @@
__DIR__ . '/tests/system/Models',
],

StaticCallOnNonStaticToInstanceCallRector::class => [
__DIR__ . '/tests/_support/Config/Services.php',
UnusedImportRemovingPostRector::class => [
// buggy on auto import removed
__DIR__ . '/system/HTTP/Response.php',
],
])
// auto import fully qualified class names
->withImportNames(removeUnusedImports: true)
->withImportNames()
->withRules([
DeclareStrictTypesRector::class,
UnderscoreToCamelCaseVariableNameRector::class,
Expand Down Expand Up @@ -231,4 +210,5 @@
->withConfiguredRule(RenameConstantRector::class, [
'FILTER_DEFAULT' => 'FILTER_UNSAFE_RAW',
])
->withCodeQualityLevel(61);
->withCodeQualityLevel(61)
->reportUnusedSkips();
2 changes: 1 addition & 1 deletion system/CLI/CLI.php
Original file line number Diff line number Diff line change
Expand Up @@ -1012,7 +1012,7 @@ public static function getOptionString(bool $useLongOpts = false, bool $trim = f
continue;
}

if (mb_strpos($value, ' ') !== false) {
if (str_contains($value, ' ')) {
$out .= "\"{$value}\" ";
} elseif ($value !== null) {
$out .= "{$value} ";
Expand Down
2 changes: 1 addition & 1 deletion system/HTTP/CLIRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ public function getOptionString(bool $useLongOpts = false): string
continue;
}

if (mb_strpos($value, ' ') !== false) {
if (str_contains($value, ' ')) {
$out .= '"' . $value . '" ';
} else {
$out .= "{$value} ";
Expand Down
2 changes: 1 addition & 1 deletion system/Test/DOMParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public function see(?string $search = null, ?string $element = null): bool
if ($element === null) {
$content = $this->dom->saveHTML($this->dom->documentElement);

return mb_strpos($content, $search) !== false;
return str_contains($content, $search);
}

$result = $this->doXPath($search, $element);
Expand Down
Loading