Updated Rector to commit 9c52b6367df314666469b583e5a23c80750ed0f6

9c52b6367d [MysqlToMySqli][DeadCode] Handle MYSQL_TO_MYSQLI and DEAD_CODE SetList usage (#884)
This commit is contained in:
Tomas Votruba 2021-09-15 14:16:32 +00:00
parent 2302d08be2
commit 6f36e4ebba
7 changed files with 38 additions and 24 deletions

View File

@ -5,7 +5,10 @@ namespace Rector\DeadCode\NodeAnalyzer;
use PhpParser\Node;
use PhpParser\Node\Expr;
use PhpParser\Node\Name;
use PHPStan\Analyser\Scope;
use Rector\Core\PhpParser\Node\BetterNodeFinder;
use Rector\NodeTypeResolver\Node\AttributeKey;
final class ExprUsedInNextNodeAnalyzer
{
/**
@ -21,9 +24,20 @@ final class ExprUsedInNextNodeAnalyzer
$this->betterNodeFinder = $betterNodeFinder;
$this->exprUsedInNodeAnalyzer = $exprUsedInNodeAnalyzer;
}
public function isUsed(\PhpParser\Node\Expr $expr) : bool
/**
* $isCheckNameScope parameter is used to whether to check scope of Name that may be renamed
* @see https://github.com/rectorphp/rector/issues/6675
*/
public function isUsed(\PhpParser\Node\Expr $expr, bool $isCheckNameScope = \false) : bool
{
return (bool) $this->betterNodeFinder->findFirstNext($expr, function (\PhpParser\Node $node) use($expr) : bool {
return (bool) $this->betterNodeFinder->findFirstNext($expr, function (\PhpParser\Node $node) use($expr, $isCheckNameScope) : bool {
if ($isCheckNameScope && $node instanceof \PhpParser\Node\Name) {
$scope = $node->getAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::SCOPE);
$resolvedName = $node->getAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::RESOLVED_NAME);
if (!$scope instanceof \PHPStan\Analyser\Scope && !$resolvedName instanceof \PhpParser\Node\Name) {
return \true;
}
}
return $this->exprUsedInNodeAnalyzer->isUsed($node, $expr);
});
}

View File

@ -75,11 +75,11 @@ CODE_SAMPLE
if (!$node->var instanceof \PhpParser\Node\Expr\Variable) {
return null;
}
$exprType = $this->nodeTypeResolver->resolve($node->expr);
if (!$exprType instanceof \PHPStan\Type\VoidType) {
if ($this->exprUsedInNextNodeAnalyzer->isUsed($node->var, \true)) {
return null;
}
if ($this->exprUsedInNextNodeAnalyzer->isUsed($node->var)) {
$exprType = $this->nodeTypeResolver->resolve($node->expr);
if (!$exprType instanceof \PHPStan\Type\VoidType) {
return null;
}
return $node->expr;

View File

@ -16,11 +16,11 @@ final class VersionResolver
/**
* @var string
*/
public const PACKAGE_VERSION = 'e834a762851bcd9a1bcdbd287658e9977405147a';
public const PACKAGE_VERSION = '9c52b6367df314666469b583e5a23c80750ed0f6';
/**
* @var string
*/
public const RELEASE_DATE = '2021-09-15 20:47:26';
public const RELEASE_DATE = '2021-09-15 21:03:18';
public static function resolvePackageVersion() : string
{
$process = new \RectorPrefix20210915\Symfony\Component\Process\Process(['git', 'log', '--pretty="%H"', '-n1', 'HEAD'], __DIR__);

2
vendor/autoload.php vendored
View File

@ -4,4 +4,4 @@
require_once __DIR__ . '/composer/autoload_real.php';
return ComposerAutoloaderInit4683ba2dfaa767e737870edc0f1f5f7a::getLoader();
return ComposerAutoloaderInit0a61a9fb5efb0f54d141d395e1014b36::getLoader();

View File

@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer
class ComposerAutoloaderInit4683ba2dfaa767e737870edc0f1f5f7a
class ComposerAutoloaderInit0a61a9fb5efb0f54d141d395e1014b36
{
private static $loader;
@ -22,15 +22,15 @@ class ComposerAutoloaderInit4683ba2dfaa767e737870edc0f1f5f7a
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInit4683ba2dfaa767e737870edc0f1f5f7a', 'loadClassLoader'), true, true);
spl_autoload_register(array('ComposerAutoloaderInit0a61a9fb5efb0f54d141d395e1014b36', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
spl_autoload_unregister(array('ComposerAutoloaderInit4683ba2dfaa767e737870edc0f1f5f7a', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInit0a61a9fb5efb0f54d141d395e1014b36', 'loadClassLoader'));
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
if ($useStaticLoader) {
require __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInit4683ba2dfaa767e737870edc0f1f5f7a::getInitializer($loader));
call_user_func(\Composer\Autoload\ComposerStaticInit0a61a9fb5efb0f54d141d395e1014b36::getInitializer($loader));
} else {
$classMap = require __DIR__ . '/autoload_classmap.php';
if ($classMap) {
@ -42,19 +42,19 @@ class ComposerAutoloaderInit4683ba2dfaa767e737870edc0f1f5f7a
$loader->register(true);
if ($useStaticLoader) {
$includeFiles = Composer\Autoload\ComposerStaticInit4683ba2dfaa767e737870edc0f1f5f7a::$files;
$includeFiles = Composer\Autoload\ComposerStaticInit0a61a9fb5efb0f54d141d395e1014b36::$files;
} else {
$includeFiles = require __DIR__ . '/autoload_files.php';
}
foreach ($includeFiles as $fileIdentifier => $file) {
composerRequire4683ba2dfaa767e737870edc0f1f5f7a($fileIdentifier, $file);
composerRequire0a61a9fb5efb0f54d141d395e1014b36($fileIdentifier, $file);
}
return $loader;
}
}
function composerRequire4683ba2dfaa767e737870edc0f1f5f7a($fileIdentifier, $file)
function composerRequire0a61a9fb5efb0f54d141d395e1014b36($fileIdentifier, $file)
{
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
require $file;

View File

@ -4,7 +4,7 @@
namespace Composer\Autoload;
class ComposerStaticInit4683ba2dfaa767e737870edc0f1f5f7a
class ComposerStaticInit0a61a9fb5efb0f54d141d395e1014b36
{
public static $files = array (
'a4a119a56e50fbb293281d9a48007e0e' => __DIR__ . '/..' . '/symfony/polyfill-php80/bootstrap.php',
@ -3858,9 +3858,9 @@ class ComposerStaticInit4683ba2dfaa767e737870edc0f1f5f7a
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInit4683ba2dfaa767e737870edc0f1f5f7a::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit4683ba2dfaa767e737870edc0f1f5f7a::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit4683ba2dfaa767e737870edc0f1f5f7a::$classMap;
$loader->prefixLengthsPsr4 = ComposerStaticInit0a61a9fb5efb0f54d141d395e1014b36::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit0a61a9fb5efb0f54d141d395e1014b36::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit0a61a9fb5efb0f54d141d395e1014b36::$classMap;
}, null, ClassLoader::class);
}

View File

@ -9,8 +9,8 @@ $loader = require_once __DIR__.'/autoload.php';
if (!class_exists('AutoloadIncluder', false) && !interface_exists('AutoloadIncluder', false) && !trait_exists('AutoloadIncluder', false)) {
spl_autoload_call('RectorPrefix20210915\AutoloadIncluder');
}
if (!class_exists('ComposerAutoloaderInit4683ba2dfaa767e737870edc0f1f5f7a', false) && !interface_exists('ComposerAutoloaderInit4683ba2dfaa767e737870edc0f1f5f7a', false) && !trait_exists('ComposerAutoloaderInit4683ba2dfaa767e737870edc0f1f5f7a', false)) {
spl_autoload_call('RectorPrefix20210915\ComposerAutoloaderInit4683ba2dfaa767e737870edc0f1f5f7a');
if (!class_exists('ComposerAutoloaderInit0a61a9fb5efb0f54d141d395e1014b36', false) && !interface_exists('ComposerAutoloaderInit0a61a9fb5efb0f54d141d395e1014b36', false) && !trait_exists('ComposerAutoloaderInit0a61a9fb5efb0f54d141d395e1014b36', false)) {
spl_autoload_call('RectorPrefix20210915\ComposerAutoloaderInit0a61a9fb5efb0f54d141d395e1014b36');
}
if (!class_exists('Helmich\TypoScriptParser\Parser\AST\Statement', false) && !interface_exists('Helmich\TypoScriptParser\Parser\AST\Statement', false) && !trait_exists('Helmich\TypoScriptParser\Parser\AST\Statement', false)) {
spl_autoload_call('RectorPrefix20210915\Helmich\TypoScriptParser\Parser\AST\Statement');
@ -3311,9 +3311,9 @@ if (!function_exists('print_node')) {
return \RectorPrefix20210915\print_node(...func_get_args());
}
}
if (!function_exists('composerRequire4683ba2dfaa767e737870edc0f1f5f7a')) {
function composerRequire4683ba2dfaa767e737870edc0f1f5f7a() {
return \RectorPrefix20210915\composerRequire4683ba2dfaa767e737870edc0f1f5f7a(...func_get_args());
if (!function_exists('composerRequire0a61a9fb5efb0f54d141d395e1014b36')) {
function composerRequire0a61a9fb5efb0f54d141d395e1014b36() {
return \RectorPrefix20210915\composerRequire0a61a9fb5efb0f54d141d395e1014b36(...func_get_args());
}
}
if (!function_exists('parseArgs')) {