mirror of
https://github.com/rectorphp/rector.git
synced 2025-03-14 04:19:44 +01:00
Updated Rector to commit b84fe9524aa20e200f743f13f6925d93225c6280
b84fe9524a
[Php56] Reduce origNode check on UndefinedVariableResolver (#4033)
This commit is contained in:
parent
9335e75d7b
commit
17e8e0f374
2
vendor/autoload.php
vendored
2
vendor/autoload.php
vendored
@ -22,4 +22,4 @@ if (PHP_VERSION_ID < 50600) {
|
||||
|
||||
require_once __DIR__ . '/composer/autoload_real.php';
|
||||
|
||||
return ComposerAutoloaderInit3f119c34a45693a0a7ddfbef5b6c6b90::getLoader();
|
||||
return ComposerAutoloaderInitaa7e2bb479e471e9f78c2d7a46b45331::getLoader();
|
||||
|
10
vendor/composer/autoload_real.php
vendored
10
vendor/composer/autoload_real.php
vendored
@ -2,7 +2,7 @@
|
||||
|
||||
// autoload_real.php @generated by Composer
|
||||
|
||||
class ComposerAutoloaderInit3f119c34a45693a0a7ddfbef5b6c6b90
|
||||
class ComposerAutoloaderInitaa7e2bb479e471e9f78c2d7a46b45331
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
@ -22,17 +22,17 @@ class ComposerAutoloaderInit3f119c34a45693a0a7ddfbef5b6c6b90
|
||||
return self::$loader;
|
||||
}
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInit3f119c34a45693a0a7ddfbef5b6c6b90', 'loadClassLoader'), true, true);
|
||||
spl_autoload_register(array('ComposerAutoloaderInitaa7e2bb479e471e9f78c2d7a46b45331', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit3f119c34a45693a0a7ddfbef5b6c6b90', 'loadClassLoader'));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInitaa7e2bb479e471e9f78c2d7a46b45331', 'loadClassLoader'));
|
||||
|
||||
require __DIR__ . '/autoload_static.php';
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit3f119c34a45693a0a7ddfbef5b6c6b90::getInitializer($loader));
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInitaa7e2bb479e471e9f78c2d7a46b45331::getInitializer($loader));
|
||||
|
||||
$loader->setClassMapAuthoritative(true);
|
||||
$loader->register(true);
|
||||
|
||||
$filesToLoad = \Composer\Autoload\ComposerStaticInit3f119c34a45693a0a7ddfbef5b6c6b90::$files;
|
||||
$filesToLoad = \Composer\Autoload\ComposerStaticInitaa7e2bb479e471e9f78c2d7a46b45331::$files;
|
||||
$requireFile = \Closure::bind(static function ($fileIdentifier, $file) {
|
||||
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
||||
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
|
||||
|
8
vendor/composer/autoload_static.php
vendored
8
vendor/composer/autoload_static.php
vendored
@ -4,7 +4,7 @@
|
||||
|
||||
namespace Composer\Autoload;
|
||||
|
||||
class ComposerStaticInit3f119c34a45693a0a7ddfbef5b6c6b90
|
||||
class ComposerStaticInitaa7e2bb479e471e9f78c2d7a46b45331
|
||||
{
|
||||
public static $files = array (
|
||||
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
|
||||
@ -3067,9 +3067,9 @@ class ComposerStaticInit3f119c34a45693a0a7ddfbef5b6c6b90
|
||||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit3f119c34a45693a0a7ddfbef5b6c6b90::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit3f119c34a45693a0a7ddfbef5b6c6b90::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit3f119c34a45693a0a7ddfbef5b6c6b90::$classMap;
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInitaa7e2bb479e471e9f78c2d7a46b45331::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInitaa7e2bb479e471e9f78c2d7a46b45331::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInitaa7e2bb479e471e9f78c2d7a46b45331::$classMap;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
|
8
vendor/composer/installed.json
vendored
8
vendor/composer/installed.json
vendored
@ -1920,12 +1920,12 @@
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https:\/\/github.com\/rectorphp\/rector-downgrade-php.git",
|
||||
"reference": "4740bc91c8a1b997a00b636ae63ccc15943b6199"
|
||||
"reference": "36f54614208d563d290d2c8eb5e4dba92c053a1a"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-downgrade-php\/zipball\/4740bc91c8a1b997a00b636ae63ccc15943b6199",
|
||||
"reference": "4740bc91c8a1b997a00b636ae63ccc15943b6199",
|
||||
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-downgrade-php\/zipball\/36f54614208d563d290d2c8eb5e4dba92c053a1a",
|
||||
"reference": "36f54614208d563d290d2c8eb5e4dba92c053a1a",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -1949,7 +1949,7 @@
|
||||
"tomasvotruba\/type-coverage": "^0.2",
|
||||
"tomasvotruba\/unused-public": "^0.1"
|
||||
},
|
||||
"time": "2023-05-30T15:36:01+00:00",
|
||||
"time": "2023-05-30T15:48:28+00:00",
|
||||
"default-branch": true,
|
||||
"type": "rector-extension",
|
||||
"extra": {
|
||||
|
2
vendor/composer/installed.php
vendored
2
vendor/composer/installed.php
vendored
File diff suppressed because one or more lines are too long
@ -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 4740bc9'), '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 2348d4f'));
|
||||
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 36f5461'), '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 2348d4f'));
|
||||
private function __construct()
|
||||
{
|
||||
}
|
||||
|
@ -71,28 +71,22 @@ CODE_SAMPLE
|
||||
*/
|
||||
public function refactor(Node $node)
|
||||
{
|
||||
if ($node instanceof If_ && $node->cond instanceof Spaceship) {
|
||||
$spaceship = $node->cond;
|
||||
} elseif ($node instanceof Return_ && $node->expr instanceof Spaceship) {
|
||||
$spaceship = $node->expr;
|
||||
} else {
|
||||
$hasFound = \false;
|
||||
$assignVariable = $this->namedVariableFactory->createVariable($node, 'battleShipcompare');
|
||||
$this->traverseNodesWithCallable($node, static function (Node $node) use(&$hasFound, $assignVariable) : ?FuncCall {
|
||||
if (!$node instanceof Spaceship) {
|
||||
return null;
|
||||
}
|
||||
$hasFound = \true;
|
||||
return new FuncCall($assignVariable, [new Arg($node->left), new Arg($node->right)]);
|
||||
});
|
||||
if ($hasFound === \false) {
|
||||
return null;
|
||||
}
|
||||
$anonymousFunction = $this->createAnonymousFunction();
|
||||
$assignVariable = $this->namedVariableFactory->createVariable($node, 'battleShipcompare');
|
||||
$assignExpression = $this->getAssignExpression($anonymousFunction, $assignVariable);
|
||||
$compareFuncCall = new FuncCall($assignVariable, [new Arg($spaceship->left), new Arg($spaceship->right)]);
|
||||
if ($node instanceof Return_) {
|
||||
$node->expr = $compareFuncCall;
|
||||
} elseif ($node instanceof If_) {
|
||||
$node->cond = $compareFuncCall;
|
||||
}
|
||||
$assignExpression = new Expression(new Assign($assignVariable, $anonymousFunction));
|
||||
return [$assignExpression, $node];
|
||||
}
|
||||
private function getAssignExpression(Closure $closure, Variable $variable) : Expression
|
||||
{
|
||||
return new Expression(new Assign($variable, $closure));
|
||||
}
|
||||
private function createAnonymousFunction() : Closure
|
||||
{
|
||||
$leftVariableParam = new Variable('left');
|
||||
|
Loading…
x
Reference in New Issue
Block a user