Updated Rector to commit f4f94bcd4bb9fd9819ae11b1d2b06b74a078c205

f4f94bcd4b [NodeTraverser] Remove double apply FileWithoutNamespace, remove recursive lookup stmts on BetterStandardPrinter (#4097)
This commit is contained in:
Tomas Votruba 2023-06-07 02:01:28 +00:00
parent da05109534
commit 348aef8907
7 changed files with 18 additions and 14 deletions

View File

@ -146,7 +146,8 @@ final class PHPStanNodeScopeResolver
*/
Assert::allIsInstanceOf($stmts, Stmt::class);
$this->nodeTraverser->traverse($stmts);
if (!$isScopeRefreshing) {
$isFileWithoutNamespace = \count($stmts) === 1 && $stmts[0] instanceof FileWithoutNamespace;
if (!$isScopeRefreshing && !$isFileWithoutNamespace) {
$stmts = $this->fileWithoutNamespaceNodeTraverser->traverse($stmts);
if (\count($stmts) === 1 && $stmts[0] instanceof FileWithoutNamespace) {
$stmts = $stmts[0]->stmts;

View File

@ -19,12 +19,12 @@ final class VersionResolver
* @api
* @var string
*/
public const PACKAGE_VERSION = 'b7760eb6fcfd4d809723e4dfd54ece8d437baff0';
public const PACKAGE_VERSION = 'f4f94bcd4bb9fd9819ae11b1d2b06b74a078c205';
/**
* @api
* @var string
*/
public const RELEASE_DATE = '2023-06-06 23:09:54';
public const RELEASE_DATE = '2023-06-07 08:56:48';
/**
* @var int
*/

View File

@ -27,6 +27,9 @@ final class FileWithoutNamespaceNodeTraverser extends NodeTraverser
*/
public function traverse(array $nodes) : array
{
if (\current($nodes) instanceof FileWithoutNamespace) {
return $nodes;
}
$hasNamespace = (bool) $this->nodeFinder->findFirstInstanceOf($nodes, Namespace_::class);
if (!$hasNamespace && $nodes !== []) {
$fileWithoutNamespace = new FileWithoutNamespace($nodes);

View File

@ -425,7 +425,7 @@ final class BetterStandardPrinter extends Standard implements NodePrinterInterfa
{
$stmts = \array_values($stmts);
if (\count($stmts) === 1 && $stmts[0] instanceof FileWithoutNamespace) {
return $this->resolveNewStmts($stmts[0]->stmts);
return $stmts[0]->stmts;
}
return $stmts;
}

2
vendor/autoload.php vendored
View File

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

View File

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