diff --git a/src/Rector/Contrib/Symfony/FrameworkBundleClassReplacementsRector.php b/src/Rector/Contrib/Symfony/FrameworkBundleClassReplacementsRector.php index 42d4bc2fae6..ac5835a7b78 100644 --- a/src/Rector/Contrib/Symfony/FrameworkBundleClassReplacementsRector.php +++ b/src/Rector/Contrib/Symfony/FrameworkBundleClassReplacementsRector.php @@ -28,8 +28,13 @@ final class FrameworkBundleClassReplacementsRector extends AbstractClassReplacer protected function getOldToNewClasses(): array { return [ - 'Symfony\Bundle\FrameworkBundle\DependencyInjectino\Compiler\SerializerPass' => 'Symfony\Component\Serializer\DependencyInjection\SerializerPass', - // @todo: complete the rest + 'Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\AddConsoleCommandPass' => 'Symfony\Component\Console\DependencyInjection\AddConsoleCommandPass', + 'Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\SerializerPass' => 'Symfony\Component\Serializer\DependencyInjection\SerializerPass', + 'Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\FormPass' => 'Symfony\Component\Form\DependencyInjection\FormPass', + 'Symfony\Bundle\FrameworkBundle\EventListener\SessionListener' => 'Symfony\Component\HttpKernel\EventListener\SessionListener', + 'Symfony\Bundle\FrameworkBundle\EventListener\TestSessionListener' => 'Symfony\Component\HttpKernel\EventListener\TestSessionListener', + 'Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\ConfigCachePass' => 'Symfony\Component\Config\DependencyInjection\ConfigCachePass', + 'Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\PropertyInfoPass' => 'Symfony\Component\PropertyInfo\DependencyInjection\PropertyInfoPass', ]; } } diff --git a/src/Rector/Contrib/SymfonyExtra/CommandToConstructorInjectionRector.php b/src/Rector/Contrib/SymfonyExtra/CommandToConstructorInjectionRector.php index 709540aa74d..63ad48902d8 100644 --- a/src/Rector/Contrib/SymfonyExtra/CommandToConstructorInjectionRector.php +++ b/src/Rector/Contrib/SymfonyExtra/CommandToConstructorInjectionRector.php @@ -5,7 +5,7 @@ namespace Rector\Rector\Contrib\SymfonyExtra; use Nette\Utils\Strings; use PhpParser\Node; use PhpParser\Node\Expr\MethodCall; -use PhpParser\Node\Name; +use PhpParser\Node\Name\FullyQualified; use Rector\Builder\Class_\ClassPropertyCollector; use Rector\Builder\Kernel\ServiceFromKernelResolver; use Rector\Builder\Naming\NameResolver; @@ -18,9 +18,6 @@ use Rector\Tests\Rector\Contrib\SymfonyExtra\GetterToPropertyRector\Source\Local /** * Ref: https://github.com/symfony/symfony/blob/master/UPGRADE-4.0.md#console * - * Similar to @see \Rector\Rector\Contrib\Symfony\GetterToPropertyRector - * @todo Extract common logic! - * * Before: * class MyCommand extends ContainerAwareCommand * @@ -126,6 +123,6 @@ final class CommandToConstructorInjectionRector extends AbstractRector private function replaceParentContainerAwareCommandWithCommand(): void { - $this->classNode->extends = new Name('\Symfony\Component\Console\Command\Command'); + $this->classNode->extends = new FullyQualified('Symfony\Component\Console\Command\Command'); } } diff --git a/tests/Rector/Contrib/Symfony/FrameworkBundleClassReplacementsRector/Wrong/wrong.php.inc b/tests/Rector/Contrib/Symfony/FrameworkBundleClassReplacementsRector/Wrong/wrong.php.inc index 08fc6006bc9..a5ae1f77d18 100644 --- a/tests/Rector/Contrib/Symfony/FrameworkBundleClassReplacementsRector/Wrong/wrong.php.inc +++ b/tests/Rector/Contrib/Symfony/FrameworkBundleClassReplacementsRector/Wrong/wrong.php.inc @@ -1,4 +1,4 @@ addCompilerPass(new Symfony\Bundle\FrameworkBundle\DependencyInjectino\Compiler\SerializerPass); +$containerBuilder->addCompilerPass(new Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\SerializerPass);