mirror of
https://github.com/rectorphp/rector.git
synced 2025-01-17 21:38:22 +01:00
Updated Rector to commit 2cdd339cda10577cfd45dfa18b1347780065e397
2cdd339cda
[Core] Move AbstractRector::unwrapStmts() to TokenGetAllToObjectRector as only used once at it (#1534)
This commit is contained in:
parent
b410b7e71b
commit
f5b0302b93
@ -8,6 +8,7 @@ use PhpParser\Node\Expr;
|
||||
use PhpParser\Node\Expr\Assign;
|
||||
use PhpParser\Node\Expr\FuncCall;
|
||||
use PhpParser\Node\Expr\Variable;
|
||||
use PhpParser\Node\Stmt;
|
||||
use PhpParser\Node\Stmt\ClassMethod;
|
||||
use PhpParser\Node\Stmt\Foreach_;
|
||||
use PhpParser\Node\Stmt\Function_;
|
||||
@ -150,4 +151,20 @@ CODE_SAMPLE
|
||||
}
|
||||
});
|
||||
}
|
||||
/**
|
||||
* @param Stmt[] $stmts
|
||||
*/
|
||||
private function unwrapStmts(array $stmts, \PhpParser\Node\Stmt\If_ $if) : void
|
||||
{
|
||||
// move /* */ doc block from if to first element to keep it
|
||||
$currentPhpDocInfo = $this->phpDocInfoFactory->createFromNodeOrEmpty($if);
|
||||
foreach ($stmts as $key => $stmt) {
|
||||
if ($key === 0) {
|
||||
$stmt->setAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::PHP_DOC_INFO, $currentPhpDocInfo);
|
||||
// move // comments
|
||||
$stmt->setAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::COMMENTS, $if->getComments());
|
||||
}
|
||||
$this->nodesToAddCollector->addNodeAfterNode($stmt, $if);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -16,11 +16,11 @@ final class VersionResolver
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const PACKAGE_VERSION = '490bec305cc7230afc5723371b458bed27ec24c8';
|
||||
public const PACKAGE_VERSION = '2cdd339cda10577cfd45dfa18b1347780065e397';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const RELEASE_DATE = '2021-12-20 19:01:06';
|
||||
public const RELEASE_DATE = '2021-12-20 19:02:31';
|
||||
public static function resolvePackageVersion() : string
|
||||
{
|
||||
$process = new \RectorPrefix20211220\Symfony\Component\Process\Process(['git', 'log', '--pretty="%H"', '-n1', 'HEAD'], __DIR__);
|
||||
|
@ -326,23 +326,6 @@ abstract class AbstractRector extends \PhpParser\NodeVisitorAbstract implements
|
||||
$newNode->setAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::PHP_DOC_INFO, $oldNode->getAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::PHP_DOC_INFO));
|
||||
$newNode->setAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::COMMENTS, $oldNode->getAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::COMMENTS));
|
||||
}
|
||||
/**
|
||||
* @deprecated Return array of stmts directly
|
||||
* @param Stmt[] $stmts
|
||||
*/
|
||||
protected function unwrapStmts(array $stmts, \PhpParser\Node $node) : void
|
||||
{
|
||||
// move /* */ doc block from if to first element to keep it
|
||||
$currentPhpDocInfo = $this->phpDocInfoFactory->createFromNodeOrEmpty($node);
|
||||
foreach ($stmts as $key => $ifStmt) {
|
||||
if ($key === 0) {
|
||||
$ifStmt->setAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::PHP_DOC_INFO, $currentPhpDocInfo);
|
||||
// move // comments
|
||||
$ifStmt->setAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::COMMENTS, $node->getComments());
|
||||
}
|
||||
$this->nodesToAddCollector->addNodeAfterNode($ifStmt, $node);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @param Arg[] $currentArgs
|
||||
* @param Arg[] $appendingArgs
|
||||
|
2
vendor/autoload.php
vendored
2
vendor/autoload.php
vendored
@ -4,4 +4,4 @@
|
||||
|
||||
require_once __DIR__ . '/composer/autoload_real.php';
|
||||
|
||||
return ComposerAutoloaderInit1dbdd5505407b42a6a5cdcbbbc24c674::getLoader();
|
||||
return ComposerAutoloaderInitae22fc906da3cae5d930f1315a9c9596::getLoader();
|
||||
|
14
vendor/composer/autoload_real.php
vendored
14
vendor/composer/autoload_real.php
vendored
@ -2,7 +2,7 @@
|
||||
|
||||
// autoload_real.php @generated by Composer
|
||||
|
||||
class ComposerAutoloaderInit1dbdd5505407b42a6a5cdcbbbc24c674
|
||||
class ComposerAutoloaderInitae22fc906da3cae5d930f1315a9c9596
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
@ -22,15 +22,15 @@ class ComposerAutoloaderInit1dbdd5505407b42a6a5cdcbbbc24c674
|
||||
return self::$loader;
|
||||
}
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInit1dbdd5505407b42a6a5cdcbbbc24c674', 'loadClassLoader'), true, true);
|
||||
spl_autoload_register(array('ComposerAutoloaderInitae22fc906da3cae5d930f1315a9c9596', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit1dbdd5505407b42a6a5cdcbbbc24c674', 'loadClassLoader'));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInitae22fc906da3cae5d930f1315a9c9596', '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\ComposerStaticInit1dbdd5505407b42a6a5cdcbbbc24c674::getInitializer($loader));
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInitae22fc906da3cae5d930f1315a9c9596::getInitializer($loader));
|
||||
} else {
|
||||
$classMap = require __DIR__ . '/autoload_classmap.php';
|
||||
if ($classMap) {
|
||||
@ -42,19 +42,19 @@ class ComposerAutoloaderInit1dbdd5505407b42a6a5cdcbbbc24c674
|
||||
$loader->register(true);
|
||||
|
||||
if ($useStaticLoader) {
|
||||
$includeFiles = Composer\Autoload\ComposerStaticInit1dbdd5505407b42a6a5cdcbbbc24c674::$files;
|
||||
$includeFiles = Composer\Autoload\ComposerStaticInitae22fc906da3cae5d930f1315a9c9596::$files;
|
||||
} else {
|
||||
$includeFiles = require __DIR__ . '/autoload_files.php';
|
||||
}
|
||||
foreach ($includeFiles as $fileIdentifier => $file) {
|
||||
composerRequire1dbdd5505407b42a6a5cdcbbbc24c674($fileIdentifier, $file);
|
||||
composerRequireae22fc906da3cae5d930f1315a9c9596($fileIdentifier, $file);
|
||||
}
|
||||
|
||||
return $loader;
|
||||
}
|
||||
}
|
||||
|
||||
function composerRequire1dbdd5505407b42a6a5cdcbbbc24c674($fileIdentifier, $file)
|
||||
function composerRequireae22fc906da3cae5d930f1315a9c9596($fileIdentifier, $file)
|
||||
{
|
||||
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
||||
require $file;
|
||||
|
8
vendor/composer/autoload_static.php
vendored
8
vendor/composer/autoload_static.php
vendored
@ -4,7 +4,7 @@
|
||||
|
||||
namespace Composer\Autoload;
|
||||
|
||||
class ComposerStaticInit1dbdd5505407b42a6a5cdcbbbc24c674
|
||||
class ComposerStaticInitae22fc906da3cae5d930f1315a9c9596
|
||||
{
|
||||
public static $files = array (
|
||||
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php',
|
||||
@ -3832,9 +3832,9 @@ class ComposerStaticInit1dbdd5505407b42a6a5cdcbbbc24c674
|
||||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit1dbdd5505407b42a6a5cdcbbbc24c674::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit1dbdd5505407b42a6a5cdcbbbc24c674::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit1dbdd5505407b42a6a5cdcbbbc24c674::$classMap;
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInitae22fc906da3cae5d930f1315a9c9596::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInitae22fc906da3cae5d930f1315a9c9596::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInitae22fc906da3cae5d930f1315a9c9596::$classMap;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
|
10
vendor/scoper-autoload.php
vendored
10
vendor/scoper-autoload.php
vendored
@ -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('RectorPrefix20211220\AutoloadIncluder');
|
||||
}
|
||||
if (!class_exists('ComposerAutoloaderInit1dbdd5505407b42a6a5cdcbbbc24c674', false) && !interface_exists('ComposerAutoloaderInit1dbdd5505407b42a6a5cdcbbbc24c674', false) && !trait_exists('ComposerAutoloaderInit1dbdd5505407b42a6a5cdcbbbc24c674', false)) {
|
||||
spl_autoload_call('RectorPrefix20211220\ComposerAutoloaderInit1dbdd5505407b42a6a5cdcbbbc24c674');
|
||||
if (!class_exists('ComposerAutoloaderInitae22fc906da3cae5d930f1315a9c9596', false) && !interface_exists('ComposerAutoloaderInitae22fc906da3cae5d930f1315a9c9596', false) && !trait_exists('ComposerAutoloaderInitae22fc906da3cae5d930f1315a9c9596', false)) {
|
||||
spl_autoload_call('RectorPrefix20211220\ComposerAutoloaderInitae22fc906da3cae5d930f1315a9c9596');
|
||||
}
|
||||
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('RectorPrefix20211220\Helmich\TypoScriptParser\Parser\AST\Statement');
|
||||
@ -78,9 +78,9 @@ if (!function_exists('print_node')) {
|
||||
return \RectorPrefix20211220\print_node(...func_get_args());
|
||||
}
|
||||
}
|
||||
if (!function_exists('composerRequire1dbdd5505407b42a6a5cdcbbbc24c674')) {
|
||||
function composerRequire1dbdd5505407b42a6a5cdcbbbc24c674() {
|
||||
return \RectorPrefix20211220\composerRequire1dbdd5505407b42a6a5cdcbbbc24c674(...func_get_args());
|
||||
if (!function_exists('composerRequireae22fc906da3cae5d930f1315a9c9596')) {
|
||||
function composerRequireae22fc906da3cae5d930f1315a9c9596() {
|
||||
return \RectorPrefix20211220\composerRequireae22fc906da3cae5d930f1315a9c9596(...func_get_args());
|
||||
}
|
||||
}
|
||||
if (!function_exists('scanPath')) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user