Use prepare Rector set to upgrade your code:
vendor/bin/rector process src --config vendor/rector/rector/upgrade/rector_010.php
Some changes have to be handled manually:
- drop
PhpConfigPrinterBundle
class
getAttribute(AttributeKey::PARENT_CLASS_NAME)
→ use$scope->getClassReflection()
insteadgetAttribute(AttributeKey::NAMESPACE_NAME)
→ use$scope->getNamespace()
insteadgetAttribute(AttributeKey::NAMESPACE_NODE)
→ use$scope->getNamespace()
instead
- drop
ComposerJsonManipulatorBundle
class - drop
ConsoleColorDiffBundle
class
Sets with ambiguous naming were removed and rules moved to proper-named sets:
use Rector\Core\Configuration\Option;
use Rector\Set\ValueObject\SetList;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$parameters = $containerConfigurator->parameters();
$parameters->set(Option::SETS, [
- SetList::SOLID,
+ SetList::CODING_STYLE,
- SetList::PHPSTAN,
+ SetList::PRIVATIZATION,
]);
};
Since Rector 0.9 we switched from internal skipping to symplify/skipper
package. Now there is only one Option::SKIP
parameter to handle both paths and classes.
Replace deprecated Option::EXCLUDE_RECTORS
parameters with Option::SKIP
:
use Rector\Core\Configuration\Option;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$parameters = $containerConfigurator->parameters();
- $parameters->set(Option::EXCLUDE_RECTORS, [
+ $parameters->set(Option::SKIP, [
SomeRector::class,
]);
};
Replace deprecated Option::EXCLUDE_PATHS
parameters with Option::SKIP
:
use Rector\Core\Configuration\Option;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$parameters = $containerConfigurator->parameters();
- $parameters->set(Option::EXCLUDE_PATHS, [
+ $parameters->set(Option::SKIP, [
__DIR__ . '/SomePath,
]);
};
Be sure to have exactly 1 Option::SKIP
in the end, as the Symfony parameters are not merged, but overridden:
use Rector\Core\Configuration\Option;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$parameters = $containerConfigurator->parameters();
$parameters->set(Option::SKIP, [
SomeRector::class,
- ]);
-
- $parameters->set(Option::SKIP, [
__DIR__ . '/SomePath,
]);
};
Rector now works more and more with set stacking. The number of sets is growing and IDE autocomplete helps to work with them effectively. If you use these options in CLI, move them to rector.php
config like this:
-vendor/bin/rector process src --set php80
+vendor/bin/rector process src
use Rector\Core\Configuration\Option;
+use Rector\Set\ValueObject\SetList;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$parameters = $containerConfigurator->parameters();
$parameters->set(Option::SETS, [
+ SetList::PHP_80,
]);
};