Question
I have a problem to migrate routes from yaml file to annotations/attributes in controllers. I am using Rector 0.18.13 and I was following the documentation from rector/rector-symfony:
rector.php
`<?php
declare(strict_types=1);
use Rector\Config\RectorConfig;
use Rector\Symfony\Bridge\Symfony\Routing\SymfonyRoutesProvider;
use Rector\Symfony\Configs\Rector\ClassMethod\AddRouteAnnotationRector;
use Rector\Symfony\Contract\Bridge\Symfony\Routing\SymfonyRoutesProviderInterface;
return static function (RectorConfig $rectorConfig): void {
$rectorConfig->symfonyContainerPhp(DIR . '/tests/symfony-container.php');
$rectorConfig->singleton(SymfonyRoutesProvider::class);
$rectorConfig->alias(SymfonyRoutesProvider::class, SymfonyRoutesProviderInterface::class);
$rectorConfig->rule(AddRouteAnnotationRector::class);
};`
tests/symfony-container.php
`<?php
use App\Kernel;
$appKernel = new Kernel('test', false);
$appKernel->boot();
return $appKernel->getContainer();`
Command: dc exec php vendor/bin/rector process src --clear-cache --dry-run --debug
I debugged container that is set inside symfonyContainerPhp method and it consists all metadata about routing ( inside routing service)
It does not add anything to controllers, Debug shows it goes through all controller files
Question
I have a problem to migrate routes from yaml file to annotations/attributes in controllers. I am using Rector 0.18.13 and I was following the documentation from rector/rector-symfony:
rector.php
`<?php
declare(strict_types=1);
use Rector\Config\RectorConfig;
use Rector\Symfony\Bridge\Symfony\Routing\SymfonyRoutesProvider;
use Rector\Symfony\Configs\Rector\ClassMethod\AddRouteAnnotationRector;
use Rector\Symfony\Contract\Bridge\Symfony\Routing\SymfonyRoutesProviderInterface;
return static function (RectorConfig $rectorConfig): void {
$rectorConfig->symfonyContainerPhp(DIR . '/tests/symfony-container.php');
};`
tests/symfony-container.php
`<?php
use App\Kernel;
$appKernel = new Kernel('test', false);
$appKernel->boot();
return $appKernel->getContainer();`
Command:
dc exec php vendor/bin/rector process src --clear-cache --dry-run --debugI debugged container that is set inside symfonyContainerPhp method and it consists all metadata about routing ( inside routing service)
It does not add anything to controllers, Debug shows it goes through all controller files