Updated Rector to commit 490bd72c85d61feaf426d51d61bf9d04d40a418e

490bd72c85 [Performance][NodeManipulator] Avoid loop on search first variable named on next sliced next stmts on StmtsManipulator (#4537)
This commit is contained in:
Tomas Votruba 2023-07-19 10:36:07 +00:00
parent f6c482799f
commit f7109e0cbd
13 changed files with 38 additions and 61 deletions

View File

@ -4,6 +4,7 @@ declare (strict_types=1);
namespace Rector\Php81\Rector\MethodCall;
use PhpParser\Node;
use PhpParser\Node\Arg;
use PhpParser\Node\Expr;
use PhpParser\Node\Expr\BinaryOp\Identical;
use PhpParser\Node\Expr\ClassConstFetch;
@ -118,19 +119,19 @@ CODE_SAMPLE
}
private function refactorEqualsMethodCall(MethodCall $methodCall) : ?Identical
{
$left = $this->getValidEnumExpr($methodCall->var);
if ($left === null) {
$expr = $this->getValidEnumExpr($methodCall->var);
if (!$expr instanceof Expr) {
return null;
}
$arg = $methodCall->getArgs()[0] ?? null;
if ($arg === null) {
if (!$arg instanceof Arg) {
return null;
}
$right = $this->getValidEnumExpr($arg->value);
if ($right === null) {
if (!$right instanceof Expr) {
return null;
}
return new Identical($left, $right);
return new Identical($expr, $right);
}
/**
* @return null|\PhpParser\Node\Expr\ClassConstFetch|\PhpParser\Node\Expr

View File

@ -4,28 +4,19 @@ declare (strict_types=1);
namespace Rector\TypeDeclaration\Rector\Class_;
use PhpParser\Node;
use PhpParser\Node\Expr;
use PhpParser\Node\Expr\ClassConstFetch;
use PhpParser\Node\Expr\Closure;
use PhpParser\Node\Expr\ConstFetch;
use PhpParser\Node\Expr\Ternary;
use PhpParser\Node\Scalar;
use PhpParser\Node\Stmt\Class_;
use PhpParser\Node\Stmt\ClassMethod;
use PhpParser\Node\Stmt\Function_;
use PhpParser\Node\Stmt\Return_;
use PHPStan\Analyser\Scope;
use PHPStan\Type\ConstantType;
use PHPStan\Type\GeneralizePrecision;
use PHPStan\Type\MixedType;
use PHPStan\Type\Type;
use PHPStan\Type\TypeCombinator;
use PHPStan\Type\UnionType;
use Rector\Core\Rector\AbstractScopeAwareRector;
use Rector\Core\ValueObject\PhpVersionFeature;
use Rector\PHPStanStaticTypeMapper\Enum\TypeKind;
use Rector\TypeDeclaration\TypeInferer\ReturnTypeInferer;
use Rector\TypeDeclaration\ValueObject\TernaryIfElseTypes;
use Rector\VendorLocker\NodeVendorLocker\ClassMethodReturnTypeOverrideGuard;
use Rector\VersionBonding\Contract\MinPhpVersionInterface;
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
@ -128,11 +119,6 @@ CODE_SAMPLE
if ($returnType instanceof UnionType) {
return \true;
}
if ($node instanceof ClassMethod) {
if ($this->classMethodReturnTypeOverrideGuard->shouldSkipClassMethod($node, $scope)) {
return \true;
}
}
return \false;
return $node instanceof ClassMethod && $this->classMethodReturnTypeOverrideGuard->shouldSkipClassMethod($node, $scope);
}
}

View File

@ -3,10 +3,10 @@
declare (strict_types=1);
namespace Rector\TypeDeclaration\TypeAnalyzer;
use PhpParser\Node\Expr\ClassConstFetch;
use PhpParser\Node;
use PhpParser\Node\Expr;
use PhpParser\Node\Expr\Array_;
use PhpParser\Node\Expr\ClassConstFetch;
use PhpParser\Node\Expr\FuncCall;
use PhpParser\Node\Expr\MethodCall;
use PhpParser\Node\Expr\StaticCall;

View File

@ -19,12 +19,12 @@ final class VersionResolver
* @api
* @var string
*/
public const PACKAGE_VERSION = 'b75b5d396f0d0c04242a1fb7fb44f03376f4d8e7';
public const PACKAGE_VERSION = '490bd72c85d61feaf426d51d61bf9d04d40a418e';
/**
* @api
* @var string
*/
public const RELEASE_DATE = '2023-07-18 10:19:12';
public const RELEASE_DATE = '2023-07-19 11:32:20';
/**
* @var int
*/

View File

@ -69,17 +69,7 @@ final class StmtsManipulator
if ($stmtsAware->stmts === null) {
return \false;
}
\end($stmtsAware->stmts);
$totalKeys = \key($stmtsAware->stmts);
for ($key = $jumpToKey; $key <= $totalKeys; ++$key) {
if (!isset($stmtsAware->stmts[$key])) {
continue;
}
$isVariableUsed = (bool) $this->betterNodeFinder->findVariableOfName($stmtsAware->stmts[$key], $variableName);
if ($isVariableUsed) {
return \true;
}
}
return \false;
$stmts = \array_slice($stmtsAware->stmts, $jumpToKey, null, \true);
return (bool) $this->betterNodeFinder->findVariableOfName($stmts, $variableName);
}
}

2
vendor/autoload.php vendored
View File

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

View File

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

View File

@ -1917,12 +1917,12 @@
"source": {
"type": "git",
"url": "https:\/\/github.com\/rectorphp\/rector-doctrine.git",
"reference": "3807e184e3664aa5b1f0f8fb464cb53616e3f0a8"
"reference": "2d14418731b6d1256ed7620f323f9e81953fdf31"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-doctrine\/zipball\/3807e184e3664aa5b1f0f8fb464cb53616e3f0a8",
"reference": "3807e184e3664aa5b1f0f8fb464cb53616e3f0a8",
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-doctrine\/zipball\/2d14418731b6d1256ed7620f323f9e81953fdf31",
"reference": "2d14418731b6d1256ed7620f323f9e81953fdf31",
"shasum": ""
},
"require": {
@ -1947,7 +1947,7 @@
"tomasvotruba\/type-coverage": "^0.2",
"tomasvotruba\/unused-public": "^0.1"
},
"time": "2023-07-17T03:43:41+00:00",
"time": "2023-07-18T15:16:38+00:00",
"default-branch": true,
"type": "rector-extension",
"extra": {
@ -2052,12 +2052,12 @@
"source": {
"type": "git",
"url": "https:\/\/github.com\/rectorphp\/rector-phpunit.git",
"reference": "59b84b71616420ef56d8f125437e6db0c1ebc94b"
"reference": "3918e6fa1790daede2ca6c028a004d74021ce65c"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-phpunit\/zipball\/59b84b71616420ef56d8f125437e6db0c1ebc94b",
"reference": "59b84b71616420ef56d8f125437e6db0c1ebc94b",
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-phpunit\/zipball\/3918e6fa1790daede2ca6c028a004d74021ce65c",
"reference": "3918e6fa1790daede2ca6c028a004d74021ce65c",
"shasum": ""
},
"require": {
@ -2085,7 +2085,7 @@
"tomasvotruba\/type-coverage": "^0.1",
"tomasvotruba\/unused-public": "^0.1"
},
"time": "2023-07-13T11:04:54+00:00",
"time": "2023-07-18T15:13:05+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 3807e18'), '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 734960f'), '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 59b84b7'), '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 a0af12a'));
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 2d14418'), '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 734960f'), '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 3918e6f'), '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 a0af12a'));
private function __construct()
{
}

View File

@ -18,7 +18,7 @@ final class DoctrineSetList implements SetListInterface
*/
public const DOCTRINE_COMMON_20 = __DIR__ . '/../../config/sets/doctrine-common-20.php';
/**
* @deprecated Use dbal set 2.11 instead
* @deprecated Use self::DOCTRINE_DBAL_211 instead
* @var string
*/
public const DOCTRINE_DBAL_210 = __DIR__ . '/../../config/sets/doctrine-dbal-210.php';
@ -40,7 +40,7 @@ final class DoctrineSetList implements SetListInterface
*/
public const DOCTRINE_REPOSITORY_AS_SERVICE = __DIR__ . '/../../config/sets/doctrine-repository-as-service.php';
/**
* @deprecated Use self::DOCTIRNE_ORM_25 instead
* @deprecated Use self::DOCTRINE_ORM_25 instead
* @var string
*/
public const DOCTRINE_25 = self::DOCTRINE_ORM_25;

View File

@ -39,7 +39,7 @@ final class PHPUnitSetList implements SetListInterface
*/
public const PHPUNIT_90 = __DIR__ . '/../../config/sets/phpunit90.php';
/**
* @deprecated Use PHPUnitSetList::PHPUNIT_10 directly
* @deprecated Use PHPUnitSetList::PHPUNIT_100 directly
* @var string
*/
public const PHPUNIT_91 = __DIR__ . '/../../config/sets/phpunit91.php';
@ -52,17 +52,17 @@ final class PHPUnitSetList implements SetListInterface
*/
public const PHPUNIT_CODE_QUALITY = __DIR__ . '/../../config/sets/phpunit-code-quality.php';
/**
* @deprecated Use PHPUnit 6.0 set instead, as related to the version
* @deprecated Use PHPUnitSetList::PHPUNIT_60 set instead, as related to the version
* @var string
*/
public const PHPUNIT_EXCEPTION = __DIR__ . '/../../config/sets/phpunit-exception.php';
/**
* @deprecated Use CodeQuality set instead, as related to code-quality
* @deprecated Use PHPUnitSetList::PHPUNIT_CODE_QUALITY set instead, as related to code-quality
* @var string
*/
public const REMOVE_MOCKS = __DIR__ . '/../../config/sets/remove-mocks.php';
/**
* @deprecated Use PHPUnit CodeQuality set instead, as related to the code quality
* @deprecated Use PHPUnitSetList::PHPUNIT_CODE_QUALITY set instead, as related to the code quality
* @var string
*/
public const PHPUNIT_SPECIFIC_METHOD = __DIR__ . '/../../config/sets/phpunit-specific-method.php';