Updated Rector to commit c20f2301fe

c20f2301fe Add RectorConfigurator for custom configuration methods and avoid conflicts with Symfony API (#2019)
This commit is contained in:
Tomas Votruba 2022-04-08 18:51:16 +00:00
parent 300f7da027
commit a4d2113720
11 changed files with 58 additions and 21 deletions

View File

@ -12,6 +12,7 @@ return static function (\Symfony\Component\DependencyInjection\Loader\Configurat
$services = $containerConfigurator->services();
$services->defaults()->public()->autowire()->autoconfigure();
$services->load('Rector\\', __DIR__ . '/../packages')->exclude([
__DIR__ . '/../packages/Config/RectorConfig.php',
__DIR__ . '/../packages/*/{ValueObject,Contract,Exception}',
__DIR__ . '/../packages/BetterPhpDocParser/PhpDocInfo/PhpDocInfo.php',
__DIR__ . '/../packages/Testing/PHPUnit',

View File

@ -0,0 +1,25 @@
<?php
declare (strict_types=1);
namespace Rector\Config;
use Rector\Core\Configuration\Option;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use RectorPrefix20220408\Webmozart\Assert\Assert;
/**
* @api
* Same as Symfony container configurator, with patched return type for "set()" method for easier DX.
* It is an alias for internal class that is prefixed during build, so it's basically for keeping stable public API.
*/
final class RectorConfig extends \Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator
{
/**
* @param mixed[] $paths
*/
public function paths(array $paths) : void
{
\RectorPrefix20220408\Webmozart\Assert\Assert::allString($paths);
$parameters = $this->parameters();
$parameters->set(\Rector\Core\Configuration\Option::PATHS, $paths);
}
}

View File

@ -16,11 +16,11 @@ final class VersionResolver
/**
* @var string
*/
public const PACKAGE_VERSION = '4b351a730638cdf31f97dc02ca708f096582d604';
public const PACKAGE_VERSION = 'c20f2301fed6db0579b554b49543fb64c3fd6571';
/**
* @var string
*/
public const RELEASE_DATE = '2022-04-08 20:37:03';
public const RELEASE_DATE = '2022-04-08 18:45:24';
public static function resolvePackageVersion() : string
{
$process = new \RectorPrefix20220408\Symfony\Component\Process\Process(['git', 'log', '--pretty="%H"', '-n1', 'HEAD'], __DIR__);

2
vendor/autoload.php vendored
View File

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

View File

@ -1626,6 +1626,7 @@ return array(
'Rector\\Composer\\ValueObject\\PackageAndVersion' => $baseDir . '/rules/Composer/ValueObject/PackageAndVersion.php',
'Rector\\Composer\\ValueObject\\RenamePackage' => $baseDir . '/rules/Composer/ValueObject/RenamePackage.php',
'Rector\\Composer\\ValueObject\\ReplacePackageAndVersion' => $baseDir . '/rules/Composer/ValueObject/ReplacePackageAndVersion.php',
'Rector\\Config\\RectorConfig' => $baseDir . '/packages/Config/RectorConfig.php',
'Rector\\Core\\Application\\ApplicationFileProcessor' => $baseDir . '/src/Application/ApplicationFileProcessor.php',
'Rector\\Core\\Application\\FileDecorator\\FileDiffFileDecorator' => $baseDir . '/src/Application/FileDecorator/FileDiffFileDecorator.php',
'Rector\\Core\\Application\\FileProcessor' => $baseDir . '/src/Application/FileProcessor.php',

View File

@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer
class ComposerAutoloaderInit21621f5fe4832595cc19d66ad00b7ce6
class ComposerAutoloaderInit88679d01279310d808ac9e8c8bf46f84
{
private static $loader;
@ -22,19 +22,19 @@ class ComposerAutoloaderInit21621f5fe4832595cc19d66ad00b7ce6
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInit21621f5fe4832595cc19d66ad00b7ce6', 'loadClassLoader'), true, true);
spl_autoload_register(array('ComposerAutoloaderInit88679d01279310d808ac9e8c8bf46f84', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
spl_autoload_unregister(array('ComposerAutoloaderInit21621f5fe4832595cc19d66ad00b7ce6', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInit88679d01279310d808ac9e8c8bf46f84', 'loadClassLoader'));
require __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInit21621f5fe4832595cc19d66ad00b7ce6::getInitializer($loader));
call_user_func(\Composer\Autoload\ComposerStaticInit88679d01279310d808ac9e8c8bf46f84::getInitializer($loader));
$loader->setClassMapAuthoritative(true);
$loader->register(true);
$includeFiles = \Composer\Autoload\ComposerStaticInit21621f5fe4832595cc19d66ad00b7ce6::$files;
$includeFiles = \Composer\Autoload\ComposerStaticInit88679d01279310d808ac9e8c8bf46f84::$files;
foreach ($includeFiles as $fileIdentifier => $file) {
composerRequire21621f5fe4832595cc19d66ad00b7ce6($fileIdentifier, $file);
composerRequire88679d01279310d808ac9e8c8bf46f84($fileIdentifier, $file);
}
return $loader;
@ -46,7 +46,7 @@ class ComposerAutoloaderInit21621f5fe4832595cc19d66ad00b7ce6
* @param string $file
* @return void
*/
function composerRequire21621f5fe4832595cc19d66ad00b7ce6($fileIdentifier, $file)
function composerRequire88679d01279310d808ac9e8c8bf46f84($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 ComposerStaticInit21621f5fe4832595cc19d66ad00b7ce6
class ComposerStaticInit88679d01279310d808ac9e8c8bf46f84
{
public static $files = array (
'320cde22f66dd4f5d3fd621d3e88b98f' => __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php',
@ -1995,6 +1995,7 @@ class ComposerStaticInit21621f5fe4832595cc19d66ad00b7ce6
'Rector\\Composer\\ValueObject\\PackageAndVersion' => __DIR__ . '/../..' . '/rules/Composer/ValueObject/PackageAndVersion.php',
'Rector\\Composer\\ValueObject\\RenamePackage' => __DIR__ . '/../..' . '/rules/Composer/ValueObject/RenamePackage.php',
'Rector\\Composer\\ValueObject\\ReplacePackageAndVersion' => __DIR__ . '/../..' . '/rules/Composer/ValueObject/ReplacePackageAndVersion.php',
'Rector\\Config\\RectorConfig' => __DIR__ . '/../..' . '/packages/Config/RectorConfig.php',
'Rector\\Core\\Application\\ApplicationFileProcessor' => __DIR__ . '/../..' . '/src/Application/ApplicationFileProcessor.php',
'Rector\\Core\\Application\\FileDecorator\\FileDiffFileDecorator' => __DIR__ . '/../..' . '/src/Application/FileDecorator/FileDiffFileDecorator.php',
'Rector\\Core\\Application\\FileProcessor' => __DIR__ . '/../..' . '/src/Application/FileProcessor.php',
@ -3850,9 +3851,9 @@ class ComposerStaticInit21621f5fe4832595cc19d66ad00b7ce6
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInit21621f5fe4832595cc19d66ad00b7ce6::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit21621f5fe4832595cc19d66ad00b7ce6::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit21621f5fe4832595cc19d66ad00b7ce6::$classMap;
$loader->prefixLengthsPsr4 = ComposerStaticInit88679d01279310d808ac9e8c8bf46f84::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit88679d01279310d808ac9e8c8bf46f84::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit88679d01279310d808ac9e8c8bf46f84::$classMap;
}, null, ClassLoader::class);
}

View File

@ -3182,7 +3182,8 @@
"type": "library",
"extra": {
"patches_applied": [
"https:\/\/raw.githubusercontent.com\/rectorphp\/vendor-patches\/main\/patches\/symfony-dependency-injection.patch"
"https:\/\/raw.githubusercontent.com\/rectorphp\/vendor-patches\/main\/patches\/symfony-dependency-injection.patch",
"https:\/\/raw.githubusercontent.com\/rectorphp\/vendor-patches\/main\/patches\/symfony-php-config-loader.patch"
]
},
"installation-source": "dist",

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('RectorPrefix20220408\AutoloadIncluder');
}
if (!class_exists('ComposerAutoloaderInit21621f5fe4832595cc19d66ad00b7ce6', false) && !interface_exists('ComposerAutoloaderInit21621f5fe4832595cc19d66ad00b7ce6', false) && !trait_exists('ComposerAutoloaderInit21621f5fe4832595cc19d66ad00b7ce6', false)) {
spl_autoload_call('RectorPrefix20220408\ComposerAutoloaderInit21621f5fe4832595cc19d66ad00b7ce6');
if (!class_exists('ComposerAutoloaderInit88679d01279310d808ac9e8c8bf46f84', false) && !interface_exists('ComposerAutoloaderInit88679d01279310d808ac9e8c8bf46f84', false) && !trait_exists('ComposerAutoloaderInit88679d01279310d808ac9e8c8bf46f84', false)) {
spl_autoload_call('RectorPrefix20220408\ComposerAutoloaderInit88679d01279310d808ac9e8c8bf46f84');
}
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('RectorPrefix20220408\Helmich\TypoScriptParser\Parser\AST\Statement');
@ -59,9 +59,9 @@ if (!function_exists('print_node')) {
return \RectorPrefix20220408\print_node(...func_get_args());
}
}
if (!function_exists('composerRequire21621f5fe4832595cc19d66ad00b7ce6')) {
function composerRequire21621f5fe4832595cc19d66ad00b7ce6() {
return \RectorPrefix20220408\composerRequire21621f5fe4832595cc19d66ad00b7ce6(...func_get_args());
if (!function_exists('composerRequire88679d01279310d808ac9e8c8bf46f84')) {
function composerRequire88679d01279310d808ac9e8c8bf46f84() {
return \RectorPrefix20220408\composerRequire88679d01279310d808ac9e8c8bf46f84(...func_get_args());
}
}
if (!function_exists('scanPath')) {

View File

@ -10,6 +10,7 @@
*/
namespace RectorPrefix20220408\Symfony\Component\DependencyInjection\Loader;
use Rector\Config\RectorConfig;
use RectorPrefix20220408\Symfony\Component\Config\Builder\ConfigBuilderGenerator;
use RectorPrefix20220408\Symfony\Component\Config\Builder\ConfigBuilderGeneratorInterface;
use RectorPrefix20220408\Symfony\Component\Config\Builder\ConfigBuilderInterface;
@ -58,7 +59,7 @@ class PhpFileLoader extends \RectorPrefix20220408\Symfony\Component\DependencyIn
try {
$callback = $load($path, $this->env);
if (\is_object($callback) && \is_callable($callback)) {
$this->executeCallback($callback, new \Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator($this->container, $this, $this->instanceof, $path, $resource, $this->env), $path);
$this->executeCallback($callback, new \Rector\Config\RectorConfig($this->container, $this, $this->instanceof, $path, $resource, $this->env), $path);
}
} finally {
$this->instanceof = [];
@ -108,6 +109,9 @@ class PhpFileLoader extends \RectorPrefix20220408\Symfony\Component\DependencyIn
}
$type = $reflectionType->getName();
switch ($type) {
case \Rector\Config\RectorConfig::class:
$arguments[] = $containerConfigurator;
break;
case \Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator::class:
$arguments[] = $containerConfigurator;
break;

View File

@ -5,3 +5,7 @@ Patches applied to this directory:
Source: https://raw.githubusercontent.com/rectorphp/vendor-patches/main/patches/symfony-dependency-injection.patch
1
Source: https://raw.githubusercontent.com/rectorphp/vendor-patches/main/patches/symfony-php-config-loader.patch