Updated Rector to commit 02df44373272ac230c2d8463e0d101a3ce927da2

02df443732 [NodeTraverser] Add NodeConnectingTraverser (#3531)
This commit is contained in:
Tomas Votruba 2023-03-28 16:34:39 +00:00
parent d1b207c569
commit 3398669910
8 changed files with 46 additions and 24 deletions

View File

@ -19,12 +19,12 @@ final class VersionResolver
* @api
* @var string
*/
public const PACKAGE_VERSION = '87186dd873893b15bc4ef881348e02a224e16c07';
public const PACKAGE_VERSION = '02df44373272ac230c2d8463e0d101a3ce927da2';
/**
* @api
* @var string
*/
public const RELEASE_DATE = '2023-03-28 16:34:13';
public const RELEASE_DATE = '2023-03-28 18:24:58';
/**
* @var int
*/

View File

@ -0,0 +1,15 @@
<?php
declare (strict_types=1);
namespace Rector\Core\PhpParser\NodeTraverser;
use PhpParser\NodeTraverser;
use PhpParser\NodeVisitor\NodeConnectingVisitor;
final class NodeConnectingTraverser extends NodeTraverser
{
public function __construct()
{
parent::__construct();
$this->addVisitor(new NodeConnectingVisitor());
}
}

View File

@ -5,10 +5,9 @@ namespace Rector\Core\PhpParser\Parser;
use RectorPrefix202303\Nette\Utils\FileSystem;
use PhpParser\Node\Stmt;
use PhpParser\NodeTraverser;
use PhpParser\NodeVisitor\NodeConnectingVisitor;
use PhpParser\Parser;
use PhpParser\ParserFactory;
use Rector\Core\PhpParser\NodeTraverser\NodeConnectingTraverser;
final class SimplePhpParser
{
/**
@ -16,8 +15,14 @@ final class SimplePhpParser
* @var \PhpParser\Parser
*/
private $phpParser;
public function __construct()
/**
* @readonly
* @var \Rector\Core\PhpParser\NodeTraverser\NodeConnectingTraverser
*/
private $nodeConnectingTraverser;
public function __construct(NodeConnectingTraverser $nodeConnectingTraverser)
{
$this->nodeConnectingTraverser = $nodeConnectingTraverser;
$parserFactory = new ParserFactory();
$this->phpParser = $parserFactory->create(ParserFactory::PREFER_PHP7);
}
@ -39,8 +44,6 @@ final class SimplePhpParser
if ($stmts === null) {
return [];
}
$nodeTraverser = new NodeTraverser();
$nodeTraverser->addVisitor(new NodeConnectingVisitor());
return $nodeTraverser->traverse($stmts);
return $this->nodeConnectingTraverser->traverse($stmts);
}
}

View File

@ -10,8 +10,6 @@ use PhpParser\Node\Stmt;
use PhpParser\Node\Stmt\Expression;
use PhpParser\Node\Stmt\InlineHTML;
use PhpParser\Node\Stmt\Nop;
use PhpParser\NodeTraverser;
use PhpParser\NodeVisitor\NodeConnectingVisitor;
use PhpParser\NodeVisitorAbstract;
use PHPStan\Analyser\MutatingScope;
use PHPStan\Type\ObjectType;
@ -31,6 +29,7 @@ use Rector\Core\PhpParser\Comparing\NodeComparator;
use Rector\Core\PhpParser\Node\BetterNodeFinder;
use Rector\Core\PhpParser\Node\NodeFactory;
use Rector\Core\PhpParser\Node\Value\ValueResolver;
use Rector\Core\PhpParser\NodeTraverser\NodeConnectingTraverser;
use Rector\Core\ProcessAnalyzer\RectifiedAnalyzer;
use Rector\Core\Provider\CurrentFileProvider;
use Rector\Core\ValueObject\Application\File;
@ -153,10 +152,14 @@ CODE_SAMPLE;
* @var \Rector\Comments\NodeDocBlock\DocBlockUpdater
*/
private $docBlockUpdater;
/**
* @var \Rector\Core\PhpParser\NodeTraverser\NodeConnectingTraverser
*/
private $nodeConnectingTraverser;
/**
* @required
*/
public function autowire(NodesToRemoveCollector $nodesToRemoveCollector, NodeRemover $nodeRemover, NodeNameResolver $nodeNameResolver, NodeTypeResolver $nodeTypeResolver, SimpleCallableNodeTraverser $simpleCallableNodeTraverser, NodeFactory $nodeFactory, PhpDocInfoFactory $phpDocInfoFactory, StaticTypeMapper $staticTypeMapper, CurrentRectorProvider $currentRectorProvider, CurrentNodeProvider $currentNodeProvider, Skipper $skipper, ValueResolver $valueResolver, BetterNodeFinder $betterNodeFinder, NodeComparator $nodeComparator, CurrentFileProvider $currentFileProvider, RectifiedAnalyzer $rectifiedAnalyzer, CreatedByRuleDecorator $createdByRuleDecorator, ChangedNodeScopeRefresher $changedNodeScopeRefresher, RectorOutputStyle $rectorOutputStyle, FilePathHelper $filePathHelper, DocBlockUpdater $docBlockUpdater) : void
public function autowire(NodesToRemoveCollector $nodesToRemoveCollector, NodeRemover $nodeRemover, NodeNameResolver $nodeNameResolver, NodeTypeResolver $nodeTypeResolver, SimpleCallableNodeTraverser $simpleCallableNodeTraverser, NodeFactory $nodeFactory, PhpDocInfoFactory $phpDocInfoFactory, StaticTypeMapper $staticTypeMapper, CurrentRectorProvider $currentRectorProvider, CurrentNodeProvider $currentNodeProvider, Skipper $skipper, ValueResolver $valueResolver, BetterNodeFinder $betterNodeFinder, NodeComparator $nodeComparator, CurrentFileProvider $currentFileProvider, RectifiedAnalyzer $rectifiedAnalyzer, CreatedByRuleDecorator $createdByRuleDecorator, ChangedNodeScopeRefresher $changedNodeScopeRefresher, RectorOutputStyle $rectorOutputStyle, FilePathHelper $filePathHelper, DocBlockUpdater $docBlockUpdater, NodeConnectingTraverser $nodeConnectingTraverser) : void
{
$this->nodesToRemoveCollector = $nodesToRemoveCollector;
$this->nodeRemover = $nodeRemover;
@ -179,6 +182,7 @@ CODE_SAMPLE;
$this->rectorOutputStyle = $rectorOutputStyle;
$this->filePathHelper = $filePathHelper;
$this->docBlockUpdater = $docBlockUpdater;
$this->nodeConnectingTraverser = $nodeConnectingTraverser;
}
/**
* @return Node[]|null
@ -394,9 +398,7 @@ CODE_SAMPLE;
$nextNode = $node->getAttribute(AttributeKey::NEXT_NODE);
$nodes = \array_merge(\is_array($nodes) ? $nodes : \iterator_to_array($nodes), [$nextNode]);
}
$nodeTraverser = new NodeTraverser();
$nodeTraverser->addVisitor(new NodeConnectingVisitor());
$nodeTraverser->traverse($nodes);
$this->nodeConnectingTraverser->traverse($nodes);
}
private function printDebugCurrentFileAndRule() : void
{

2
vendor/autoload.php vendored
View File

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

View File

@ -1524,6 +1524,7 @@ return array(
'Rector\\Core\\PhpParser\\NodeFinder\\PropertyFetchFinder' => $baseDir . '/src/PhpParser/NodeFinder/PropertyFetchFinder.php',
'Rector\\Core\\PhpParser\\NodeTransformer' => $baseDir . '/src/PhpParser/NodeTransformer.php',
'Rector\\Core\\PhpParser\\NodeTraverser\\FileWithoutNamespaceNodeTraverser' => $baseDir . '/src/PhpParser/NodeTraverser/FileWithoutNamespaceNodeTraverser.php',
'Rector\\Core\\PhpParser\\NodeTraverser\\NodeConnectingTraverser' => $baseDir . '/src/PhpParser/NodeTraverser/NodeConnectingTraverser.php',
'Rector\\Core\\PhpParser\\NodeTraverser\\RectorNodeTraverser' => $baseDir . '/src/PhpParser/NodeTraverser/RectorNodeTraverser.php',
'Rector\\Core\\PhpParser\\Node\\AssignAndBinaryMap' => $baseDir . '/src/PhpParser/Node/AssignAndBinaryMap.php',
'Rector\\Core\\PhpParser\\Node\\BetterNodeFinder' => $baseDir . '/src/PhpParser/Node/BetterNodeFinder.php',

View File

@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer
class ComposerAutoloaderInit894a20a8f22ec44eb8600d85bb3772dd
class ComposerAutoloaderInit2d6bd512631b717b2d010ac1d9465997
{
private static $loader;
@ -22,17 +22,17 @@ class ComposerAutoloaderInit894a20a8f22ec44eb8600d85bb3772dd
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInit894a20a8f22ec44eb8600d85bb3772dd', 'loadClassLoader'), true, true);
spl_autoload_register(array('ComposerAutoloaderInit2d6bd512631b717b2d010ac1d9465997', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
spl_autoload_unregister(array('ComposerAutoloaderInit894a20a8f22ec44eb8600d85bb3772dd', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInit2d6bd512631b717b2d010ac1d9465997', 'loadClassLoader'));
require __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInit894a20a8f22ec44eb8600d85bb3772dd::getInitializer($loader));
call_user_func(\Composer\Autoload\ComposerStaticInit2d6bd512631b717b2d010ac1d9465997::getInitializer($loader));
$loader->setClassMapAuthoritative(true);
$loader->register(true);
$filesToLoad = \Composer\Autoload\ComposerStaticInit894a20a8f22ec44eb8600d85bb3772dd::$files;
$filesToLoad = \Composer\Autoload\ComposerStaticInit2d6bd512631b717b2d010ac1d9465997::$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 ComposerStaticInit894a20a8f22ec44eb8600d85bb3772dd
class ComposerStaticInit2d6bd512631b717b2d010ac1d9465997
{
public static $files = array (
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
@ -1771,6 +1771,7 @@ class ComposerStaticInit894a20a8f22ec44eb8600d85bb3772dd
'Rector\\Core\\PhpParser\\NodeFinder\\PropertyFetchFinder' => __DIR__ . '/../..' . '/src/PhpParser/NodeFinder/PropertyFetchFinder.php',
'Rector\\Core\\PhpParser\\NodeTransformer' => __DIR__ . '/../..' . '/src/PhpParser/NodeTransformer.php',
'Rector\\Core\\PhpParser\\NodeTraverser\\FileWithoutNamespaceNodeTraverser' => __DIR__ . '/../..' . '/src/PhpParser/NodeTraverser/FileWithoutNamespaceNodeTraverser.php',
'Rector\\Core\\PhpParser\\NodeTraverser\\NodeConnectingTraverser' => __DIR__ . '/../..' . '/src/PhpParser/NodeTraverser/NodeConnectingTraverser.php',
'Rector\\Core\\PhpParser\\NodeTraverser\\RectorNodeTraverser' => __DIR__ . '/../..' . '/src/PhpParser/NodeTraverser/RectorNodeTraverser.php',
'Rector\\Core\\PhpParser\\Node\\AssignAndBinaryMap' => __DIR__ . '/../..' . '/src/PhpParser/Node/AssignAndBinaryMap.php',
'Rector\\Core\\PhpParser\\Node\\BetterNodeFinder' => __DIR__ . '/../..' . '/src/PhpParser/Node/BetterNodeFinder.php',
@ -3127,9 +3128,9 @@ class ComposerStaticInit894a20a8f22ec44eb8600d85bb3772dd
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInit894a20a8f22ec44eb8600d85bb3772dd::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit894a20a8f22ec44eb8600d85bb3772dd::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit894a20a8f22ec44eb8600d85bb3772dd::$classMap;
$loader->prefixLengthsPsr4 = ComposerStaticInit2d6bd512631b717b2d010ac1d9465997::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit2d6bd512631b717b2d010ac1d9465997::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit2d6bd512631b717b2d010ac1d9465997::$classMap;
}, null, ClassLoader::class);
}