Updated Rector to commit adb6e68c2a

adb6e68c2a [automated] Re-Generate Nodes/Rectors Documentation (#2343)
This commit is contained in:
Tomas Votruba 2022-05-22 07:17:20 +00:00
parent 2b85976c4c
commit 7b1430a8bc
28 changed files with 282 additions and 261 deletions

2
vendor/autoload.php vendored
View File

@ -9,4 +9,4 @@ if (PHP_VERSION_ID < 50600) {
require_once __DIR__ . '/composer/autoload_real.php';
return ComposerAutoloaderInit9782dd56f9fe1f00f0b4d3f701f55955::getLoader();
return ComposerAutoloaderInit05cb8895e1954651c31b14af1c80af2a::getLoader();

View File

@ -2908,14 +2908,14 @@ return array(
'Rector\\Symfony\\ApplicationMetadata\\ListenerServiceDefinitionProvider' => $vendorDir . '/rector/rector-symfony/src/ApplicationMetadata/ListenerServiceDefinitionProvider.php',
'Rector\\Symfony\\Bridge\\NodeAnalyzer\\ControllerMethodAnalyzer' => $vendorDir . '/rector/rector-symfony/src/Bridge/NodeAnalyzer/ControllerMethodAnalyzer.php',
'Rector\\Symfony\\Bridge\\Symfony\\ContainerServiceProvider' => $vendorDir . '/rector/rector-symfony/src/Bridge/Symfony/ContainerServiceProvider.php',
'Rector\\Symfony\\Bridge\\Symfony\\Routing\\SymfonyRoutesProvider' => $vendorDir . '/rector/rector-symfony/src/Bridge/Symfony/Routing/SymfonyRoutesProvider.php',
'Rector\\Symfony\\BundleClassResolver' => $vendorDir . '/rector/rector-symfony/src/BundleClassResolver.php',
'Rector\\Symfony\\Command\\ConvertSymfonyRoutesCommand' => $vendorDir . '/rector/rector-symfony/src/Command/ConvertSymfonyRoutesCommand.php',
'Rector\\Symfony\\Contract\\Bridge\\Symfony\\Routing\\SymfonyRoutesProviderInterface' => $vendorDir . '/rector/rector-symfony/src/Contract/Bridge/Symfony/Routing/SymfonyRoutesProviderInterface.php',
'Rector\\Symfony\\Contract\\EventReferenceToMethodNameInterface' => $vendorDir . '/rector/rector-symfony/src/Contract/EventReferenceToMethodNameInterface.php',
'Rector\\Symfony\\Contract\\Tag\\TagInterface' => $vendorDir . '/rector/rector-symfony/src/Contract/Tag/TagInterface.php',
'Rector\\Symfony\\DataProvider\\RouteMapProvider' => $vendorDir . '/rector/rector-symfony/src/DataProvider/RouteMapProvider.php',
'Rector\\Symfony\\DataProvider\\ServiceMapProvider' => $vendorDir . '/rector/rector-symfony/src/DataProvider/ServiceMapProvider.php',
'Rector\\Symfony\\Enum\\SymfonyAnnotation' => $vendorDir . '/rector/rector-symfony/src/Enum/SymfonyAnnotation.php',
'Rector\\Symfony\\Exception\\InvalidConfigurationException' => $vendorDir . '/rector/rector-symfony/src/Exception/InvalidConfigurationException.php',
'Rector\\Symfony\\Exception\\JsonRoutesNotExistsException' => $vendorDir . '/rector/rector-symfony/src/Exception/JsonRoutesNotExistsException.php',
'Rector\\Symfony\\Exception\\XmlContainerNotExistsException' => $vendorDir . '/rector/rector-symfony/src/Exception/XmlContainerNotExistsException.php',
'Rector\\Symfony\\FormHelper\\FormTypeStringToTypeProvider' => $vendorDir . '/rector/rector-symfony/src/FormHelper/FormTypeStringToTypeProvider.php',
'Rector\\Symfony\\Helper\\TemplateGuesser' => $vendorDir . '/rector/rector-symfony/src/Helper/TemplateGuesser.php',
@ -3021,7 +3021,6 @@ return array(
'Rector\\Symfony\\TypeAnalyzer\\ControllerAnalyzer' => $vendorDir . '/rector/rector-symfony/src/TypeAnalyzer/ControllerAnalyzer.php',
'Rector\\Symfony\\TypeAnalyzer\\JMSDITypeResolver' => $vendorDir . '/rector/rector-symfony/src/TypeAnalyzer/JMSDITypeResolver.php',
'Rector\\Symfony\\TypeDeclaration\\ReturnTypeDeclarationUpdater' => $vendorDir . '/rector/rector-symfony/src/TypeDeclaration/ReturnTypeDeclarationUpdater.php',
'Rector\\Symfony\\ValueObjectFactory\\RouteMapFactory' => $vendorDir . '/rector/rector-symfony/src/ValueObjectFactory/RouteMapFactory.php',
'Rector\\Symfony\\ValueObjectFactory\\ServiceMapFactory' => $vendorDir . '/rector/rector-symfony/src/ValueObjectFactory/ServiceMapFactory.php',
'Rector\\Symfony\\ValueObject\\ConstantMap\\SymfonyRequestConstantMap' => $vendorDir . '/rector/rector-symfony/src/ValueObject/ConstantMap/SymfonyRequestConstantMap.php',
'Rector\\Symfony\\ValueObject\\ConstantMap\\SymfonyResponseConstantMap' => $vendorDir . '/rector/rector-symfony/src/ValueObject/ConstantMap/SymfonyResponseConstantMap.php',
@ -3030,7 +3029,6 @@ return array(
'Rector\\Symfony\\ValueObject\\EventReferenceToMethodNameWithPriority' => $vendorDir . '/rector/rector-symfony/src/ValueObject/EventReferenceToMethodNameWithPriority.php',
'Rector\\Symfony\\ValueObject\\InvokableController\\ActiveClassElements' => $vendorDir . '/rector/rector-symfony/src/ValueObject/InvokableController/ActiveClassElements.php',
'Rector\\Symfony\\ValueObject\\ReplaceServiceArgument' => $vendorDir . '/rector/rector-symfony/src/ValueObject/ReplaceServiceArgument.php',
'Rector\\Symfony\\ValueObject\\RouteMap\\RouteMap' => $vendorDir . '/rector/rector-symfony/src/ValueObject/RouteMap/RouteMap.php',
'Rector\\Symfony\\ValueObject\\ServiceDefinition' => $vendorDir . '/rector/rector-symfony/src/ValueObject/ServiceDefinition.php',
'Rector\\Symfony\\ValueObject\\ServiceMap\\ServiceMap' => $vendorDir . '/rector/rector-symfony/src/ValueObject/ServiceMap/ServiceMap.php',
'Rector\\Symfony\\ValueObject\\SymfonyRouteMetadata' => $vendorDir . '/rector/rector-symfony/src/ValueObject/SymfonyRouteMetadata.php',

View File

@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer
class ComposerAutoloaderInit9782dd56f9fe1f00f0b4d3f701f55955
class ComposerAutoloaderInit05cb8895e1954651c31b14af1c80af2a
{
private static $loader;
@ -22,19 +22,19 @@ class ComposerAutoloaderInit9782dd56f9fe1f00f0b4d3f701f55955
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInit9782dd56f9fe1f00f0b4d3f701f55955', 'loadClassLoader'), true, true);
spl_autoload_register(array('ComposerAutoloaderInit05cb8895e1954651c31b14af1c80af2a', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
spl_autoload_unregister(array('ComposerAutoloaderInit9782dd56f9fe1f00f0b4d3f701f55955', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInit05cb8895e1954651c31b14af1c80af2a', 'loadClassLoader'));
require __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInit9782dd56f9fe1f00f0b4d3f701f55955::getInitializer($loader));
call_user_func(\Composer\Autoload\ComposerStaticInit05cb8895e1954651c31b14af1c80af2a::getInitializer($loader));
$loader->setClassMapAuthoritative(true);
$loader->register(true);
$includeFiles = \Composer\Autoload\ComposerStaticInit9782dd56f9fe1f00f0b4d3f701f55955::$files;
$includeFiles = \Composer\Autoload\ComposerStaticInit05cb8895e1954651c31b14af1c80af2a::$files;
foreach ($includeFiles as $fileIdentifier => $file) {
composerRequire9782dd56f9fe1f00f0b4d3f701f55955($fileIdentifier, $file);
composerRequire05cb8895e1954651c31b14af1c80af2a($fileIdentifier, $file);
}
return $loader;
@ -46,7 +46,7 @@ class ComposerAutoloaderInit9782dd56f9fe1f00f0b4d3f701f55955
* @param string $file
* @return void
*/
function composerRequire9782dd56f9fe1f00f0b4d3f701f55955($fileIdentifier, $file)
function composerRequire05cb8895e1954651c31b14af1c80af2a($fileIdentifier, $file)
{
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;

View File

@ -4,7 +4,7 @@
namespace Composer\Autoload;
class ComposerStaticInit9782dd56f9fe1f00f0b4d3f701f55955
class ComposerStaticInit05cb8895e1954651c31b14af1c80af2a
{
public static $files = array (
'320cde22f66dd4f5d3fd621d3e88b98f' => __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php',
@ -3277,14 +3277,14 @@ class ComposerStaticInit9782dd56f9fe1f00f0b4d3f701f55955
'Rector\\Symfony\\ApplicationMetadata\\ListenerServiceDefinitionProvider' => __DIR__ . '/..' . '/rector/rector-symfony/src/ApplicationMetadata/ListenerServiceDefinitionProvider.php',
'Rector\\Symfony\\Bridge\\NodeAnalyzer\\ControllerMethodAnalyzer' => __DIR__ . '/..' . '/rector/rector-symfony/src/Bridge/NodeAnalyzer/ControllerMethodAnalyzer.php',
'Rector\\Symfony\\Bridge\\Symfony\\ContainerServiceProvider' => __DIR__ . '/..' . '/rector/rector-symfony/src/Bridge/Symfony/ContainerServiceProvider.php',
'Rector\\Symfony\\Bridge\\Symfony\\Routing\\SymfonyRoutesProvider' => __DIR__ . '/..' . '/rector/rector-symfony/src/Bridge/Symfony/Routing/SymfonyRoutesProvider.php',
'Rector\\Symfony\\BundleClassResolver' => __DIR__ . '/..' . '/rector/rector-symfony/src/BundleClassResolver.php',
'Rector\\Symfony\\Command\\ConvertSymfonyRoutesCommand' => __DIR__ . '/..' . '/rector/rector-symfony/src/Command/ConvertSymfonyRoutesCommand.php',
'Rector\\Symfony\\Contract\\Bridge\\Symfony\\Routing\\SymfonyRoutesProviderInterface' => __DIR__ . '/..' . '/rector/rector-symfony/src/Contract/Bridge/Symfony/Routing/SymfonyRoutesProviderInterface.php',
'Rector\\Symfony\\Contract\\EventReferenceToMethodNameInterface' => __DIR__ . '/..' . '/rector/rector-symfony/src/Contract/EventReferenceToMethodNameInterface.php',
'Rector\\Symfony\\Contract\\Tag\\TagInterface' => __DIR__ . '/..' . '/rector/rector-symfony/src/Contract/Tag/TagInterface.php',
'Rector\\Symfony\\DataProvider\\RouteMapProvider' => __DIR__ . '/..' . '/rector/rector-symfony/src/DataProvider/RouteMapProvider.php',
'Rector\\Symfony\\DataProvider\\ServiceMapProvider' => __DIR__ . '/..' . '/rector/rector-symfony/src/DataProvider/ServiceMapProvider.php',
'Rector\\Symfony\\Enum\\SymfonyAnnotation' => __DIR__ . '/..' . '/rector/rector-symfony/src/Enum/SymfonyAnnotation.php',
'Rector\\Symfony\\Exception\\InvalidConfigurationException' => __DIR__ . '/..' . '/rector/rector-symfony/src/Exception/InvalidConfigurationException.php',
'Rector\\Symfony\\Exception\\JsonRoutesNotExistsException' => __DIR__ . '/..' . '/rector/rector-symfony/src/Exception/JsonRoutesNotExistsException.php',
'Rector\\Symfony\\Exception\\XmlContainerNotExistsException' => __DIR__ . '/..' . '/rector/rector-symfony/src/Exception/XmlContainerNotExistsException.php',
'Rector\\Symfony\\FormHelper\\FormTypeStringToTypeProvider' => __DIR__ . '/..' . '/rector/rector-symfony/src/FormHelper/FormTypeStringToTypeProvider.php',
'Rector\\Symfony\\Helper\\TemplateGuesser' => __DIR__ . '/..' . '/rector/rector-symfony/src/Helper/TemplateGuesser.php',
@ -3390,7 +3390,6 @@ class ComposerStaticInit9782dd56f9fe1f00f0b4d3f701f55955
'Rector\\Symfony\\TypeAnalyzer\\ControllerAnalyzer' => __DIR__ . '/..' . '/rector/rector-symfony/src/TypeAnalyzer/ControllerAnalyzer.php',
'Rector\\Symfony\\TypeAnalyzer\\JMSDITypeResolver' => __DIR__ . '/..' . '/rector/rector-symfony/src/TypeAnalyzer/JMSDITypeResolver.php',
'Rector\\Symfony\\TypeDeclaration\\ReturnTypeDeclarationUpdater' => __DIR__ . '/..' . '/rector/rector-symfony/src/TypeDeclaration/ReturnTypeDeclarationUpdater.php',
'Rector\\Symfony\\ValueObjectFactory\\RouteMapFactory' => __DIR__ . '/..' . '/rector/rector-symfony/src/ValueObjectFactory/RouteMapFactory.php',
'Rector\\Symfony\\ValueObjectFactory\\ServiceMapFactory' => __DIR__ . '/..' . '/rector/rector-symfony/src/ValueObjectFactory/ServiceMapFactory.php',
'Rector\\Symfony\\ValueObject\\ConstantMap\\SymfonyRequestConstantMap' => __DIR__ . '/..' . '/rector/rector-symfony/src/ValueObject/ConstantMap/SymfonyRequestConstantMap.php',
'Rector\\Symfony\\ValueObject\\ConstantMap\\SymfonyResponseConstantMap' => __DIR__ . '/..' . '/rector/rector-symfony/src/ValueObject/ConstantMap/SymfonyResponseConstantMap.php',
@ -3399,7 +3398,6 @@ class ComposerStaticInit9782dd56f9fe1f00f0b4d3f701f55955
'Rector\\Symfony\\ValueObject\\EventReferenceToMethodNameWithPriority' => __DIR__ . '/..' . '/rector/rector-symfony/src/ValueObject/EventReferenceToMethodNameWithPriority.php',
'Rector\\Symfony\\ValueObject\\InvokableController\\ActiveClassElements' => __DIR__ . '/..' . '/rector/rector-symfony/src/ValueObject/InvokableController/ActiveClassElements.php',
'Rector\\Symfony\\ValueObject\\ReplaceServiceArgument' => __DIR__ . '/..' . '/rector/rector-symfony/src/ValueObject/ReplaceServiceArgument.php',
'Rector\\Symfony\\ValueObject\\RouteMap\\RouteMap' => __DIR__ . '/..' . '/rector/rector-symfony/src/ValueObject/RouteMap/RouteMap.php',
'Rector\\Symfony\\ValueObject\\ServiceDefinition' => __DIR__ . '/..' . '/rector/rector-symfony/src/ValueObject/ServiceDefinition.php',
'Rector\\Symfony\\ValueObject\\ServiceMap\\ServiceMap' => __DIR__ . '/..' . '/rector/rector-symfony/src/ValueObject/ServiceMap/ServiceMap.php',
'Rector\\Symfony\\ValueObject\\SymfonyRouteMetadata' => __DIR__ . '/..' . '/rector/rector-symfony/src/ValueObject/SymfonyRouteMetadata.php',
@ -3909,9 +3907,9 @@ class ComposerStaticInit9782dd56f9fe1f00f0b4d3f701f55955
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInit9782dd56f9fe1f00f0b4d3f701f55955::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit9782dd56f9fe1f00f0b4d3f701f55955::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit9782dd56f9fe1f00f0b4d3f701f55955::$classMap;
$loader->prefixLengthsPsr4 = ComposerStaticInit05cb8895e1954651c31b14af1c80af2a::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit05cb8895e1954651c31b14af1c80af2a::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit05cb8895e1954651c31b14af1c80af2a::$classMap;
}, null, ClassLoader::class);
}

View File

@ -2644,12 +2644,12 @@
"source": {
"type": "git",
"url": "https:\/\/github.com\/rectorphp\/rector-symfony.git",
"reference": "f1189f5d8bd3e231c4e881e16835f3f124af5fc2"
"reference": "08d645d690d25bf9f854c440f366017c3d3d62e7"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-symfony\/zipball\/f1189f5d8bd3e231c4e881e16835f3f124af5fc2",
"reference": "f1189f5d8bd3e231c4e881e16835f3f124af5fc2",
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-symfony\/zipball\/08d645d690d25bf9f854c440f366017c3d3d62e7",
"reference": "08d645d690d25bf9f854c440f366017c3d3d62e7",
"shasum": ""
},
"require": {
@ -2671,6 +2671,7 @@
"symfony\/routing": "^5.4",
"symfony\/security-core": "^5.4",
"symfony\/security-http": "^5.4",
"symplify\/easy-ci": "^10.2",
"symplify\/easy-coding-standard": "^10.2",
"symplify\/monorepo-builder": "^10.2",
"symplify\/phpstan-extensions": "^10.2",
@ -2678,7 +2679,7 @@
"symplify\/rule-doc-generator": "^10.2",
"symplify\/vendor-patches": "^10.2"
},
"time": "2022-05-21T12:03:06+00:00",
"time": "2022-05-22T07:08:50+00:00",
"default-branch": true,
"type": "rector-extension",
"extra": {
@ -2785,12 +2786,12 @@
"source": {
"type": "git",
"url": "https:\/\/github.com\/sabbelasichon\/typo3-rector.git",
"reference": "1e75e867819e85e241319084d00efdb2817517fd"
"reference": "0da5602980a47f92f1a61e348c058f9abac207c4"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/sabbelasichon\/typo3-rector\/zipball\/1e75e867819e85e241319084d00efdb2817517fd",
"reference": "1e75e867819e85e241319084d00efdb2817517fd",
"url": "https:\/\/api.github.com\/repos\/sabbelasichon\/typo3-rector\/zipball\/0da5602980a47f92f1a61e348c058f9abac207c4",
"reference": "0da5602980a47f92f1a61e348c058f9abac207c4",
"shasum": ""
},
"require": {
@ -2820,7 +2821,7 @@
"symplify\/vendor-patches": "^10.2",
"tracy\/tracy": "^2.8"
},
"time": "2022-05-19T21:10:21+00:00",
"time": "2022-05-22T05:35:54+00:00",
"default-branch": true,
"type": "rector-extension",
"extra": {

File diff suppressed because one or more lines are too long

View File

@ -9,7 +9,7 @@ namespace Rector\RectorInstaller;
*/
final class GeneratedConfig
{
public const EXTENSIONS = array('rector/rector-cakephp' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-cakephp', 'relative_install_path' => '../../rector-cakephp', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 43ca394'), 'rector/rector-doctrine' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-doctrine', 'relative_install_path' => '../../rector-doctrine', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 4a907ed'), 'rector/rector-generator' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-generator', 'relative_install_path' => '../../rector-generator', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 784271e'), 'rector/rector-laravel' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-laravel', 'relative_install_path' => '../../rector-laravel', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 2e0f600'), 'rector/rector-nette' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-nette', 'relative_install_path' => '../../rector-nette', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 5f84d90'), 'rector/rector-phpoffice' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-phpoffice', 'relative_install_path' => '../../rector-phpoffice', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main e544f2a'), 'rector/rector-phpunit' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-phpunit', 'relative_install_path' => '../../rector-phpunit', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 5a33940'), 'rector/rector-symfony' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-symfony', 'relative_install_path' => '../../rector-symfony', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main f1189f5'), 'ssch/typo3-rector' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/ssch/typo3-rector', 'relative_install_path' => '../../../ssch/typo3-rector', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 1e75e86'));
public const EXTENSIONS = array('rector/rector-cakephp' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-cakephp', 'relative_install_path' => '../../rector-cakephp', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 43ca394'), 'rector/rector-doctrine' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-doctrine', 'relative_install_path' => '../../rector-doctrine', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 4a907ed'), 'rector/rector-generator' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-generator', 'relative_install_path' => '../../rector-generator', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 784271e'), 'rector/rector-laravel' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-laravel', 'relative_install_path' => '../../rector-laravel', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 2e0f600'), 'rector/rector-nette' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-nette', 'relative_install_path' => '../../rector-nette', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 5f84d90'), 'rector/rector-phpoffice' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-phpoffice', 'relative_install_path' => '../../rector-phpoffice', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main e544f2a'), 'rector/rector-phpunit' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-phpunit', 'relative_install_path' => '../../rector-phpunit', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 5a33940'), 'rector/rector-symfony' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-symfony', 'relative_install_path' => '../../rector-symfony', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 08d645d'), 'ssch/typo3-rector' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/ssch/typo3-rector', 'relative_install_path' => '../../../ssch/typo3-rector', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 0da5602'));
private function __construct()
{
}

View File

@ -19,6 +19,7 @@
"symfony\/routing": "^5.4",
"symfony\/security-core": "^5.4",
"symfony\/security-http": "^5.4",
"symplify\/easy-ci": "^10.2",
"symplify\/easy-coding-standard": "^10.2",
"symplify\/monorepo-builder": "^10.2",
"symplify\/phpstan-extensions": "^10.2",

View File

@ -0,0 +1,13 @@
<?php
declare (strict_types=1);
namespace RectorPrefix20220522;
use Rector\Core\Contract\Rector\RectorInterface;
use Rector\Set\Contract\SetListInterface;
use Rector\Symfony\Contract\Bridge\Symfony\Routing\SymfonyRoutesProviderInterface;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (\Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator $containerConfigurator) : void {
$parameters = $containerConfigurator->parameters();
$parameters->set('types_to_skip', [\Rector\Symfony\Contract\Bridge\Symfony\Routing\SymfonyRoutesProviderInterface::class, \Rector\Set\Contract\SetListInterface::class, \Rector\Core\Contract\Rector\RectorInterface::class]);
};

View File

@ -12,7 +12,10 @@ return static function (\Rector\Config\RectorConfig $rectorConfig) : void {
$rectorConfig->importNames();
$rectorConfig->paths([__DIR__ . '/src', __DIR__ . '/tests']);
$rectorConfig->parallel();
$rectorConfig->skip(['*/Fixture/*', '*/Source/*', '*/Source*/*', '*/tests/*/Fixture*/Expected/*', \Rector\Php55\Rector\String_\StringClassNameToClassConstantRector::class => [__DIR__ . '/config']]);
$rectorConfig->skip(['*/Fixture/*', '*/Source/*', '*/Source*/*', '*/tests/*/Fixture*/Expected/*', \Rector\Php55\Rector\String_\StringClassNameToClassConstantRector::class => [__DIR__ . '/config'], \Rector\Naming\Rector\Foreach_\RenameForeachValueVariableToMatchMethodCallReturnTypeRector::class => [
// "data" => "datum" false positive
__DIR__ . '/src/Rector/ClassMethod/AddRouteAnnotationRector.php',
]]);
$rectorConfig->ruleWithConfiguration(\Rector\Php55\Rector\String_\StringClassNameToClassConstantRector::class, [
'Symfony\\*',
'Twig_*',

View File

@ -0,0 +1,46 @@
<?php
declare (strict_types=1);
namespace Rector\Symfony\Bridge\Symfony\Routing;
use Rector\Symfony\Bridge\Symfony\ContainerServiceProvider;
use Rector\Symfony\Contract\Bridge\Symfony\Routing\SymfonyRoutesProviderInterface;
use Rector\Symfony\ValueObject\SymfonyRouteMetadata;
use RectorPrefix20220522\Symfony\Component\Routing\RouterInterface;
use RectorPrefix20220522\Webmozart\Assert\Assert;
final class SymfonyRoutesProvider implements \Rector\Symfony\Contract\Bridge\Symfony\Routing\SymfonyRoutesProviderInterface
{
/**
* @var SymfonyRouteMetadata[]
*/
private $symfonyRouteMetadatas = [];
/**
* @readonly
* @var \Rector\Symfony\Bridge\Symfony\ContainerServiceProvider
*/
private $containerServiceProvider;
public function __construct(\Rector\Symfony\Bridge\Symfony\ContainerServiceProvider $containerServiceProvider)
{
$this->containerServiceProvider = $containerServiceProvider;
}
/**
* @return SymfonyRouteMetadata[]
*/
public function provide() : array
{
if ($this->symfonyRouteMetadatas !== []) {
return $this->symfonyRouteMetadatas;
}
$router = $this->containerServiceProvider->provideByName('router');
\RectorPrefix20220522\Webmozart\Assert\Assert::isInstanceOf($router, 'Symfony\\Component\\Routing\\RouterInterface');
$symfonyRoutesMetadatas = [];
/** @var RouterInterface $router */
$routeCollection = $router->getRouteCollection();
// route name is hidden in the key - https://github.com/symfony/symfony/blob/4dde1619d6c65b662170a6a3cbbdc7092eeb1fa2/src/Symfony/Component/Routing/RouteCollection.php#L99
foreach ($routeCollection->all() as $routeName => $route) {
$symfonyRoutesMetadatas[] = new \Rector\Symfony\ValueObject\SymfonyRouteMetadata($routeName, $route->getPath(), $route->getDefaults(), $route->getRequirements(), $route->getHost(), $route->getSchemes(), $route->getMethods(), $route->getCondition());
}
$this->symfonyRouteMetadatas = $symfonyRoutesMetadatas;
return $symfonyRoutesMetadatas;
}
}

View File

@ -1,42 +0,0 @@
<?php
declare (strict_types=1);
namespace Rector\Symfony\Command;
use RectorPrefix20220522\Nette\Utils\Json;
use Rector\Symfony\Bridge\Symfony\ContainerServiceProvider;
use RectorPrefix20220522\Symfony\Component\Console\Command\Command;
use RectorPrefix20220522\Symfony\Component\Console\Input\InputInterface;
use RectorPrefix20220522\Symfony\Component\Console\Output\OutputInterface;
use RectorPrefix20220522\Webmozart\Assert\Assert;
final class ConvertSymfonyRoutesCommand extends \RectorPrefix20220522\Symfony\Component\Console\Command\Command
{
/**
* @readonly
* @var \Rector\Symfony\Bridge\Symfony\ContainerServiceProvider
*/
private $containerServiceProvider;
public function __construct(\Rector\Symfony\Bridge\Symfony\ContainerServiceProvider $containerServiceProvider)
{
$this->containerServiceProvider = $containerServiceProvider;
parent::__construct();
}
protected function configure() : void
{
$this->setName('convert-symfony-routes');
$this->setDescription('Convert routes from YAML to resoled controller annotation');
}
protected function execute(\RectorPrefix20220522\Symfony\Component\Console\Input\InputInterface $input, \RectorPrefix20220522\Symfony\Component\Console\Output\OutputInterface $output) : int
{
$router = $this->containerServiceProvider->provideByName('router');
\RectorPrefix20220522\Webmozart\Assert\Assert::isInstanceOf($router, 'Symfony\\Component\\Routing\\RouterInterface');
$routeCollection = $router->getRouteCollection();
$routes = \array_map(static function ($route) : array {
return ['path' => $route->getPath(), 'host' => $route->getHost(), 'schemes' => $route->getSchemes(), 'methods' => $route->getMethods(), 'defaults' => $route->getDefaults(), 'requirements' => $route->getRequirements(), 'condition' => $route->getCondition()];
}, $routeCollection->all());
$content = \RectorPrefix20220522\Nette\Utils\Json::encode($routes, \RectorPrefix20220522\Nette\Utils\Json::PRETTY) . \PHP_EOL;
$output->write($content, \false, \RectorPrefix20220522\Symfony\Component\Console\Output\OutputInterface::OUTPUT_RAW);
// @todo invoke the converter
return \RectorPrefix20220522\Symfony\Component\Console\Command\Command::SUCCESS;
}
}

View File

@ -0,0 +1,13 @@
<?php
declare (strict_types=1);
namespace Rector\Symfony\Contract\Bridge\Symfony\Routing;
use Rector\Symfony\ValueObject\SymfonyRouteMetadata;
interface SymfonyRoutesProviderInterface
{
/**
* @return SymfonyRouteMetadata[]
*/
public function provide() : array;
}

View File

@ -1,35 +0,0 @@
<?php
declare (strict_types=1);
namespace Rector\Symfony\DataProvider;
use Rector\Core\Configuration\Option;
use Rector\Symfony\ValueObject\RouteMap\RouteMap;
use Rector\Symfony\ValueObjectFactory\RouteMapFactory;
use RectorPrefix20220522\Symplify\PackageBuilder\Parameter\ParameterProvider;
final class RouteMapProvider
{
/**
* @readonly
* @var \Symplify\PackageBuilder\Parameter\ParameterProvider
*/
private $parameterProvider;
/**
* @readonly
* @var \Rector\Symfony\ValueObjectFactory\RouteMapFactory
*/
private $routeMapFactory;
public function __construct(\RectorPrefix20220522\Symplify\PackageBuilder\Parameter\ParameterProvider $parameterProvider, \Rector\Symfony\ValueObjectFactory\RouteMapFactory $routeMapFactory)
{
$this->parameterProvider = $parameterProvider;
$this->routeMapFactory = $routeMapFactory;
}
public function provide() : \Rector\Symfony\ValueObject\RouteMap\RouteMap
{
$symfonyRoutesJsonPath = (string) $this->parameterProvider->provideParameter(\Rector\Core\Configuration\Option::SYMFONY_ROUTES_JSON_PATH_PARAMETER);
if ($symfonyRoutesJsonPath === '') {
return $this->routeMapFactory->createEmpty();
}
return $this->routeMapFactory->createFromFileContent($symfonyRoutesJsonPath);
}
}

View File

@ -0,0 +1,12 @@
<?php
declare (strict_types=1);
namespace Rector\Symfony\Enum;
final class SymfonyAnnotation
{
/**
* @var string
*/
public const ROUTE = 'Symfony\\Component\\Routing\\Annotation\\Route';
}

View File

@ -1,9 +0,0 @@
<?php
declare (strict_types=1);
namespace Rector\Symfony\Exception;
use Exception;
final class JsonRoutesNotExistsException extends \Exception
{
}

View File

@ -14,6 +14,7 @@ use Rector\BetterPhpDocParser\PhpDoc\DoctrineAnnotationTagValueNode;
use Rector\BetterPhpDocParser\ValueObject\PhpDoc\DoctrineAnnotation\CurlyListNode;
use Rector\Doctrine\NodeAnalyzer\AttrinationFinder;
use Rector\NodeNameResolver\NodeNameResolver;
use Rector\Symfony\Enum\SymfonyAnnotation;
final class RouteRequiredParamNameToTypesResolver
{
/**
@ -39,7 +40,7 @@ final class RouteRequiredParamNameToTypesResolver
if ($classMethod->getParams() === []) {
return [];
}
$routeAttrination = $this->attrinationFinder->getByOne($classMethod, 'Symfony\\Component\\Routing\\Annotation\\Route');
$routeAttrination = $this->attrinationFinder->getByOne($classMethod, \Rector\Symfony\Enum\SymfonyAnnotation::ROUTE);
$paramsToRegexes = $this->resolveParamsToRegexes($routeAttrination);
if ($paramsToRegexes === []) {
return [];

View File

@ -5,6 +5,7 @@ namespace Rector\Symfony\PhpDocNode;
use PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode;
use Rector\BetterPhpDocParser\PhpDoc\DoctrineAnnotationTagValueNode;
use Rector\Symfony\Enum\SymfonyAnnotation;
final class SymfonyRouteTagValueNodeFactory
{
/**
@ -12,6 +13,6 @@ final class SymfonyRouteTagValueNodeFactory
*/
public function createFromItems(array $items) : \Rector\BetterPhpDocParser\PhpDoc\DoctrineAnnotationTagValueNode
{
return new \Rector\BetterPhpDocParser\PhpDoc\DoctrineAnnotationTagValueNode(new \PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode('Symfony\\Component\\Routing\\Annotation\\Route'), null, $items, 'path');
return new \Rector\BetterPhpDocParser\PhpDoc\DoctrineAnnotationTagValueNode(new \PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode(\Rector\Symfony\Enum\SymfonyAnnotation::ROUTE), null, $items, 'path');
}
}

View File

@ -8,93 +8,160 @@ use PhpParser\Node\Stmt\Class_;
use PhpParser\Node\Stmt\ClassMethod;
use Rector\BetterPhpDocParser\ValueObject\PhpDoc\DoctrineAnnotation\CurlyListNode;
use Rector\Core\Rector\AbstractRector;
use Rector\Symfony\DataProvider\RouteMapProvider;
use Rector\Symfony\Contract\Bridge\Symfony\Routing\SymfonyRoutesProviderInterface;
use Rector\Symfony\Enum\SymfonyAnnotation;
use Rector\Symfony\PhpDocNode\SymfonyRouteTagValueNodeFactory;
use Rector\Symfony\ValueObject\SymfonyRouteMetadata;
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
/**
* @see \Rector\Symfony\Tests\Rector\ClassMethod\AddRouteAnnotationRector\AddRouteAnnotationRectorTest
*/
class AddRouteAnnotationRector extends \Rector\Core\Rector\AbstractRector
final class AddRouteAnnotationRector extends \Rector\Core\Rector\AbstractRector
{
/**
* @readonly
* @var \Rector\Symfony\DataProvider\RouteMapProvider
* @var \Rector\Symfony\Contract\Bridge\Symfony\Routing\SymfonyRoutesProviderInterface
*/
private $routeMapProvider;
private $symfonyRoutesProvider;
/**
* @readonly
* @var \Rector\Symfony\PhpDocNode\SymfonyRouteTagValueNodeFactory
*/
private $symfonyRouteTagValueNodeFactory;
public function __construct(\Rector\Symfony\DataProvider\RouteMapProvider $routeMapProvider, \Rector\Symfony\PhpDocNode\SymfonyRouteTagValueNodeFactory $symfonyRouteTagValueNodeFactory)
public function __construct(\Rector\Symfony\Contract\Bridge\Symfony\Routing\SymfonyRoutesProviderInterface $symfonyRoutesProvider, \Rector\Symfony\PhpDocNode\SymfonyRouteTagValueNodeFactory $symfonyRouteTagValueNodeFactory)
{
$this->routeMapProvider = $routeMapProvider;
$this->symfonyRoutesProvider = $symfonyRoutesProvider;
$this->symfonyRouteTagValueNodeFactory = $symfonyRouteTagValueNodeFactory;
}
public function getNodeTypes() : array
{
return [\PhpParser\Node\Stmt\ClassMethod::class];
}
/**
* @param ClassMethod $node
*/
public function refactor(\PhpParser\Node $node) : ?\PhpParser\Node
{
if (!$node instanceof \PhpParser\Node\Stmt\ClassMethod) {
// only public methods can be controller routes
if (!$node->isPublic()) {
return null;
}
$routeMap = $this->routeMapProvider->provide();
if (!$routeMap->hasRoutes()) {
if ($node->isStatic()) {
return null;
}
$class = $this->betterNodeFinder->findParentType($node, \PhpParser\Node\Stmt\Class_::class);
if (!$class instanceof \PhpParser\Node\Stmt\Class_) {
return null;
}
$className = $this->nodeNameResolver->getName($class);
$methodName = $this->nodeNameResolver->getName($node);
$fqcnAndMethodName = \sprintf('%s::%s', $className, $methodName);
$symfonyRouteMetadata = $routeMap->getRouteByMethod($fqcnAndMethodName);
if ($this->symfonyRoutesProvider->provide() === []) {
return null;
}
$controllerReference = $this->resolveControllerReference($class, $node);
// is there a route for this annotation?
$symfonyRouteMetadata = $this->matchSymfonyRouteMetadataByControllerReference($controllerReference);
if (!$symfonyRouteMetadata instanceof \Rector\Symfony\ValueObject\SymfonyRouteMetadata) {
return null;
}
$phpDocInfo = $this->phpDocInfoFactory->createFromNodeOrEmpty($node);
$doctrineAnnotationTagValueNode = $phpDocInfo->getByAnnotationClass('Symfony\\Component\\Routing\\Annotation\\Route');
$doctrineAnnotationTagValueNode = $phpDocInfo->getByAnnotationClass(\Rector\Symfony\Enum\SymfonyAnnotation::ROUTE);
if ($doctrineAnnotationTagValueNode !== null) {
return null;
}
$items = $this->createRouteItems($symfonyRouteMetadata);
$symfonyRouteTagValueNode = $this->symfonyRouteTagValueNodeFactory->createFromItems($items);
$phpDocInfo->addTagValueNode($symfonyRouteTagValueNode);
return $node;
}
public function getRuleDefinition() : \Symplify\RuleDocGenerator\ValueObject\RuleDefinition
{
return new \Symplify\RuleDocGenerator\ValueObject\RuleDefinition('Collect routes from Symfony project router and add Route annotation to controller action', [new \Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample(<<<'CODE_SAMPLE'
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
final class SomeController extends AbstractController
{
public function index()
{
}
}
CODE_SAMPLE
, <<<'CODE_SAMPLE'
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Routing\Annotation\Route;
final class SomeController extends AbstractController
{
/**
* @Route(name="homepage", path="/welcome")
*/
public function index()
{
}
}
CODE_SAMPLE
)]);
}
private function resolveControllerReference(\PhpParser\Node\Stmt\Class_ $class, \PhpParser\Node\Stmt\ClassMethod $classMethod) : string
{
$className = $this->nodeNameResolver->getName($class);
$methodName = $this->nodeNameResolver->getName($classMethod);
return $className . '::' . $methodName;
}
/**
* @param array<string, mixed> $defaults
*/
private function createDefaults(array $defaults) : \Rector\BetterPhpDocParser\ValueObject\PhpDoc\DoctrineAnnotation\CurlyListNode
{
return new \Rector\BetterPhpDocParser\ValueObject\PhpDoc\DoctrineAnnotation\CurlyListNode(\array_map(static function ($default) {
switch (\true) {
case \is_string($default):
return \sprintf('"%s"', $default);
default:
return $default;
}
}, $defaults));
}
/**
* @param string[] $items
*/
private function createCurlyListNodeFromItems(array $items) : \Rector\BetterPhpDocParser\ValueObject\PhpDoc\DoctrineAnnotation\CurlyListNode
{
$quotedItems = \array_map(static function (string $item) : string {
return \sprintf('"%s"', $item);
}, $items);
return new \Rector\BetterPhpDocParser\ValueObject\PhpDoc\DoctrineAnnotation\CurlyListNode($quotedItems);
}
/**
* @return array{path: string, name: string, defaults?: CurlyListNode, host?: string, methods?: CurlyListNode, condition?: string}
*/
private function createRouteItems(\Rector\Symfony\ValueObject\SymfonyRouteMetadata $symfonyRouteMetadata) : array
{
$items = ['path' => \sprintf('"%s"', $symfonyRouteMetadata->getPath()), 'name' => \sprintf('"%s"', $symfonyRouteMetadata->getName())];
$defaults = $symfonyRouteMetadata->getDefaults();
unset($defaults['_controller']);
if ($defaults !== []) {
$items['defaults'] = new \Rector\BetterPhpDocParser\ValueObject\PhpDoc\DoctrineAnnotation\CurlyListNode(\array_map(static function ($default) {
switch (\true) {
case \is_string($default):
return \sprintf('"%s"', $default);
default:
return $default;
}
}, $defaults));
$defaultsWithoutController = $symfonyRouteMetadata->getDefaultsWithoutController();
if ($defaultsWithoutController !== []) {
$items['defaults'] = $this->createDefaults($defaultsWithoutController);
}
if ($symfonyRouteMetadata->getHost() !== '') {
$items['host'] = \sprintf('"%s"', $symfonyRouteMetadata->getHost());
}
if ($symfonyRouteMetadata->getSchemes() !== []) {
$items['schemes'] = new \Rector\BetterPhpDocParser\ValueObject\PhpDoc\DoctrineAnnotation\CurlyListNode(\array_map(static function (string $scheme) : string {
return \sprintf('"%s"', $scheme);
}, $symfonyRouteMetadata->getSchemes()));
$items['schemes'] = $this->createCurlyListNodeFromItems($symfonyRouteMetadata->getSchemes());
}
if ($symfonyRouteMetadata->getMethods() !== []) {
$items['methods'] = new \Rector\BetterPhpDocParser\ValueObject\PhpDoc\DoctrineAnnotation\CurlyListNode(\array_map(static function (string $scheme) : string {
return \sprintf('"%s"', $scheme);
}, $symfonyRouteMetadata->getMethods()));
$items['methods'] = $this->createCurlyListNodeFromItems($symfonyRouteMetadata->getMethods());
}
if ($symfonyRouteMetadata->getCondition() !== '') {
$items['condition'] = \sprintf('"%s"', $symfonyRouteMetadata->getCondition());
}
$phpDocInfo->addTagValueNode($this->symfonyRouteTagValueNodeFactory->createFromItems($items));
return $node;
return $items;
}
public function getRuleDefinition() : \Symplify\RuleDocGenerator\ValueObject\RuleDefinition
private function matchSymfonyRouteMetadataByControllerReference(string $controllerReference) : ?\Rector\Symfony\ValueObject\SymfonyRouteMetadata
{
return new \Symplify\RuleDocGenerator\ValueObject\RuleDefinition('Add route annotation to controller action', []);
foreach ($this->symfonyRoutesProvider->provide() as $symfonyRouteMetadata) {
if ($symfonyRouteMetadata->getControllerReference() === $controllerReference) {
return $symfonyRouteMetadata;
}
}
return null;
}
}

View File

@ -11,6 +11,7 @@ use Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTagRemover;
use Rector\BetterPhpDocParser\Printer\PhpDocInfoPrinter;
use Rector\BetterPhpDocParser\ValueObject\PhpDoc\DoctrineAnnotation\CurlyListNode;
use Rector\Core\Rector\AbstractRector;
use Rector\Symfony\Enum\SymfonyAnnotation;
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
/**
@ -92,7 +93,7 @@ CODE_SAMPLE
if (!$sensioDoctrineAnnotationTagValueNode instanceof \Rector\BetterPhpDocParser\PhpDoc\DoctrineAnnotationTagValueNode) {
return null;
}
$symfonyDoctrineAnnotationTagValueNode = $phpDocInfo->getByAnnotationClass('Symfony\\Component\\Routing\\Annotation\\Route');
$symfonyDoctrineAnnotationTagValueNode = $phpDocInfo->getByAnnotationClass(\Rector\Symfony\Enum\SymfonyAnnotation::ROUTE);
if (!$symfonyDoctrineAnnotationTagValueNode instanceof \Rector\BetterPhpDocParser\PhpDoc\DoctrineAnnotationTagValueNode) {
return null;
}

View File

@ -10,6 +10,7 @@ use Rector\BetterPhpDocParser\PhpDoc\DoctrineAnnotationTagValueNode;
use Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTagRemover;
use Rector\Core\Configuration\RenamedClassesDataCollector;
use Rector\Core\Rector\AbstractRector;
use Rector\Symfony\Enum\SymfonyAnnotation;
use Rector\Symfony\PhpDocNode\SymfonyRouteTagValueNodeFactory;
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
@ -85,7 +86,7 @@ CODE_SAMPLE
public function refactor(\PhpParser\Node $node) : ?\PhpParser\Node
{
$phpDocInfo = $this->phpDocInfoFactory->createFromNodeOrEmpty($node);
if ($phpDocInfo->hasByAnnotationClass('Symfony\\Component\\Routing\\Annotation\\Route')) {
if ($phpDocInfo->hasByAnnotationClass(\Rector\Symfony\Enum\SymfonyAnnotation::ROUTE)) {
return null;
}
$doctrineAnnotationTagValueNode = $phpDocInfo->getByAnnotationClass('Sensio\\Bundle\\FrameworkExtraBundle\\Configuration\\Route');

View File

@ -8,6 +8,7 @@ use PhpParser\Node\Name\FullyQualified;
use PhpParser\Node\Stmt\ClassMethod;
use Rector\Core\Rector\AbstractRector;
use Rector\Doctrine\NodeAnalyzer\AttrinationFinder;
use Rector\Symfony\Enum\SymfonyAnnotation;
use Rector\Symfony\TypeAnalyzer\ControllerAnalyzer;
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
@ -83,7 +84,7 @@ CODE_SAMPLE
if ($node->returnType !== null) {
return null;
}
if (!$this->attrinationFinder->hasByOne($node, 'Symfony\\Component\\Routing\\Annotation\\Route')) {
if (!$this->attrinationFinder->hasByOne($node, \Rector\Symfony\Enum\SymfonyAnnotation::ROUTE)) {
return null;
}
$node->returnType = new \PhpParser\Node\Name\FullyQualified('Symfony\\Component\\HttpFoundation\\Response');

View File

@ -1,34 +0,0 @@
<?php
declare (strict_types=1);
namespace Rector\Symfony\ValueObject\RouteMap;
use Rector\Symfony\ValueObject\SymfonyRouteMetadata;
final class RouteMap
{
/**
* @var SymfonyRouteMetadata[]
* @readonly
*/
private $routes;
/**
* @param SymfonyRouteMetadata[] $routes
*/
public function __construct(array $routes)
{
$this->routes = $routes;
}
public function hasRoutes() : bool
{
return $this->routes !== [];
}
public function getRouteByMethod(string $methodName) : ?\Rector\Symfony\ValueObject\SymfonyRouteMetadata
{
foreach ($this->routes as $route) {
if ($route->getDefault('_controller') === $methodName) {
return $route;
}
}
return null;
}
}

View File

@ -5,6 +5,12 @@ namespace Rector\Symfony\ValueObject;
class SymfonyRouteMetadata
{
/**
* Format <class>::<method>
* @readonly
* @var string
*/
private $controllerReference;
/**
* @readonly
* @var string
@ -16,42 +22,42 @@ class SymfonyRouteMetadata
*/
private $path;
/**
* @var mixed[]
* @var array<string, mixed>
* @readonly
*/
private $defaults = [];
private $defaults;
/**
* @var string[]
* @var array<string, mixed>
* @readonly
*/
private $requirements = [];
private $requirements;
/**
* @readonly
* @var string
*/
private $host = '';
private $host;
/**
* @var string[]
* @readonly
*/
private $schemes = [];
private $schemes;
/**
* @var string[]
* @readonly
*/
private $methods = [];
private $methods;
/**
* @readonly
* @var string
*/
private $condition = '';
private $condition;
/**
* @param mixed[] $defaults
* @param string[] $requirements
* @param string[] $schemes
* @param string[] $methods
* @param array<string, mixed> $defaults
* @param array<string, mixed> $requirements
* @param string[] $schemes
* @param string[] $methods
*/
public function __construct(string $name, string $path, array $defaults = [], array $requirements = [], string $host = '', array $schemes = [], array $methods = [], string $condition = '')
public function __construct(string $name, string $path, array $defaults, array $requirements, string $host, array $schemes, array $methods, string $condition)
{
$this->name = $name;
$this->path = $path;
@ -61,6 +67,7 @@ class SymfonyRouteMetadata
$this->schemes = $schemes;
$this->methods = $methods;
$this->condition = $condition;
$this->controllerReference = $defaults['_controller'];
}
public function getName() : string
{
@ -71,12 +78,21 @@ class SymfonyRouteMetadata
return $this->path;
}
/**
* @return mixed[]
* @return array<string, mixed>
*/
public function getDefaults() : array
{
return $this->defaults;
}
/**
* @return array<string, mixed>
*/
public function getDefaultsWithoutController() : array
{
$defaults = $this->defaults;
unset($defaults['_controller']);
return $defaults;
}
/**
* @return mixed
*/
@ -85,7 +101,7 @@ class SymfonyRouteMetadata
return $this->defaults[$name] ?? null;
}
/**
* @return string[]
* @return array<string, mixed>
*/
public function getRequirements() : array
{
@ -113,4 +129,11 @@ class SymfonyRouteMetadata
{
return $this->condition;
}
/**
* Format <class>::<method>
*/
public function getControllerReference() : string
{
return $this->controllerReference;
}
}

View File

@ -1,39 +0,0 @@
<?php
declare (strict_types=1);
namespace Rector\Symfony\ValueObjectFactory;
use Rector\Symfony\Exception\JsonRoutesNotExistsException;
use Rector\Symfony\ValueObject\RouteMap\RouteMap;
use Rector\Symfony\ValueObject\SymfonyRouteMetadata;
use RectorPrefix20220522\Symplify\SmartFileSystem\SmartFileSystem;
final class RouteMapFactory
{
/**
* @readonly
* @var \Symplify\SmartFileSystem\SmartFileSystem
*/
private $smartFileSystem;
public function __construct(\RectorPrefix20220522\Symplify\SmartFileSystem\SmartFileSystem $smartFileSystem)
{
$this->smartFileSystem = $smartFileSystem;
}
public function createFromFileContent(string $configFilePath) : \Rector\Symfony\ValueObject\RouteMap\RouteMap
{
$fileContents = $this->smartFileSystem->readFile($configFilePath);
$json = \json_decode($fileContents, \true, 512, 0);
if ($json === \false) {
throw new \Rector\Symfony\Exception\JsonRoutesNotExistsException(\sprintf('Routes "%s" cannot be parsed', $configFilePath));
}
/** @var SymfonyRouteMetadata[] $routes */
$routes = [];
foreach ($json as $name => $def) {
$routes[$name] = new \Rector\Symfony\ValueObject\SymfonyRouteMetadata($name, $def['path'], $def['defaults'], $def['requirements'], $def['host'], $def['schemes'], $def['methods'], $def['condition']);
}
return new \Rector\Symfony\ValueObject\RouteMap\RouteMap($routes);
}
public function createEmpty() : \Rector\Symfony\ValueObject\RouteMap\RouteMap
{
return new \Rector\Symfony\ValueObject\RouteMap\RouteMap([]);
}
}

View File

@ -9,8 +9,8 @@ $loader = require_once __DIR__.'/autoload.php';
if (!class_exists('AutoloadIncluder', false) && !interface_exists('AutoloadIncluder', false) && !trait_exists('AutoloadIncluder', false)) {
spl_autoload_call('RectorPrefix20220522\AutoloadIncluder');
}
if (!class_exists('ComposerAutoloaderInit9782dd56f9fe1f00f0b4d3f701f55955', false) && !interface_exists('ComposerAutoloaderInit9782dd56f9fe1f00f0b4d3f701f55955', false) && !trait_exists('ComposerAutoloaderInit9782dd56f9fe1f00f0b4d3f701f55955', false)) {
spl_autoload_call('RectorPrefix20220522\ComposerAutoloaderInit9782dd56f9fe1f00f0b4d3f701f55955');
if (!class_exists('ComposerAutoloaderInit05cb8895e1954651c31b14af1c80af2a', false) && !interface_exists('ComposerAutoloaderInit05cb8895e1954651c31b14af1c80af2a', false) && !trait_exists('ComposerAutoloaderInit05cb8895e1954651c31b14af1c80af2a', false)) {
spl_autoload_call('RectorPrefix20220522\ComposerAutoloaderInit05cb8895e1954651c31b14af1c80af2a');
}
if (!class_exists('Helmich\TypoScriptParser\Parser\AST\Statement', false) && !interface_exists('Helmich\TypoScriptParser\Parser\AST\Statement', false) && !trait_exists('Helmich\TypoScriptParser\Parser\AST\Statement', false)) {
spl_autoload_call('RectorPrefix20220522\Helmich\TypoScriptParser\Parser\AST\Statement');
@ -59,9 +59,9 @@ if (!function_exists('print_node')) {
return \RectorPrefix20220522\print_node(...func_get_args());
}
}
if (!function_exists('composerRequire9782dd56f9fe1f00f0b4d3f701f55955')) {
function composerRequire9782dd56f9fe1f00f0b4d3f701f55955() {
return \RectorPrefix20220522\composerRequire9782dd56f9fe1f00f0b4d3f701f55955(...func_get_args());
if (!function_exists('composerRequire05cb8895e1954651c31b14af1c80af2a')) {
function composerRequire05cb8895e1954651c31b14af1c80af2a() {
return \RectorPrefix20220522\composerRequire05cb8895e1954651c31b14af1c80af2a(...func_get_args());
}
}
if (!function_exists('scanPath')) {

View File

@ -666,7 +666,7 @@ use Rector\Config\RectorConfig;
use Ssch\TYPO3Rector\Rector\General\ExtEmConfRector;
return static function (RectorConfig $rectorConfig): void {
$rectorConfig->ruleWithConfiguration(ExtEmConfRector::class, [Ssch\TYPO3Rector\Rector\General\ExtEmConfRector::ADDITIONAL_VALUES_TO_BE_REMOVED: ['createDirs', 'uploadfolder']]);
$rectorConfig->ruleWithConfiguration(ExtEmConfRector::class, [ExtEmConfRector::ADDITIONAL_VALUES_TO_BE_REMOVED => ['createDirs', 'uploadfolder']]);
};
```
@ -791,7 +791,7 @@ use Rector\Config\RectorConfig;
use Ssch\TYPO3Rector\FileProcessor\TypoScript\Rector\ExtbasePersistenceTypoScriptRector;
return static function (RectorConfig $rectorConfig): void {
$rectorConfig->ruleWithConfiguration(ExtbasePersistenceTypoScriptRector::class, [Ssch\TYPO3Rector\FileProcessor\TypoScript\Rector\ExtbasePersistenceTypoScriptRector::FILENAME: 'path/to/Configuration/Extbase/Persistence/Classes.php']);
$rectorConfig->ruleWithConfiguration(ExtbasePersistenceTypoScriptRector::class, [ExtbasePersistenceTypoScriptRector::FILENAME => 'path/to/Configuration/Extbase/Persistence/Classes.php']);
};
```
@ -831,7 +831,7 @@ use Rector\Config\RectorConfig;
use Ssch\TYPO3Rector\FileProcessor\Composer\Rector\ExtensionComposerRector;
return static function (RectorConfig $rectorConfig): void {
$rectorConfig->ruleWithConfiguration(ExtensionComposerRector::class, [Ssch\TYPO3Rector\FileProcessor\Composer\Rector\ExtensionComposerRector::TYPO3_VERSION_CONSTRAINT: '^10.4']);
$rectorConfig->ruleWithConfiguration(ExtensionComposerRector::class, [ExtensionComposerRector::TYPO3_VERSION_CONSTRAINT => '^10.4']);
};
```
@ -1314,7 +1314,7 @@ use Rector\Config\RectorConfig;
use Ssch\TYPO3Rector\Rector\General\MethodGetInstanceToMakeInstanceCallRector;
return static function (RectorConfig $rectorConfig): void {
$rectorConfig->ruleWithConfiguration(MethodGetInstanceToMakeInstanceCallRector::class, [Ssch\TYPO3Rector\Rector\General\MethodGetInstanceToMakeInstanceCallRector::CLASSES_GET_INSTANCE_TO_MAKE_INSTANCE: ['SomeClass']]);
$rectorConfig->ruleWithConfiguration(MethodGetInstanceToMakeInstanceCallRector::class, [MethodGetInstanceToMakeInstanceCallRector::CLASSES_GET_INSTANCE_TO_MAKE_INSTANCE => ['SomeClass']]);
};
```
@ -2545,7 +2545,7 @@ use Rector\Config\RectorConfig;
use Ssch\TYPO3Rector\FileProcessor\Composer\Rector\RemoveCmsPackageDirFromExtraComposerRector;
return static function (RectorConfig $rectorConfig): void {
$rectorConfig->ruleWithConfiguration(RemoveCmsPackageDirFromExtraComposerRector::class, [not_allowed: 'not_available']);
$rectorConfig->ruleWithConfiguration(RemoveCmsPackageDirFromExtraComposerRector::class, ['not_allowed' => 'not_available']);
};
```
@ -3310,7 +3310,7 @@ use Rector\Config\RectorConfig;
use Ssch\TYPO3Rector\Rector\Migrations\RenameClassMapAliasRector;
return static function (RectorConfig $rectorConfig): void {
$rectorConfig->ruleWithConfiguration(RenameClassMapAliasRector::class, [Ssch\TYPO3Rector\Rector\Migrations\RenameClassMapAliasRector::CLASS_ALIAS_MAPS: 'config/Migrations/Code/ClassAliasMap.php']);
$rectorConfig->ruleWithConfiguration(RenameClassMapAliasRector::class, [RenameClassMapAliasRector::CLASS_ALIAS_MAPS => 'config/Migrations/Code/ClassAliasMap.php']);
};
```
@ -3410,7 +3410,7 @@ use Rector\Config\RectorConfig;
use Ssch\TYPO3Rector\Rector\v9\v0\ReplaceAnnotationRector;
return static function (RectorConfig $rectorConfig): void {
$rectorConfig->ruleWithConfiguration(ReplaceAnnotationRector::class, [Ssch\TYPO3Rector\Rector\v9\v0\ReplaceAnnotationRector::OLD_TO_NEW_ANNOTATIONS: ['transient' => 'TYPO3\CMS\Extbase\Annotation\ORM\Transient']]);
$rectorConfig->ruleWithConfiguration(ReplaceAnnotationRector::class, [ReplaceAnnotationRector::OLD_TO_NEW_ANNOTATIONS => ['transient' => 'TYPO3\CMS\Extbase\Annotation\ORM\Transient']]);
};
```
@ -3922,7 +3922,7 @@ use Rector\Config\RectorConfig;
use Ssch\TYPO3Rector\Rector\v8\v4\SubstituteOldWizardIconsRector;
return static function (RectorConfig $rectorConfig): void {
$rectorConfig->ruleWithConfiguration(SubstituteOldWizardIconsRector::class, [Ssch\TYPO3Rector\Rector\v8\v4\SubstituteOldWizardIconsRector::OLD_TO_NEW_FILE_LOCATIONS: ['add.gif' => 'EXT:backend/Resources/Public/Images/FormFieldWizard/wizard_add.gif']]);
$rectorConfig->ruleWithConfiguration(SubstituteOldWizardIconsRector::class, [SubstituteOldWizardIconsRector::OLD_TO_NEW_FILE_LOCATIONS => ['add.gif' => 'EXT:backend/Resources/Public/Images/FormFieldWizard/wizard_add.gif']]);
};
```

View File

@ -12,7 +12,7 @@
# Contributing
Want to help? Great!
Joing TYPO3 slack channel #ext-typo3-rector
Joing TYPO3 slack channel [#ext-typo3-rector](https://typo3.slack.com/archives/C019R5LAA6A)
## Fork the project