mirror of
https://github.com/rectorphp/rector.git
synced 2025-01-18 22:08:00 +01:00
Updated Rector to commit 3bc82de4d5b27b2852e6a1ecbc68607cf4d000ce
3bc82de4d5
Increase kernel cache key (#4159)
This commit is contained in:
parent
44769c45f9
commit
5db0609ffa
@ -19,12 +19,12 @@ final class VersionResolver
|
||||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const PACKAGE_VERSION = 'bedb794b6f7db4f1609059b2380201738f8867c7';
|
||||
public const PACKAGE_VERSION = '3bc82de4d5b27b2852e6a1ecbc68607cf4d000ce';
|
||||
/**
|
||||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const RELEASE_DATE = '2023-06-10 17:38:36';
|
||||
public const RELEASE_DATE = '2023-06-10 11:28:05';
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
|
@ -15,7 +15,7 @@ final class RectorKernel
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private const CACHE_KEY = 'v87';
|
||||
private const CACHE_KEY = 'v88';
|
||||
/**
|
||||
* @var \Symfony\Component\DependencyInjection\ContainerInterface|null
|
||||
*/
|
||||
|
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 ComposerAutoloaderInit557266b609b862bd856607b8f869bb45::getLoader();
|
||||
return ComposerAutoloaderInit99da16422db06ebfa8d0cc2b98711b3b::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 ComposerAutoloaderInit557266b609b862bd856607b8f869bb45
|
||||
class ComposerAutoloaderInit99da16422db06ebfa8d0cc2b98711b3b
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
@ -22,17 +22,17 @@ class ComposerAutoloaderInit557266b609b862bd856607b8f869bb45
|
||||
return self::$loader;
|
||||
}
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInit557266b609b862bd856607b8f869bb45', 'loadClassLoader'), true, true);
|
||||
spl_autoload_register(array('ComposerAutoloaderInit99da16422db06ebfa8d0cc2b98711b3b', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit557266b609b862bd856607b8f869bb45', 'loadClassLoader'));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit99da16422db06ebfa8d0cc2b98711b3b', 'loadClassLoader'));
|
||||
|
||||
require __DIR__ . '/autoload_static.php';
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit557266b609b862bd856607b8f869bb45::getInitializer($loader));
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit99da16422db06ebfa8d0cc2b98711b3b::getInitializer($loader));
|
||||
|
||||
$loader->setClassMapAuthoritative(true);
|
||||
$loader->register(true);
|
||||
|
||||
$filesToLoad = \Composer\Autoload\ComposerStaticInit557266b609b862bd856607b8f869bb45::$files;
|
||||
$filesToLoad = \Composer\Autoload\ComposerStaticInit99da16422db06ebfa8d0cc2b98711b3b::$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 ComposerStaticInit557266b609b862bd856607b8f869bb45
|
||||
class ComposerStaticInit99da16422db06ebfa8d0cc2b98711b3b
|
||||
{
|
||||
public static $files = array (
|
||||
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
|
||||
@ -3127,9 +3127,9 @@ class ComposerStaticInit557266b609b862bd856607b8f869bb45
|
||||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit557266b609b862bd856607b8f869bb45::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit557266b609b862bd856607b8f869bb45::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit557266b609b862bd856607b8f869bb45::$classMap;
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit99da16422db06ebfa8d0cc2b98711b3b::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit99da16422db06ebfa8d0cc2b98711b3b::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit99da16422db06ebfa8d0cc2b98711b3b::$classMap;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
|
8
vendor/composer/installed.json
vendored
8
vendor/composer/installed.json
vendored
@ -1986,12 +1986,12 @@
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https:\/\/github.com\/rectorphp\/rector-downgrade-php.git",
|
||||
"reference": "30412db26f1f2ee7e58c12f303cc1dfece2dec85"
|
||||
"reference": "a66aaa76ab80607e652fbb8adfad4e0a5168ddb1"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-downgrade-php\/zipball\/30412db26f1f2ee7e58c12f303cc1dfece2dec85",
|
||||
"reference": "30412db26f1f2ee7e58c12f303cc1dfece2dec85",
|
||||
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-downgrade-php\/zipball\/a66aaa76ab80607e652fbb8adfad4e0a5168ddb1",
|
||||
"reference": "a66aaa76ab80607e652fbb8adfad4e0a5168ddb1",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -2015,7 +2015,7 @@
|
||||
"tomasvotruba\/type-coverage": "^0.2",
|
||||
"tomasvotruba\/unused-public": "^0.1"
|
||||
},
|
||||
"time": "2023-06-09T12:56:40+00:00",
|
||||
"time": "2023-06-10T11:22:51+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 ca01799'), '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 30412db'), '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 a842ca4'), '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 65e2e8d'));
|
||||
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 ca01799'), '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 a66aaa7'), '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 a842ca4'), '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 65e2e8d'));
|
||||
private function __construct()
|
||||
{
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ CODE_SAMPLE
|
||||
public function refactor(Node $node)
|
||||
{
|
||||
$hasFound = \false;
|
||||
$assignVariable = $this->namedVariableFactory->createVariable($node, 'battleShipcompare');
|
||||
$assignVariable = $this->namedVariableFactory->createVariable('battleShipcompare', $node);
|
||||
$this->traverseNodesWithCallable($node, static function (Node $node) use(&$hasFound, $assignVariable) : ?FuncCall {
|
||||
if (!$node instanceof Spaceship) {
|
||||
return null;
|
||||
|
@ -10,6 +10,7 @@ use PhpParser\Node\Expr\Closure;
|
||||
use PhpParser\Node\Expr\ClosureUse;
|
||||
use PhpParser\Node\Expr\FuncCall;
|
||||
use PhpParser\Node\Expr\StaticCall;
|
||||
use PhpParser\Node\Stmt;
|
||||
use PhpParser\Node\Stmt\Echo_;
|
||||
use PhpParser\Node\Stmt\Expression;
|
||||
use PhpParser\Node\Stmt\Return_;
|
||||
@ -81,7 +82,8 @@ CODE_SAMPLE
|
||||
if (!$expr instanceof StaticCall) {
|
||||
return null;
|
||||
}
|
||||
$tempVariable = $this->namedVariableFactory->createVariable($expr, 'callable');
|
||||
/** @var Stmt $node */
|
||||
$tempVariable = $this->namedVariableFactory->createVariable('callable', $node);
|
||||
$assignExpression = new Expression(new Assign($tempVariable, $expr->getArgs()[0]->value));
|
||||
$innerFuncCall = new FuncCall($tempVariable, [new Arg($this->nodeFactory->createFuncCall('func_get_args'), \false, \true)]);
|
||||
$closure = new Closure();
|
||||
|
@ -24,7 +24,8 @@ use PhpParser\Node\Stmt\Echo_;
|
||||
use PhpParser\Node\Stmt\Expression;
|
||||
use PhpParser\Node\Stmt\Return_;
|
||||
use PhpParser\Node\Stmt\Switch_;
|
||||
use Rector\Core\Rector\AbstractRector;
|
||||
use PHPStan\Analyser\Scope;
|
||||
use Rector\Core\Rector\AbstractScopeAwareRector;
|
||||
use Rector\NodeTypeResolver\Node\AttributeKey;
|
||||
use Rector\Php72\NodeFactory\AnonymousFunctionFactory;
|
||||
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
|
||||
@ -34,7 +35,7 @@ use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||
*
|
||||
* @see \Rector\Tests\DowngradePhp80\Rector\Expression\DowngradeMatchToSwitchRector\DowngradeMatchToSwitchRectorTest
|
||||
*/
|
||||
final class DowngradeMatchToSwitchRector extends AbstractRector
|
||||
final class DowngradeMatchToSwitchRector extends AbstractScopeAwareRector
|
||||
{
|
||||
/**
|
||||
* @readonly
|
||||
@ -92,7 +93,7 @@ CODE_SAMPLE
|
||||
/**
|
||||
* @param Echo_|Expression|Return_ $node
|
||||
*/
|
||||
public function refactor(Node $node) : ?Node
|
||||
public function refactorWithScope(Node $node, Scope $scope) : ?Node
|
||||
{
|
||||
$match = $this->betterNodeFinder->findFirst($node, static function (Node $subNode) : bool {
|
||||
return $subNode instanceof Match_;
|
||||
@ -100,8 +101,11 @@ CODE_SAMPLE
|
||||
if (!$match instanceof Match_) {
|
||||
return null;
|
||||
}
|
||||
$currentStmt = $this->betterNodeFinder->resolveCurrentStatement($match);
|
||||
if ($currentStmt !== $node) {
|
||||
$matchScope = $match->getAttribute(AttributeKey::SCOPE);
|
||||
if (!$matchScope instanceof Scope) {
|
||||
return null;
|
||||
}
|
||||
if ($matchScope->getParentScope() !== $scope->getParentScope()) {
|
||||
return null;
|
||||
}
|
||||
$switchCases = $this->createSwitchCasesFromMatchArms($node, $match);
|
||||
|
@ -132,7 +132,7 @@ CODE_SAMPLE
|
||||
$exprAssign = $newOrInstanceof->class;
|
||||
$variable = $exprAssign->var;
|
||||
} else {
|
||||
$variable = $this->namedVariableFactory->createVariable($newOrInstanceof, 'className');
|
||||
$variable = $this->namedVariableFactory->createVariable('className', $expression);
|
||||
$exprAssign = new Assign($variable, $newOrInstanceof->class);
|
||||
}
|
||||
$newOrInstanceof->class = $variable;
|
||||
@ -154,7 +154,7 @@ CODE_SAMPLE
|
||||
}
|
||||
// mandatory to remove parentheses
|
||||
$instanceof->setAttribute(AttributeKey::ORIGINAL_NODE, null);
|
||||
$variable = $this->namedVariableFactory->createVariable($instanceof, 'className');
|
||||
$variable = $this->namedVariableFactory->createVariable('className', $expression);
|
||||
$exprAssign = new Assign($variable, $instanceof->class);
|
||||
$instanceof->class = $variable;
|
||||
return [new Expression($exprAssign), $expression];
|
||||
|
@ -3,10 +3,8 @@
|
||||
declare (strict_types=1);
|
||||
namespace Rector\NodeFactory;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Expr\Variable;
|
||||
use Rector\Core\Exception\ShouldNotHappenException;
|
||||
use Rector\Core\PhpParser\Node\BetterNodeFinder;
|
||||
use PhpParser\Node\Stmt;
|
||||
use Rector\Naming\Naming\VariableNaming;
|
||||
use Rector\NodeTypeResolver\Node\AttributeKey;
|
||||
final class NamedVariableFactory
|
||||
@ -16,22 +14,12 @@ final class NamedVariableFactory
|
||||
* @var \Rector\Naming\Naming\VariableNaming
|
||||
*/
|
||||
private $variableNaming;
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Core\PhpParser\Node\BetterNodeFinder
|
||||
*/
|
||||
private $betterNodeFinder;
|
||||
public function __construct(VariableNaming $variableNaming, BetterNodeFinder $betterNodeFinder)
|
||||
public function __construct(VariableNaming $variableNaming)
|
||||
{
|
||||
$this->variableNaming = $variableNaming;
|
||||
$this->betterNodeFinder = $betterNodeFinder;
|
||||
}
|
||||
public function createVariable(Node $node, string $variableName) : Variable
|
||||
public function createVariable(string $variableName, Stmt $currentStmt) : Variable
|
||||
{
|
||||
$currentStmt = $this->betterNodeFinder->resolveCurrentStatement($node);
|
||||
if (!$currentStmt instanceof Node) {
|
||||
throw new ShouldNotHappenException();
|
||||
}
|
||||
$scope = $currentStmt->getAttribute(AttributeKey::SCOPE);
|
||||
$variableName = $this->variableNaming->createCountedValueName($variableName, $scope);
|
||||
return new Variable($variableName);
|
||||
|
Loading…
x
Reference in New Issue
Block a user