Skip to content

Commit

Permalink
Updated Rector to commit b84fe9524aa20e200f743f13f6925d93225c6280
Browse files Browse the repository at this point in the history
rectorphp/rector-src@b84fe95 [Php56] Reduce origNode check on UndefinedVariableResolver (#4033)
  • Loading branch information
TomasVotruba committed May 30, 2023
1 parent 9335e75 commit 17e8e0f
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 33 deletions.
2 changes: 1 addition & 1 deletion vendor/autoload.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@

require_once __DIR__ . '/composer/autoload_real.php';

return ComposerAutoloaderInit3f119c34a45693a0a7ddfbef5b6c6b90::getLoader();
return ComposerAutoloaderInitaa7e2bb479e471e9f78c2d7a46b45331::getLoader();
10 changes: 5 additions & 5 deletions vendor/composer/autoload_real.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

// autoload_real.php @generated by Composer

class ComposerAutoloaderInit3f119c34a45693a0a7ddfbef5b6c6b90
class ComposerAutoloaderInitaa7e2bb479e471e9f78c2d7a46b45331
{
private static $loader;

Expand All @@ -22,17 +22,17 @@ public static function getLoader()
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;
Expand Down
8 changes: 4 additions & 4 deletions vendor/composer/autoload_static.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Composer\Autoload;

class ComposerStaticInit3f119c34a45693a0a7ddfbef5b6c6b90
class ComposerStaticInitaa7e2bb479e471e9f78c2d7a46b45331
{
public static $files = array (
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
Expand Down Expand Up @@ -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);
}
Expand Down
8 changes: 4 additions & 4 deletions vendor/composer/installed.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand All @@ -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": {
Expand Down
2 changes: 1 addition & 1 deletion vendor/composer/installed.php

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion vendor/rector/extension-installer/src/GeneratedConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*/
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()
{
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,28 +71,22 @@ public function getRuleDefinition() : RuleDefinition
*/
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');
Expand Down

0 comments on commit 17e8e0f

Please sign in to comment.