mirror of
https://github.com/rectorphp/rector.git
synced 2025-01-17 21:38:22 +01:00
Updated Rector to commit 3eadce164860c1d4465e40fd5e07fb11d3aa1b99
3eadce1648
[NodeTypeResolver] Reduce parent attribute usage on PHPStanNodeScopeResolver (#3943)
This commit is contained in:
parent
5f32b6989a
commit
a32354e5eb
@ -12,7 +12,6 @@ use PhpParser\Node\Expr\Assign;
|
||||
use PhpParser\Node\Expr\AssignOp;
|
||||
use PhpParser\Node\Expr\BinaryOp;
|
||||
use PhpParser\Node\Expr\Cast;
|
||||
use PhpParser\Node\Expr\Closure;
|
||||
use PhpParser\Node\Expr\FuncCall;
|
||||
use PhpParser\Node\Expr\Ternary;
|
||||
use PhpParser\Node\Expr\Variable;
|
||||
@ -46,7 +45,6 @@ use Rector\Caching\FileSystem\DependencyResolver;
|
||||
use Rector\Core\Contract\PhpParser\Node\StmtsAwareInterface;
|
||||
use Rector\Core\Exception\ShouldNotHappenException;
|
||||
use Rector\Core\NodeAnalyzer\ClassAnalyzer;
|
||||
use Rector\Core\PhpParser\Node\BetterNodeFinder;
|
||||
use Rector\Core\Util\Reflection\PrivatesAccessor;
|
||||
use Rector\NodeNameResolver\NodeNameResolver;
|
||||
use Rector\NodeTypeResolver\Node\AttributeKey;
|
||||
@ -102,11 +100,6 @@ final class PHPStanNodeScopeResolver
|
||||
* @var \Rector\NodeNameResolver\NodeNameResolver
|
||||
*/
|
||||
private $nodeNameResolver;
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Core\PhpParser\Node\BetterNodeFinder
|
||||
*/
|
||||
private $betterNodeFinder;
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Core\NodeAnalyzer\ClassAnalyzer
|
||||
@ -115,7 +108,7 @@ final class PHPStanNodeScopeResolver
|
||||
/**
|
||||
* @param ScopeResolverNodeVisitorInterface[] $nodeVisitors
|
||||
*/
|
||||
public function __construct(ChangedFilesDetector $changedFilesDetector, DependencyResolver $dependencyResolver, NodeScopeResolver $nodeScopeResolver, ReflectionProvider $reflectionProvider, array $nodeVisitors, \Rector\NodeTypeResolver\PHPStan\Scope\ScopeFactory $scopeFactory, PrivatesAccessor $privatesAccessor, NodeNameResolver $nodeNameResolver, BetterNodeFinder $betterNodeFinder, ClassAnalyzer $classAnalyzer)
|
||||
public function __construct(ChangedFilesDetector $changedFilesDetector, DependencyResolver $dependencyResolver, NodeScopeResolver $nodeScopeResolver, ReflectionProvider $reflectionProvider, array $nodeVisitors, \Rector\NodeTypeResolver\PHPStan\Scope\ScopeFactory $scopeFactory, PrivatesAccessor $privatesAccessor, NodeNameResolver $nodeNameResolver, ClassAnalyzer $classAnalyzer)
|
||||
{
|
||||
$this->changedFilesDetector = $changedFilesDetector;
|
||||
$this->dependencyResolver = $dependencyResolver;
|
||||
@ -124,7 +117,6 @@ final class PHPStanNodeScopeResolver
|
||||
$this->scopeFactory = $scopeFactory;
|
||||
$this->privatesAccessor = $privatesAccessor;
|
||||
$this->nodeNameResolver = $nodeNameResolver;
|
||||
$this->betterNodeFinder = $betterNodeFinder;
|
||||
$this->classAnalyzer = $classAnalyzer;
|
||||
$this->nodeTraverser = new NodeTraverser();
|
||||
foreach ($nodeVisitors as $nodeVisitor) {
|
||||
@ -222,21 +214,17 @@ final class PHPStanNodeScopeResolver
|
||||
}
|
||||
private function setChildOfUnreachableStatementNodeAttribute(Stmt $stmt) : void
|
||||
{
|
||||
if ($stmt->getAttribute(AttributeKey::IS_UNREACHABLE) === \true) {
|
||||
if ($stmt->getAttribute(AttributeKey::IS_UNREACHABLE) !== \true) {
|
||||
return;
|
||||
}
|
||||
$parentStmt = $stmt->getAttribute(AttributeKey::PARENT_NODE);
|
||||
if (!$parentStmt instanceof Node) {
|
||||
if (!$stmt instanceof StmtsAwareInterface) {
|
||||
return;
|
||||
}
|
||||
if ($parentStmt instanceof Closure) {
|
||||
$parentStmt = $this->betterNodeFinder->resolveCurrentStatement($parentStmt);
|
||||
}
|
||||
if (!$parentStmt instanceof Stmt) {
|
||||
if ($stmt->stmts === null) {
|
||||
return;
|
||||
}
|
||||
if ($parentStmt->getAttribute(AttributeKey::IS_UNREACHABLE) === \true) {
|
||||
$stmt->setAttribute(AttributeKey::IS_UNREACHABLE, \true);
|
||||
foreach ($stmt->stmts as $childStmt) {
|
||||
$childStmt->setAttribute(AttributeKey::IS_UNREACHABLE, \true);
|
||||
}
|
||||
}
|
||||
private function processArray(Array_ $array, MutatingScope $mutatingScope) : void
|
||||
|
@ -19,12 +19,12 @@ final class VersionResolver
|
||||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const PACKAGE_VERSION = '62ecc9028796457cc58e717ac50c9d2cc5339b17';
|
||||
public const PACKAGE_VERSION = '3eadce164860c1d4465e40fd5e07fb11d3aa1b99';
|
||||
/**
|
||||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const RELEASE_DATE = '2023-05-24 02:46:29';
|
||||
public const RELEASE_DATE = '2023-05-24 04:15:17';
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
|
@ -15,7 +15,7 @@ final class RectorKernel
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private const CACHE_KEY = 'v24';
|
||||
private const CACHE_KEY = 'v25';
|
||||
/**
|
||||
* @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 ComposerAutoloaderInit04d8ae861579222222f8bf9523047655::getLoader();
|
||||
return ComposerAutoloaderInitb7b74474b87e58ef937ad854d6d77003::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 ComposerAutoloaderInit04d8ae861579222222f8bf9523047655
|
||||
class ComposerAutoloaderInitb7b74474b87e58ef937ad854d6d77003
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
@ -22,17 +22,17 @@ class ComposerAutoloaderInit04d8ae861579222222f8bf9523047655
|
||||
return self::$loader;
|
||||
}
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInit04d8ae861579222222f8bf9523047655', 'loadClassLoader'), true, true);
|
||||
spl_autoload_register(array('ComposerAutoloaderInitb7b74474b87e58ef937ad854d6d77003', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit04d8ae861579222222f8bf9523047655', 'loadClassLoader'));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInitb7b74474b87e58ef937ad854d6d77003', 'loadClassLoader'));
|
||||
|
||||
require __DIR__ . '/autoload_static.php';
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit04d8ae861579222222f8bf9523047655::getInitializer($loader));
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInitb7b74474b87e58ef937ad854d6d77003::getInitializer($loader));
|
||||
|
||||
$loader->setClassMapAuthoritative(true);
|
||||
$loader->register(true);
|
||||
|
||||
$filesToLoad = \Composer\Autoload\ComposerStaticInit04d8ae861579222222f8bf9523047655::$files;
|
||||
$filesToLoad = \Composer\Autoload\ComposerStaticInitb7b74474b87e58ef937ad854d6d77003::$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 ComposerStaticInit04d8ae861579222222f8bf9523047655
|
||||
class ComposerStaticInitb7b74474b87e58ef937ad854d6d77003
|
||||
{
|
||||
public static $files = array (
|
||||
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
|
||||
@ -3106,9 +3106,9 @@ class ComposerStaticInit04d8ae861579222222f8bf9523047655
|
||||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit04d8ae861579222222f8bf9523047655::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit04d8ae861579222222f8bf9523047655::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit04d8ae861579222222f8bf9523047655::$classMap;
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInitb7b74474b87e58ef937ad854d6d77003::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInitb7b74474b87e58ef937ad854d6d77003::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInitb7b74474b87e58ef937ad854d6d77003::$classMap;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user