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
37 changes: 17 additions & 20 deletions config/set/php80.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
use Rector\Php80\Rector\ClassMethod\FinalPrivateToPrivateVisibilityRector;
use Rector\Php80\Rector\ClassMethod\SetStateToStaticRector;
use Rector\Php80\Rector\FuncCall\ClassOnObjectRector;
use Rector\Php80\Rector\FuncCall\Php8ResourceReturnToObjectRector;
use Rector\Php80\Rector\FunctionLike\MixedTypeRector;
use Rector\Php80\Rector\Identical\StrEndsWithRector;
use Rector\Php80\Rector\Identical\StrStartsWithRector;
Expand All @@ -29,35 +28,38 @@
use Rector\Transform\ValueObject\StaticCallToFuncCall;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->rule(StrContainsRector::class);
$rectorConfig->rule(StrStartsWithRector::class);
$rectorConfig->rule(StrEndsWithRector::class);

$rectorConfig
->ruleWithConfiguration(StaticCallToFuncCallRector::class, [
new StaticCallToFuncCall('Nette\Utils\Strings', 'startsWith', 'str_starts_with'),
new StaticCallToFuncCall('Nette\Utils\Strings', 'endsWith', 'str_ends_with'),
new StaticCallToFuncCall('Nette\Utils\Strings', 'contains', 'str_contains'),
]);

$rectorConfig->rules([
StrContainsRector::class,
StrStartsWithRector::class,
StrEndsWithRector::class,
StringableForToStringRector::class,
ClassOnObjectRector::class,
GetDebugTypeRector::class,
RemoveUnusedVariableInCatchRector::class,
ClassPropertyAssignToConstructorPromotionRector::class,
ChangeSwitchToMatchRector::class,
RemoveParentCallWithoutParentRector::class,
SetStateToStaticRector::class,
FinalPrivateToPrivateVisibilityRector::class,
AddParamBasedOnParentClassMethodRector::class,
MixedTypeRector::class,
ClassOnThisVariableObjectRector::class,
]);

$rectorConfig
->ruleWithConfiguration(StaticCallToFuncCallRector::class, [
new StaticCallToFuncCall('Nette\Utils\Strings', 'startsWith', 'str_starts_with'),
new StaticCallToFuncCall('Nette\Utils\Strings', 'endsWith', 'str_ends_with'),
new StaticCallToFuncCall('Nette\Utils\Strings', 'contains', 'str_contains'),
]);

// nette\utils and Strings::replace()
$rectorConfig
->ruleWithConfiguration(
ArgumentAdderRector::class,
[new ArgumentAdder('Nette\Utils\Strings', 'replace', 2, 'replacement', '')]
);
$rectorConfig->rule(RemoveParentCallWithoutParentRector::class);
$rectorConfig->rule(SetStateToStaticRector::class);
$rectorConfig->rule(FinalPrivateToPrivateVisibilityRector::class);

// @see https://php.watch/versions/8.0/pgsql-aliases-deprecated
$rectorConfig
->ruleWithConfiguration(RenameFunctionRector::class, [
Expand Down Expand Up @@ -100,9 +102,4 @@
new ReplaceFuncCallArgumentDefaultValue('version_compare', 2, 'lte', 'le'),
new ReplaceFuncCallArgumentDefaultValue('version_compare', 2, 'n', 'ne'),
]);

$rectorConfig->rule(Php8ResourceReturnToObjectRector::class);
$rectorConfig->rule(AddParamBasedOnParentClassMethodRector::class);
$rectorConfig->rule(MixedTypeRector::class);
$rectorConfig->rule(ClassOnThisVariableObjectRector::class);
};
2 changes: 0 additions & 2 deletions config/set/php81.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
use Rector\Php81\Rector\ClassConst\FinalizePublicClassConstantRector;
use Rector\Php81\Rector\ClassMethod\NewInInitializerRector;
use Rector\Php81\Rector\FuncCall\NullToStrictStringFuncCallArgRector;
use Rector\Php81\Rector\FuncCall\Php81ResourceReturnToObjectRector;
use Rector\Php81\Rector\FunctionLike\IntersectionTypesRector;
use Rector\Php81\Rector\MethodCall\MyCLabsMethodCallToEnumConstRector;
use Rector\Php81\Rector\MethodCall\SpatieEnumMethodCallToEnumConstRector;
Expand All @@ -25,7 +24,6 @@
ReadOnlyPropertyRector::class,
SpatieEnumClassToEnumRector::class,
SpatieEnumMethodCallToEnumConstRector::class,
Php81ResourceReturnToObjectRector::class,
NewInInitializerRector::class,
IntersectionTypesRector::class,
NullToStrictStringFuncCallArgRector::class,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

namespace Rector\Tests\Php80\Rector\Catch_\RemoveUnusedVariableInCatchRector\Fixture;

final class Fixture
{
public function run()
{
try {
} catch (Throwable $notUsedThrowable) {
}
}
}

?>
-----
<?php

namespace Rector\Tests\Php80\Rector\Catch_\RemoveUnusedVariableInCatchRector\Fixture;

final class Fixture
{
public function run()
{
try {
} catch (Throwable) {
}
}
}

?>

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading