Updated Rector to commit 1e4568bdae763335c904ecd3d03a79f1ac129d0f

1e4568bdae Avoid removing use with removeNode() in ClassRenamer (#4039)
This commit is contained in:
Tomas Votruba 2023-06-01 16:05:57 +00:00
parent 6bffa5fbeb
commit ed61663929
7 changed files with 54 additions and 40 deletions

2
vendor/autoload.php vendored
View File

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

View File

@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer
class ComposerAutoloaderInit9ff0455b7a0c828b2abbeec0f7806d6c
class ComposerAutoloaderInite64ea2605e4cf1002a60a3421b5e8329
{
private static $loader;
@ -22,17 +22,17 @@ class ComposerAutoloaderInit9ff0455b7a0c828b2abbeec0f7806d6c
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInit9ff0455b7a0c828b2abbeec0f7806d6c', 'loadClassLoader'), true, true);
spl_autoload_register(array('ComposerAutoloaderInite64ea2605e4cf1002a60a3421b5e8329', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
spl_autoload_unregister(array('ComposerAutoloaderInit9ff0455b7a0c828b2abbeec0f7806d6c', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInite64ea2605e4cf1002a60a3421b5e8329', 'loadClassLoader'));
require __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInit9ff0455b7a0c828b2abbeec0f7806d6c::getInitializer($loader));
call_user_func(\Composer\Autoload\ComposerStaticInite64ea2605e4cf1002a60a3421b5e8329::getInitializer($loader));
$loader->setClassMapAuthoritative(true);
$loader->register(true);
$filesToLoad = \Composer\Autoload\ComposerStaticInit9ff0455b7a0c828b2abbeec0f7806d6c::$files;
$filesToLoad = \Composer\Autoload\ComposerStaticInite64ea2605e4cf1002a60a3421b5e8329::$files;
$requireFile = \Closure::bind(static function ($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 ComposerStaticInit9ff0455b7a0c828b2abbeec0f7806d6c
class ComposerStaticInite64ea2605e4cf1002a60a3421b5e8329
{
public static $files = array (
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
@ -3061,9 +3061,9 @@ class ComposerStaticInit9ff0455b7a0c828b2abbeec0f7806d6c
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInit9ff0455b7a0c828b2abbeec0f7806d6c::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit9ff0455b7a0c828b2abbeec0f7806d6c::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit9ff0455b7a0c828b2abbeec0f7806d6c::$classMap;
$loader->prefixLengthsPsr4 = ComposerStaticInite64ea2605e4cf1002a60a3421b5e8329::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInite64ea2605e4cf1002a60a3421b5e8329::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInite64ea2605e4cf1002a60a3421b5e8329::$classMap;
}, null, ClassLoader::class);
}

View File

@ -2059,12 +2059,12 @@
"source": {
"type": "git",
"url": "https:\/\/github.com\/rectorphp\/rector-symfony.git",
"reference": "05fc11280e551d6efd19ead3bec0231a322d6877"
"reference": "fbd87013a48448fbc21df3c5f7fca49b2046ba40"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-symfony\/zipball\/05fc11280e551d6efd19ead3bec0231a322d6877",
"reference": "05fc11280e551d6efd19ead3bec0231a322d6877",
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-symfony\/zipball\/fbd87013a48448fbc21df3c5f7fca49b2046ba40",
"reference": "fbd87013a48448fbc21df3c5f7fca49b2046ba40",
"shasum": ""
},
"require": {
@ -2094,7 +2094,7 @@
"tomasvotruba\/type-coverage": "^0.0.9",
"tomasvotruba\/unused-public": "^0.0.34"
},
"time": "2023-06-01T15:50:46+00:00",
"time": "2023-06-01T16:00:18+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-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 7f0656f'), 'rector/rector-downgrade-php' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-downgrade-php', 'relative_install_path' => '../../rector-downgrade-php', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 60db9b4'), '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 e276dee'), '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 05fc112'));
public const EXTENSIONS = array('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 7f0656f'), 'rector/rector-downgrade-php' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-downgrade-php', 'relative_install_path' => '../../rector-downgrade-php', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 60db9b4'), '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 e276dee'), '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 fbd8701'));
private function __construct()
{
}

View File

@ -142,45 +142,48 @@ CODE_SAMPLE
}
private function resolveDefaultName(Class_ $class) : ?string
{
$defaultName = null;
$property = $class->getProperty('defaultName');
// Get DefaultName from property
if ($property instanceof Property) {
$defaultName = $this->getValueFromProperty($property);
foreach ($class->stmts as $key => $stmt) {
if (!$stmt instanceof Property) {
continue;
}
if (!$this->isName($stmt->props[0], 'defaultName')) {
continue;
}
$defaultName = $this->getValueFromProperty($stmt);
if ($defaultName !== null) {
$this->removeNode($property);
// remove property
unset($class->stmts[$key]);
return $defaultName;
}
}
// Get DefaultName from attribute
if ($defaultName === null && $this->phpAttributeAnalyzer->hasPhpAttribute($class, SymfonyAnnotation::AS_COMMAND)) {
$defaultNameFromArgument = $this->attributeValueResolver->getArgumentValueFromAttribute($class, 0);
if (\is_string($defaultNameFromArgument)) {
$defaultName = $defaultNameFromArgument;
}
}
return $defaultName;
return $this->defaultDefaultNameFromAttribute($class);
}
private function resolveDefaultDescription(Class_ $class) : ?string
{
$defaultDescription = null;
$property = $class->getProperty('defaultDescription');
if ($property instanceof Property) {
$defaultDescription = $this->getValueFromProperty($property);
foreach ($class->stmts as $key => $stmt) {
if (!$stmt instanceof Property) {
continue;
}
if (!$this->isName($stmt, 'defaultDescription')) {
continue;
}
$defaultDescription = $this->getValueFromProperty($stmt);
if ($defaultDescription !== null) {
$this->removeNode($property);
unset($class->stmts[$key]);
return $defaultDescription;
}
}
return $this->resolveDefaultDescriptionFromAttribute($class, $defaultDescription);
return $this->resolveDefaultDescriptionFromAttribute($class);
}
private function resolveDefaultDescriptionFromAttribute(Class_ $class, ?string $defaultDescription) : ?string
private function resolveDefaultDescriptionFromAttribute(Class_ $class) : ?string
{
if ($defaultDescription === null && $this->phpAttributeAnalyzer->hasPhpAttribute($class, SymfonyAnnotation::AS_COMMAND)) {
if ($this->phpAttributeAnalyzer->hasPhpAttribute($class, SymfonyAnnotation::AS_COMMAND)) {
$defaultDescriptionFromArgument = $this->attributeValueResolver->getArgumentValueFromAttribute($class, 1);
if (\is_string($defaultDescriptionFromArgument)) {
$defaultDescription = $defaultDescriptionFromArgument;
return $defaultDescriptionFromArgument;
}
}
return $defaultDescription;
return null;
}
private function replaceAsCommandAttribute(Class_ $class, AttributeGroup $createAttributeGroup) : ?Class_
{
@ -224,4 +227,15 @@ CODE_SAMPLE
}
return $replacedAsCommandAttribute;
}
private function defaultDefaultNameFromAttribute(Class_ $class) : ?string
{
if (!$this->phpAttributeAnalyzer->hasPhpAttribute($class, SymfonyAnnotation::AS_COMMAND)) {
return null;
}
$defaultNameFromArgument = $this->attributeValueResolver->getArgumentValueFromAttribute($class, 0);
if (\is_string($defaultNameFromArgument)) {
return $defaultNameFromArgument;
}
return null;
}
}