Updated Rector to commit 2acb78be7361011f47c301344d8bb8ef4aa0e33d

2acb78be73 [Php55] Handle crash on direct $ without double quote backreference on PregReplaceEModifierRector (#3369)
This commit is contained in:
Tomas Votruba 2023-02-10 11:47:52 +00:00
parent d5ab1e22cf
commit 9e70c63b46
8 changed files with 54 additions and 28 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 ComposerAutoloaderInitf3a2ba2283550e1e575cb90e0f981844::getLoader();
return ComposerAutoloaderInita04906d2ddedaf048415885332bccfe8::getLoader();

View File

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

View File

@ -1915,12 +1915,12 @@
"source": {
"type": "git",
"url": "https:\/\/github.com\/rectorphp\/rector-downgrade-php.git",
"reference": "b9bfc7810187570f97d68ee3e51881952cc887d5"
"reference": "d56ebeb0251b0b5bce039babe09ac27e6c049d7d"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-downgrade-php\/zipball\/b9bfc7810187570f97d68ee3e51881952cc887d5",
"reference": "b9bfc7810187570f97d68ee3e51881952cc887d5",
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-downgrade-php\/zipball\/d56ebeb0251b0b5bce039babe09ac27e6c049d7d",
"reference": "d56ebeb0251b0b5bce039babe09ac27e6c049d7d",
"shasum": ""
},
"require": {
@ -1944,7 +1944,7 @@
"tomasvotruba\/type-coverage": "^0.0.9",
"tomasvotruba\/unused-public": "^0.0.34"
},
"time": "2023-02-08T14:55:55+00:00",
"time": "2023-02-09T15:28:43+00:00",
"default-branch": true,
"type": "rector-extension",
"extra": {
@ -1982,12 +1982,12 @@
"source": {
"type": "git",
"url": "https:\/\/github.com\/rectorphp\/rector-phpunit.git",
"reference": "ee461b14551189faca960058ef4fb1146755f8ca"
"reference": "d974dcc702dfdba514fe181941f2ee3a4621fe75"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-phpunit\/zipball\/ee461b14551189faca960058ef4fb1146755f8ca",
"reference": "ee461b14551189faca960058ef4fb1146755f8ca",
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-phpunit\/zipball\/d974dcc702dfdba514fe181941f2ee3a4621fe75",
"reference": "d974dcc702dfdba514fe181941f2ee3a4621fe75",
"shasum": ""
},
"require": {
@ -2016,7 +2016,7 @@
"tomasvotruba\/type-coverage": "^0.0.9",
"tomasvotruba\/unused-public": "^0.0.34"
},
"time": "2023-02-07T15:19:06+00:00",
"time": "2023-02-10T11:42:21+00:00",
"default-branch": true,
"type": "rector-extension",
"extra": {
@ -2054,12 +2054,12 @@
"source": {
"type": "git",
"url": "https:\/\/github.com\/rectorphp\/rector-symfony.git",
"reference": "3fdae28ba7476ede383a035b8e4af4bc18d40a38"
"reference": "1b148e3c47d22b8704ea11a8cee08b42f3215f67"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-symfony\/zipball\/3fdae28ba7476ede383a035b8e4af4bc18d40a38",
"reference": "3fdae28ba7476ede383a035b8e4af4bc18d40a38",
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-symfony\/zipball\/1b148e3c47d22b8704ea11a8cee08b42f3215f67",
"reference": "1b148e3c47d22b8704ea11a8cee08b42f3215f67",
"shasum": ""
},
"require": {
@ -2089,7 +2089,7 @@
"tomasvotruba\/type-coverage": "^0.0.9",
"tomasvotruba\/unused-public": "^0.0.34"
},
"time": "2023-02-08T22:40:52+00:00",
"time": "2023-02-09T16:31:35+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 ea9cf46'), '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 b9bfc78'), '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 ee461b1'), '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 3fdae28'));
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 ea9cf46'), '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 d56ebeb'), '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 d974dcc'), '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 1b148e3'));
private function __construct()
{
}

View File

@ -7,6 +7,7 @@ use PhpParser\Node;
use PhpParser\Node\Identifier;
use PhpParser\Node\Stmt\Class_;
use PhpParser\Node\Stmt\Namespace_;
use Rector\Core\Application\FileSystem\RemovedAndAddedFilesCollector;
use Rector\Core\Configuration\RenamedClassesDataCollector;
use Rector\Core\Exception\ShouldNotHappenException;
use Rector\Core\Rector\AbstractRector;
@ -35,11 +36,17 @@ final class RemoveTestSuffixFromAbstractTestClassesRector extends AbstractRector
* @var \Rector\Core\Configuration\RenamedClassesDataCollector
*/
private $renamedClassesDataCollector;
public function __construct(NeighbourClassLikePrinter $neighbourClassLikePrinter, TestsNodeAnalyzer $testsNodeAnalyzer, RenamedClassesDataCollector $renamedClassesDataCollector)
/**
* @readonly
* @var \Rector\Core\Application\FileSystem\RemovedAndAddedFilesCollector
*/
private $removedAndAddedFilesCollector;
public function __construct(NeighbourClassLikePrinter $neighbourClassLikePrinter, TestsNodeAnalyzer $testsNodeAnalyzer, RenamedClassesDataCollector $renamedClassesDataCollector, RemovedAndAddedFilesCollector $removedAndAddedFilesCollector)
{
$this->neighbourClassLikePrinter = $neighbourClassLikePrinter;
$this->testsNodeAnalyzer = $testsNodeAnalyzer;
$this->renamedClassesDataCollector = $renamedClassesDataCollector;
$this->removedAndAddedFilesCollector = $removedAndAddedFilesCollector;
}
public function getRuleDefinition() : RuleDefinition
{
@ -93,6 +100,8 @@ CODE_SAMPLE
$this->printNewNodes($node);
// to rename all other references
$this->renamedClassesDataCollector->addOldToNewClass($oldClassName, $oldClassName . 'Case');
// remove source files that were renamed above
$this->removedAndAddedFilesCollector->removeFile($this->file->getFilePath());
return $node;
}
private function printNewNodes(Class_ $class) : void

View File

@ -99,11 +99,15 @@ CODE_SAMPLE
}
private function refactorAttribute(ClassMethod $classMethod, Attribute $attribute) : void
{
if ($attribute->args === [] || !$attribute->args[1]->name instanceof Identifier || $attribute->args[1]->name->name !== 'options' || !$attribute->args[0]->value instanceof String_) {
if ($attribute->args === [] || !$attribute->args[0]->value instanceof String_) {
return;
}
$optionsIndex = $this->getIndexForOptionsArg($attribute->args);
if (!$optionsIndex) {
return;
}
$name = $attribute->args[0]->value->value;
$mapping = $attribute->args[1]->value;
$mapping = $attribute->args[$optionsIndex]->value;
if (!$mapping instanceof Array_) {
return;
}
@ -122,7 +126,8 @@ CODE_SAMPLE
return;
}
$this->removeNode($attribute->args[0]);
$attribute->args = $newArguments;
$this->removeNode($attribute->args[$optionsIndex]);
$attribute->args = \array_merge($attribute->args, $newArguments);
$attribute->name = new FullyQualified(self::MAP_ENTITY_CLASS);
$node = $attribute->getAttribute(AttributeKey::PARENT_NODE);
if (!$node instanceof AttributeGroup) {
@ -142,4 +147,16 @@ CODE_SAMPLE
}
}
}
/**
* @param Arg[] $args
*/
private function getIndexForOptionsArg(array $args) : ?int
{
foreach ($args as $key => $arg) {
if ($arg->name instanceof Identifier && $arg->name->name === 'options') {
return $key;
}
}
return null;
}
}