Updated Rector to commit c8b47df3e4

c8b47df3e4 [Core] Remove loop on FilesFinder::findInDirectoriesAndFiles() (#2201)
This commit is contained in:
Tomas Votruba 2022-04-30 06:41:39 +00:00
parent a36b608f99
commit 7a30fbb500
14 changed files with 37 additions and 39 deletions

View File

@ -17,7 +17,7 @@ final class UnchangedFilesFilter
$this->changedFilesDetector = $changedFilesDetector;
}
/**
* @param SmartFileInfo[] $fileInfos
* @param SmartFileInfo[]|string[] $fileInfos
* @return SmartFileInfo[]
*/
public function filterAndJoinWithDependentFileInfos(array $fileInfos) : array
@ -25,6 +25,9 @@ final class UnchangedFilesFilter
$changedFileInfos = [];
$dependentFileInfos = [];
foreach ($fileInfos as $fileInfo) {
if (\is_string($fileInfo)) {
$fileInfo = new \Symplify\SmartFileSystem\SmartFileInfo($fileInfo);
}
if (!$this->changedFilesDetector->hasFileChanged($fileInfo)) {
continue;
}

View File

@ -76,7 +76,7 @@ CODE_SAMPLE
$leftParam = new \PhpParser\Node\Param($leftVariableParam);
$rightParam = new \PhpParser\Node\Param($rightVariableParam);
$anonymousFunction->params = [$leftParam, $rightParam];
$if = $this->ifManipulator->createIfExpr(new \PhpParser\Node\Expr\BinaryOp\Identical($leftVariableParam, $rightVariableParam), new \PhpParser\Node\Stmt\Return_(new \PhpParser\Node\Scalar\LNumber(0)));
$if = $this->ifManipulator->createIfStmt(new \PhpParser\Node\Expr\BinaryOp\Identical($leftVariableParam, $rightVariableParam), new \PhpParser\Node\Stmt\Return_(new \PhpParser\Node\Scalar\LNumber(0)));
$anonymousFunction->stmts[0] = $if;
$smaller = new \PhpParser\Node\Expr\BinaryOp\Smaller($leftVariableParam, $rightVariableParam);
$ternaryIf = new \PhpParser\Node\Scalar\LNumber(-1);

View File

@ -149,7 +149,7 @@ CODE_SAMPLE
$param->byRef = \true;
$closure->params = [$param];
$assign = new \PhpParser\Node\Expr\Assign($variablePass, $this->nodeFactory->createNull());
$if = $this->ifManipulator->createIfExpr(new \PhpParser\Node\Expr\BinaryOp\Identical($variablePass, new \PhpParser\Node\Scalar\String_('')), new \PhpParser\Node\Stmt\Expression($assign));
$if = $this->ifManipulator->createIfStmt(new \PhpParser\Node\Expr\BinaryOp\Identical($variablePass, new \PhpParser\Node\Scalar\String_('')), new \PhpParser\Node\Stmt\Expression($assign));
$closure->stmts[0] = $if;
$arguments = $this->nodeFactory->createArgs([$variable, $closure]);
$replaceEmptyStringToNull = $this->nodeFactory->createFuncCall('array_walk_recursive', $arguments);

View File

@ -123,7 +123,7 @@ CODE_SAMPLE
return null;
}
$inversedTernaryCond = $this->binaryOpManipulator->inverseNode($ternary->cond);
$if = $this->ifManipulator->createIfExpr($inversedTernaryCond, new \PhpParser\Node\Stmt\Expression($ternary->else));
$if = $this->ifManipulator->createIfStmt($inversedTernaryCond, new \PhpParser\Node\Stmt\Expression($ternary->else));
if (!$assign instanceof \PhpParser\Node\Expr\Assign) {
return $if;
}
@ -142,7 +142,7 @@ CODE_SAMPLE
return null;
}
$condExpr = $this->createCondExpr($coalesce);
$if = $this->ifManipulator->createIfExpr($condExpr, new \PhpParser\Node\Stmt\Expression($coalesce->right));
$if = $this->ifManipulator->createIfStmt($condExpr, new \PhpParser\Node\Stmt\Expression($coalesce->right));
if (!$assign instanceof \PhpParser\Node\Expr\Assign) {
return $if;
}

View File

@ -131,7 +131,7 @@ CODE_SAMPLE
$assignValue = $value;
foreach ($classConstFetchNames as $classConstFetchName) {
$methodCallName = self::MAP_CONSTANT_TO_METHOD[$classConstFetchName];
$ifs[] = $this->ifManipulator->createIfExpr(new \PhpParser\Node\Expr\MethodCall($valueVariable, $methodCallName), new \PhpParser\Node\Stmt\Expression(new \PhpParser\Node\Expr\Assign($arrayDimFetch, $assignValue)));
$ifs[] = $this->ifManipulator->createIfStmt(new \PhpParser\Node\Expr\MethodCall($valueVariable, $methodCallName), new \PhpParser\Node\Stmt\Expression(new \PhpParser\Node\Expr\Assign($arrayDimFetch, $assignValue)));
}
$closure = new \PhpParser\Node\Expr\Closure();
$closure->params = [new \PhpParser\Node\Param(new \PhpParser\Node\Expr\Variable('value'))];

View File

@ -110,10 +110,10 @@ CODE_SAMPLE
{
while ($expr instanceof \PhpParser\Node\Expr\BinaryOp\BooleanOr) {
$ifs = \array_merge($ifs, $this->collectLeftbooleanOrToIfs($expr, $continue, $ifs));
$ifs[] = $this->ifManipulator->createIfExpr($expr->right, $continue);
$ifs[] = $this->ifManipulator->createIfStmt($expr->right, $continue);
$expr = $expr->right;
}
return $ifs + [$this->ifManipulator->createIfExpr($expr, $continue)];
return $ifs + [$this->ifManipulator->createIfStmt($expr, $continue)];
}
/**
* @param If_[] $ifs
@ -123,7 +123,7 @@ CODE_SAMPLE
{
$left = $booleanOr->left;
if (!$left instanceof \PhpParser\Node\Expr\BinaryOp\BooleanOr) {
return [$this->ifManipulator->createIfExpr($left, $continue)];
return [$this->ifManipulator->createIfStmt($left, $continue)];
}
return $this->createMultipleIfs($left, $continue, $ifs);
}

View File

@ -105,7 +105,7 @@ CODE_SAMPLE
{
while ($expr instanceof \PhpParser\Node\Expr\BinaryOp\BooleanOr) {
$ifs = \array_merge($ifs, $this->collectLeftBooleanOrToIfs($expr, $return, $ifs));
$ifs[] = $this->ifManipulator->createIfExpr($expr->right, new \PhpParser\Node\Stmt\Return_($this->nodeFactory->createTrue()));
$ifs[] = $this->ifManipulator->createIfStmt($expr->right, new \PhpParser\Node\Stmt\Return_($this->nodeFactory->createTrue()));
$expr = $expr->right;
if ($expr instanceof \PhpParser\Node\Expr\BinaryOp\BooleanAnd) {
return [];
@ -115,7 +115,7 @@ CODE_SAMPLE
}
return [];
}
return $ifs + [$this->ifManipulator->createIfExpr($expr, new \PhpParser\Node\Stmt\Return_($this->nodeFactory->createTrue()))];
return $ifs + [$this->ifManipulator->createIfStmt($expr, new \PhpParser\Node\Stmt\Return_($this->nodeFactory->createTrue()))];
}
/**
* @param If_[] $ifs
@ -125,7 +125,7 @@ CODE_SAMPLE
{
$left = $BooleanOr->left;
if (!$left instanceof \PhpParser\Node\Expr\BinaryOp\BooleanOr) {
return [$this->ifManipulator->createIfExpr($left, new \PhpParser\Node\Stmt\Return_($this->nodeFactory->createTrue()))];
return [$this->ifManipulator->createIfStmt($left, new \PhpParser\Node\Stmt\Return_($this->nodeFactory->createTrue()))];
}
return $this->createMultipleIfs($left, $return, $ifs);
}

View File

@ -16,11 +16,11 @@ final class VersionResolver
/**
* @var string
*/
public const PACKAGE_VERSION = 'e782cccb55cbf416c381f8a776b19fd67bc20fdf';
public const PACKAGE_VERSION = 'c8b47df3e4fbd475e474528391e24d2902cd4a8f';
/**
* @var string
*/
public const RELEASE_DATE = '2022-04-30 08:33:51';
public const RELEASE_DATE = '2022-04-30 08:34:40';
/**
* @var string
*/

View File

@ -77,11 +77,7 @@ final class FilesFinder
$filesAndDirectories = $this->filesystemTweaker->resolveWithFnmatch($source);
$filePaths = $this->fileSystemFilter->filterFiles($filesAndDirectories);
$directories = $this->fileSystemFilter->filterDirectories($filesAndDirectories);
$smartFileInfos = [];
foreach ($filePaths as $filePath) {
$smartFileInfos[] = new \Symplify\SmartFileSystem\SmartFileInfo($filePath);
}
$smartFileInfos = $this->unchangedFilesFilter->filterAndJoinWithDependentFileInfos($smartFileInfos);
$smartFileInfos = $this->unchangedFilesFilter->filterAndJoinWithDependentFileInfos($filePaths);
return \array_merge($smartFileInfos, $this->findInDirectories($directories, $suffixes));
}
/**

View File

@ -12,7 +12,6 @@ use PhpParser\Node\Expr\Exit_;
use PhpParser\Node\Expr\FuncCall;
use PhpParser\Node\Expr\Variable;
use PhpParser\Node\Stmt;
use PhpParser\Node\Stmt\Expression;
use PhpParser\Node\Stmt\Foreach_;
use PhpParser\Node\Stmt\If_;
use PhpParser\Node\Stmt\Return_;
@ -241,9 +240,9 @@ final class IfManipulator
public function createIfNegation(\PhpParser\Node\Expr $expr, \PhpParser\Node\Stmt $stmt) : \PhpParser\Node\Stmt\If_
{
$expr = $this->conditionInverter->createInvertedCondition($expr);
return $this->createIfExpr($expr, $stmt);
return $this->createIfStmt($expr, $stmt);
}
public function createIfExpr(\PhpParser\Node\Expr $expr, \PhpParser\Node\Stmt $stmt) : \PhpParser\Node\Stmt\If_
public function createIfStmt(\PhpParser\Node\Expr $expr, \PhpParser\Node\Stmt $stmt) : \PhpParser\Node\Stmt\If_
{
return new \PhpParser\Node\Stmt\If_($expr, ['stmts' => [$stmt]]);
}

2
vendor/autoload.php vendored
View File

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

View File

@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer
class ComposerAutoloaderInit23fab914030b518d1082bd3742907746
class ComposerAutoloaderInit3c2d7c70c648aab3e746322a45208e46
{
private static $loader;
@ -22,19 +22,19 @@ class ComposerAutoloaderInit23fab914030b518d1082bd3742907746
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInit23fab914030b518d1082bd3742907746', 'loadClassLoader'), true, true);
spl_autoload_register(array('ComposerAutoloaderInit3c2d7c70c648aab3e746322a45208e46', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
spl_autoload_unregister(array('ComposerAutoloaderInit23fab914030b518d1082bd3742907746', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInit3c2d7c70c648aab3e746322a45208e46', 'loadClassLoader'));
require __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInit23fab914030b518d1082bd3742907746::getInitializer($loader));
call_user_func(\Composer\Autoload\ComposerStaticInit3c2d7c70c648aab3e746322a45208e46::getInitializer($loader));
$loader->setClassMapAuthoritative(true);
$loader->register(true);
$includeFiles = \Composer\Autoload\ComposerStaticInit23fab914030b518d1082bd3742907746::$files;
$includeFiles = \Composer\Autoload\ComposerStaticInit3c2d7c70c648aab3e746322a45208e46::$files;
foreach ($includeFiles as $fileIdentifier => $file) {
composerRequire23fab914030b518d1082bd3742907746($fileIdentifier, $file);
composerRequire3c2d7c70c648aab3e746322a45208e46($fileIdentifier, $file);
}
return $loader;
@ -46,7 +46,7 @@ class ComposerAutoloaderInit23fab914030b518d1082bd3742907746
* @param string $file
* @return void
*/
function composerRequire23fab914030b518d1082bd3742907746($fileIdentifier, $file)
function composerRequire3c2d7c70c648aab3e746322a45208e46($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 ComposerStaticInit23fab914030b518d1082bd3742907746
class ComposerStaticInit3c2d7c70c648aab3e746322a45208e46
{
public static $files = array (
'320cde22f66dd4f5d3fd621d3e88b98f' => __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php',
@ -3881,9 +3881,9 @@ class ComposerStaticInit23fab914030b518d1082bd3742907746
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInit23fab914030b518d1082bd3742907746::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit23fab914030b518d1082bd3742907746::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit23fab914030b518d1082bd3742907746::$classMap;
$loader->prefixLengthsPsr4 = ComposerStaticInit3c2d7c70c648aab3e746322a45208e46::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit3c2d7c70c648aab3e746322a45208e46::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit3c2d7c70c648aab3e746322a45208e46::$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('RectorPrefix20220430\AutoloadIncluder');
}
if (!class_exists('ComposerAutoloaderInit23fab914030b518d1082bd3742907746', false) && !interface_exists('ComposerAutoloaderInit23fab914030b518d1082bd3742907746', false) && !trait_exists('ComposerAutoloaderInit23fab914030b518d1082bd3742907746', false)) {
spl_autoload_call('RectorPrefix20220430\ComposerAutoloaderInit23fab914030b518d1082bd3742907746');
if (!class_exists('ComposerAutoloaderInit3c2d7c70c648aab3e746322a45208e46', false) && !interface_exists('ComposerAutoloaderInit3c2d7c70c648aab3e746322a45208e46', false) && !trait_exists('ComposerAutoloaderInit3c2d7c70c648aab3e746322a45208e46', false)) {
spl_autoload_call('RectorPrefix20220430\ComposerAutoloaderInit3c2d7c70c648aab3e746322a45208e46');
}
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('RectorPrefix20220430\Helmich\TypoScriptParser\Parser\AST\Statement');
@ -59,9 +59,9 @@ if (!function_exists('print_node')) {
return \RectorPrefix20220430\print_node(...func_get_args());
}
}
if (!function_exists('composerRequire23fab914030b518d1082bd3742907746')) {
function composerRequire23fab914030b518d1082bd3742907746() {
return \RectorPrefix20220430\composerRequire23fab914030b518d1082bd3742907746(...func_get_args());
if (!function_exists('composerRequire3c2d7c70c648aab3e746322a45208e46')) {
function composerRequire3c2d7c70c648aab3e746322a45208e46() {
return \RectorPrefix20220430\composerRequire3c2d7c70c648aab3e746322a45208e46(...func_get_args());
}
}
if (!function_exists('scanPath')) {