Updated Rector to commit 3fd890bd89401bfe84259501a2b6e6ae90539399

3fd890bd89 [Core] Reduce getNewStmts() call on FormatPerservingPrinter (#1652)
This commit is contained in:
Tomas Votruba 2022-01-09 14:45:03 +00:00
parent 84f7817be9
commit c553da1f2e
6 changed files with 29 additions and 25 deletions

View File

@ -16,11 +16,11 @@ final class VersionResolver
/**
* @var string
*/
public const PACKAGE_VERSION = '6cc687059719ed962c18b08ea173b71714f215cf';
public const PACKAGE_VERSION = '3fd890bd89401bfe84259501a2b6e6ae90539399';
/**
* @var string
*/
public const RELEASE_DATE = '2022-01-09 14:23:45';
public const RELEASE_DATE = '2022-01-09 14:38:49';
public static function resolvePackageVersion() : string
{
$process = new \RectorPrefix20220109\Symfony\Component\Process\Process(['git', 'log', '--pretty="%H"', '-n1', 'HEAD'], __DIR__);

View File

@ -5,6 +5,7 @@ namespace Rector\Core\PhpParser\Printer;
use PhpParser\Node;
use PhpParser\Node\Stmt;
use PhpParser\Node\Stmt\Namespace_;
use Rector\Core\PhpParser\Node\CustomNode\FileWithoutNamespace;
use Rector\Core\ValueObject\Application\File;
use Symplify\SmartFileSystem\SmartFileInfo;
@ -56,12 +57,15 @@ final class FormatPerservingPrinter
*/
private function resolveNewStmts(\Rector\Core\ValueObject\Application\File $file) : array
{
if (\count($file->getNewStmts()) === 1) {
$onlyStmt = $file->getNewStmts()[0];
if ($onlyStmt instanceof \Rector\Core\PhpParser\Node\CustomNode\FileWithoutNamespace) {
return $onlyStmt->stmts;
}
$newStmts = $file->getNewStmts();
if (\count($newStmts) !== 1) {
return $newStmts;
}
return $file->getNewStmts();
/** @var Namespace_|FileWithoutNamespace $onlyStmt */
$onlyStmt = $newStmts[0];
if (!$onlyStmt instanceof \Rector\Core\PhpParser\Node\CustomNode\FileWithoutNamespace) {
return $newStmts;
}
return $onlyStmt->stmts;
}
}

2
vendor/autoload.php vendored
View File

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

View File

@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer
class ComposerAutoloaderInit3a0b39f3a8637b74e3b7a9b05527d3c4
class ComposerAutoloaderInit4f7b69cbb5796824b7fcf242a658864b
{
private static $loader;
@ -22,15 +22,15 @@ class ComposerAutoloaderInit3a0b39f3a8637b74e3b7a9b05527d3c4
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInit3a0b39f3a8637b74e3b7a9b05527d3c4', 'loadClassLoader'), true, true);
spl_autoload_register(array('ComposerAutoloaderInit4f7b69cbb5796824b7fcf242a658864b', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
spl_autoload_unregister(array('ComposerAutoloaderInit3a0b39f3a8637b74e3b7a9b05527d3c4', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInit4f7b69cbb5796824b7fcf242a658864b', '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\ComposerStaticInit3a0b39f3a8637b74e3b7a9b05527d3c4::getInitializer($loader));
call_user_func(\Composer\Autoload\ComposerStaticInit4f7b69cbb5796824b7fcf242a658864b::getInitializer($loader));
} else {
$classMap = require __DIR__ . '/autoload_classmap.php';
if ($classMap) {
@ -42,12 +42,12 @@ class ComposerAutoloaderInit3a0b39f3a8637b74e3b7a9b05527d3c4
$loader->register(true);
if ($useStaticLoader) {
$includeFiles = Composer\Autoload\ComposerStaticInit3a0b39f3a8637b74e3b7a9b05527d3c4::$files;
$includeFiles = Composer\Autoload\ComposerStaticInit4f7b69cbb5796824b7fcf242a658864b::$files;
} else {
$includeFiles = require __DIR__ . '/autoload_files.php';
}
foreach ($includeFiles as $fileIdentifier => $file) {
composerRequire3a0b39f3a8637b74e3b7a9b05527d3c4($fileIdentifier, $file);
composerRequire4f7b69cbb5796824b7fcf242a658864b($fileIdentifier, $file);
}
return $loader;
@ -59,7 +59,7 @@ class ComposerAutoloaderInit3a0b39f3a8637b74e3b7a9b05527d3c4
* @param string $file
* @return void
*/
function composerRequire3a0b39f3a8637b74e3b7a9b05527d3c4($fileIdentifier, $file)
function composerRequire4f7b69cbb5796824b7fcf242a658864b($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 ComposerStaticInit3a0b39f3a8637b74e3b7a9b05527d3c4
class ComposerStaticInit4f7b69cbb5796824b7fcf242a658864b
{
public static $files = array (
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php',
@ -3853,9 +3853,9 @@ class ComposerStaticInit3a0b39f3a8637b74e3b7a9b05527d3c4
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInit3a0b39f3a8637b74e3b7a9b05527d3c4::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit3a0b39f3a8637b74e3b7a9b05527d3c4::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit3a0b39f3a8637b74e3b7a9b05527d3c4::$classMap;
$loader->prefixLengthsPsr4 = ComposerStaticInit4f7b69cbb5796824b7fcf242a658864b::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit4f7b69cbb5796824b7fcf242a658864b::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit4f7b69cbb5796824b7fcf242a658864b::$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('RectorPrefix20220109\AutoloadIncluder');
}
if (!class_exists('ComposerAutoloaderInit3a0b39f3a8637b74e3b7a9b05527d3c4', false) && !interface_exists('ComposerAutoloaderInit3a0b39f3a8637b74e3b7a9b05527d3c4', false) && !trait_exists('ComposerAutoloaderInit3a0b39f3a8637b74e3b7a9b05527d3c4', false)) {
spl_autoload_call('RectorPrefix20220109\ComposerAutoloaderInit3a0b39f3a8637b74e3b7a9b05527d3c4');
if (!class_exists('ComposerAutoloaderInit4f7b69cbb5796824b7fcf242a658864b', false) && !interface_exists('ComposerAutoloaderInit4f7b69cbb5796824b7fcf242a658864b', false) && !trait_exists('ComposerAutoloaderInit4f7b69cbb5796824b7fcf242a658864b', false)) {
spl_autoload_call('RectorPrefix20220109\ComposerAutoloaderInit4f7b69cbb5796824b7fcf242a658864b');
}
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('RectorPrefix20220109\Helmich\TypoScriptParser\Parser\AST\Statement');
@ -71,9 +71,9 @@ if (!function_exists('print_node')) {
return \RectorPrefix20220109\print_node(...func_get_args());
}
}
if (!function_exists('composerRequire3a0b39f3a8637b74e3b7a9b05527d3c4')) {
function composerRequire3a0b39f3a8637b74e3b7a9b05527d3c4() {
return \RectorPrefix20220109\composerRequire3a0b39f3a8637b74e3b7a9b05527d3c4(...func_get_args());
if (!function_exists('composerRequire4f7b69cbb5796824b7fcf242a658864b')) {
function composerRequire4f7b69cbb5796824b7fcf242a658864b() {
return \RectorPrefix20220109\composerRequire4f7b69cbb5796824b7fcf242a658864b(...func_get_args());
}
}
if (!function_exists('scanPath')) {