Skip to content

Commit

Permalink
Updated Rector to commit ba48cd2
Browse files Browse the repository at this point in the history
rectorphp/rector-src@ba48cd2 [Core] Ensure re-index node attributes (stmts, params, uses, args) on ChangedNodeScopeRefresher (#2458)
  • Loading branch information
TomasVotruba committed Jun 9, 2022
1 parent 4d4534b commit 3605223
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 17 deletions.
32 changes: 29 additions & 3 deletions src/Application/ChangedNodeScopeRefresher.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,19 @@
use PhpParser\Node\Attribute;
use PhpParser\Node\AttributeGroup;
use PhpParser\Node\Expr;
use PhpParser\Node\Expr\CallLike;
use PhpParser\Node\Expr\Closure;
use PhpParser\Node\Expr\FuncCall;
use PhpParser\Node\Expr\MethodCall;
use PhpParser\Node\Expr\New_;
use PhpParser\Node\Expr\NullsafeMethodCall;
use PhpParser\Node\Expr\StaticCall;
use PhpParser\Node\FunctionLike;
use PhpParser\Node\Stmt;
use PhpParser\Node\Stmt\ClassLike;
use PhpParser\Node\Stmt\ClassMethod;
use PhpParser\Node\Stmt\Expression;
use PhpParser\Node\Stmt\Function_;
use PhpParser\Node\Stmt\Property;
use PHPStan\Analyser\MutatingScope;
use Rector\Core\Contract\PhpParser\Node\StmtsAwareInterface;
Expand Down Expand Up @@ -78,12 +89,27 @@ public function refresh(Node $node, SmartFileInfo $smartFileInfo, ?MutatingScope
$attributeGroup = new AttributeGroup([$node]);
$node = new Property(0, [], [], null, [$attributeGroup]);
}
if ($node instanceof StmtsAwareInterface && $node->stmts !== null) {
$node->stmts = \array_values($node->stmts);
}
$this->reIndexNodeAttributes($node);
$stmts = $this->resolveStmts($node);
$this->phpStanNodeScopeResolver->processNodes($stmts, $smartFileInfo, $mutatingScope);
}
private function reIndexNodeAttributes(Node $node) : void
{
if (($node instanceof ClassLike || $node instanceof StmtsAwareInterface) && $node->stmts !== null) {
$node->stmts = \array_values($node->stmts);
}
if ($node instanceof FunctionLike) {
/** @var ClassMethod|Function_|Closure $node */
$node->params = \array_values($node->params);
if ($node instanceof Closure) {
$node->uses = \array_values($node->uses);
}
}
if ($node instanceof CallLike) {
/** @var FuncCall|MethodCall|New_|NullsafeMethodCall|StaticCall $node */
$node->args = \array_values($node->args);
}
}
/**
* @return Stmt[]
*/
Expand Down
4 changes: 2 additions & 2 deletions src/Application/VersionResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ final class VersionResolver
/**
* @var string
*/
public const PACKAGE_VERSION = 'ff931e4b7408b92acce925aba4a4fe9e80591a99';
public const PACKAGE_VERSION = 'ba48cd2d8704539596bad41d59545b60ff66905a';
/**
* @var string
*/
public const RELEASE_DATE = '2022-06-09 08:09:34';
public const RELEASE_DATE = '2022-06-09 08:21:09';
/**
* @var int
*/
Expand Down
2 changes: 1 addition & 1 deletion vendor/autoload.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@

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

return ComposerAutoloaderInitd01f45408157a557894cbdd6e6bbf93b::getLoader();
return ComposerAutoloaderInita9594a8d31d0a350e94df5747cde49f5::getLoader();
14 changes: 7 additions & 7 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 ComposerAutoloaderInitd01f45408157a557894cbdd6e6bbf93b
class ComposerAutoloaderInita9594a8d31d0a350e94df5747cde49f5
{
private static $loader;

Expand All @@ -22,19 +22,19 @@ public static function getLoader()
return self::$loader;
}

spl_autoload_register(array('ComposerAutoloaderInitd01f45408157a557894cbdd6e6bbf93b', 'loadClassLoader'), true, true);
spl_autoload_register(array('ComposerAutoloaderInita9594a8d31d0a350e94df5747cde49f5', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
spl_autoload_unregister(array('ComposerAutoloaderInitd01f45408157a557894cbdd6e6bbf93b', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInita9594a8d31d0a350e94df5747cde49f5', 'loadClassLoader'));

require __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInitd01f45408157a557894cbdd6e6bbf93b::getInitializer($loader));
call_user_func(\Composer\Autoload\ComposerStaticInita9594a8d31d0a350e94df5747cde49f5::getInitializer($loader));

$loader->setClassMapAuthoritative(true);
$loader->register(true);

$includeFiles = \Composer\Autoload\ComposerStaticInitd01f45408157a557894cbdd6e6bbf93b::$files;
$includeFiles = \Composer\Autoload\ComposerStaticInita9594a8d31d0a350e94df5747cde49f5::$files;
foreach ($includeFiles as $fileIdentifier => $file) {
composerRequired01f45408157a557894cbdd6e6bbf93b($fileIdentifier, $file);
composerRequirea9594a8d31d0a350e94df5747cde49f5($fileIdentifier, $file);
}

return $loader;
Expand All @@ -46,7 +46,7 @@ public static function getLoader()
* @param string $file
* @return void
*/
function composerRequired01f45408157a557894cbdd6e6bbf93b($fileIdentifier, $file)
function composerRequirea9594a8d31d0a350e94df5747cde49f5($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 ComposerStaticInitd01f45408157a557894cbdd6e6bbf93b
class ComposerStaticInita9594a8d31d0a350e94df5747cde49f5
{
public static $files = array (
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php',
Expand Down Expand Up @@ -3389,9 +3389,9 @@ class ComposerStaticInitd01f45408157a557894cbdd6e6bbf93b
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInitd01f45408157a557894cbdd6e6bbf93b::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInitd01f45408157a557894cbdd6e6bbf93b::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInitd01f45408157a557894cbdd6e6bbf93b::$classMap;
$loader->prefixLengthsPsr4 = ComposerStaticInita9594a8d31d0a350e94df5747cde49f5::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInita9594a8d31d0a350e94df5747cde49f5::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInita9594a8d31d0a350e94df5747cde49f5::$classMap;

}, null, ClassLoader::class);
}
Expand Down

0 comments on commit 3605223

Please sign in to comment.