Updated Rector to commit d3d18d442c8f2ca64f5ebef5c7a7541938fa1e2a

d3d18d442c keep relative paths
This commit is contained in:
Tomas Votruba 2022-09-01 09:30:44 +00:00
parent 041ae67a33
commit 6c20d257e3
1408 changed files with 5403 additions and 5309 deletions

View File

@ -1,5 +1,5 @@
#!/usr/bin/env php
<?php
namespace RectorPrefix202208;
namespace RectorPrefix202209;
require_once __DIR__ . '/rector.php';

View File

@ -1,9 +1,9 @@
<?php
declare (strict_types=1);
namespace RectorPrefix202208;
namespace RectorPrefix202209;
use RectorPrefix202208\Nette\Utils\Json;
use RectorPrefix202209\Nette\Utils\Json;
use Rector\ChangesReporting\Output\JsonOutputFormatter;
use Rector\Core\Bootstrap\RectorConfigsResolver;
use Rector\Core\Configuration\Option;
@ -11,9 +11,9 @@ use Rector\Core\Console\ConsoleApplication;
use Rector\Core\Console\Style\RectorConsoleOutputStyleFactory;
use Rector\Core\DependencyInjection\RectorContainerFactory;
use Rector\Core\Kernel\RectorKernel;
use RectorPrefix202208\Symfony\Component\Console\Command\Command;
use RectorPrefix202208\Symfony\Component\Console\Input\ArgvInput;
use RectorPrefix202208\Symplify\PackageBuilder\Reflection\PrivatesCaller;
use RectorPrefix202209\Symfony\Component\Console\Command\Command;
use RectorPrefix202209\Symfony\Component\Console\Input\ArgvInput;
use RectorPrefix202209\Symplify\PackageBuilder\Reflection\PrivatesCaller;
// @ intentionally: continue anyway
@\ini_set('memory_limit', '-1');
// Performance boost

View File

@ -1,12 +1,12 @@
<?php
declare (strict_types=1);
namespace RectorPrefix202208;
namespace RectorPrefix202209;
use RectorPrefix202208\Composer\Semver\VersionParser;
use RectorPrefix202208\Doctrine\Inflector\Inflector;
use RectorPrefix202208\Doctrine\Inflector\Rules\English\InflectorFactory;
use RectorPrefix202208\OndraM\CiDetector\CiDetector;
use RectorPrefix202209\Composer\Semver\VersionParser;
use RectorPrefix202209\Doctrine\Inflector\Inflector;
use RectorPrefix202209\Doctrine\Inflector\Rules\English\InflectorFactory;
use RectorPrefix202209\OndraM\CiDetector\CiDetector;
use PhpParser\BuilderFactory;
use PhpParser\ConstExprEvaluator;
use PhpParser\Lexer;
@ -43,22 +43,22 @@ use Rector\PhpDocParser\PhpParser\SmartPhpParserFactory;
use Rector\PSR4\Composer\PSR4NamespaceMatcher;
use Rector\PSR4\Contract\PSR4AutoloadNamespaceMatcherInterface;
use Rector\Utils\Command\MissingInSetCommand;
use RectorPrefix202208\Symfony\Component\Console\Application;
use RectorPrefix202208\Symfony\Component\Console\Style\SymfonyStyle;
use function RectorPrefix202208\Symfony\Component\DependencyInjection\Loader\Configurator\service;
use RectorPrefix202208\Symfony\Component\Filesystem\Filesystem;
use RectorPrefix202208\Symplify\EasyParallel\ValueObject\EasyParallelConfig;
use RectorPrefix202208\Symplify\PackageBuilder\Console\Style\SymfonyStyleFactory;
use RectorPrefix202208\Symplify\PackageBuilder\Parameter\ParameterProvider;
use RectorPrefix202208\Symplify\PackageBuilder\Php\TypeChecker;
use RectorPrefix202208\Symplify\PackageBuilder\Reflection\ClassLikeExistenceChecker;
use RectorPrefix202208\Symplify\PackageBuilder\Reflection\PrivatesAccessor;
use RectorPrefix202208\Symplify\PackageBuilder\Reflection\PrivatesCaller;
use RectorPrefix202208\Symplify\PackageBuilder\Yaml\ParametersMerger;
use RectorPrefix202208\Symplify\SmartFileSystem\FileSystemFilter;
use RectorPrefix202208\Symplify\SmartFileSystem\FileSystemGuard;
use RectorPrefix202208\Symplify\SmartFileSystem\Finder\FinderSanitizer;
use RectorPrefix202208\Symplify\SmartFileSystem\Normalizer\PathNormalizer;
use RectorPrefix202209\Symfony\Component\Console\Application;
use RectorPrefix202209\Symfony\Component\Console\Style\SymfonyStyle;
use function RectorPrefix202209\Symfony\Component\DependencyInjection\Loader\Configurator\service;
use RectorPrefix202209\Symfony\Component\Filesystem\Filesystem;
use RectorPrefix202209\Symplify\EasyParallel\ValueObject\EasyParallelConfig;
use RectorPrefix202209\Symplify\PackageBuilder\Console\Style\SymfonyStyleFactory;
use RectorPrefix202209\Symplify\PackageBuilder\Parameter\ParameterProvider;
use RectorPrefix202209\Symplify\PackageBuilder\Php\TypeChecker;
use RectorPrefix202209\Symplify\PackageBuilder\Reflection\ClassLikeExistenceChecker;
use RectorPrefix202209\Symplify\PackageBuilder\Reflection\PrivatesAccessor;
use RectorPrefix202209\Symplify\PackageBuilder\Reflection\PrivatesCaller;
use RectorPrefix202209\Symplify\PackageBuilder\Yaml\ParametersMerger;
use RectorPrefix202209\Symplify\SmartFileSystem\FileSystemFilter;
use RectorPrefix202209\Symplify\SmartFileSystem\FileSystemGuard;
use RectorPrefix202209\Symplify\SmartFileSystem\Finder\FinderSanitizer;
use RectorPrefix202209\Symplify\SmartFileSystem\Normalizer\PathNormalizer;
return static function (RectorConfig $rectorConfig) : void {
// make use of https://github.com/symplify/easy-parallel
$rectorConfig->import(EasyParallelConfig::FILE_PATH);
@ -107,7 +107,7 @@ return static function (RectorConfig $rectorConfig) : void {
$extensionConfigResolver = new ExtensionConfigResolver();
$extensionConfigFiles = $extensionConfigResolver->provide();
foreach ($extensionConfigFiles as $extensionConfigFile) {
$rectorConfig->import($extensionConfigFile->getRealPath());
$rectorConfig->import($extensionConfigFile);
}
// require only in dev
$rectorConfig->import(__DIR__ . '/../utils/compiler/config/config.php', null, 'not_found');

View File

@ -1,7 +1,7 @@
<?php
declare (strict_types=1);
namespace RectorPrefix202208;
namespace RectorPrefix202209;
use Rector\Config\RectorConfig;
use Rector\DependencyInjection\Rector\Class_\ActionInjectionToConstructorInjectionRector;

View File

@ -1,7 +1,7 @@
<?php
declare (strict_types=1);
namespace RectorPrefix202208;
namespace RectorPrefix202209;
use Rector\CodeQuality\Rector\Array_\CallableThisArrayToAnonymousFunctionRector;
use Rector\CodeQuality\Rector\Assign\CombinedAssignRector;

View File

@ -1,7 +1,7 @@
<?php
declare (strict_types=1);
namespace RectorPrefix202208;
namespace RectorPrefix202209;
use Rector\CodingStyle\Rector\ArrowFunction\StaticArrowFunctionRector;
use Rector\CodingStyle\Rector\Assign\SplitDoubleAssignRector;

View File

@ -1,7 +1,7 @@
<?php
declare (strict_types=1);
namespace RectorPrefix202208;
namespace RectorPrefix202209;
use Rector\CodeQuality\Rector\FunctionLike\SimplifyUselessVariableRector;
use Rector\Config\RectorConfig;

View File

@ -1,7 +1,7 @@
<?php
declare (strict_types=1);
namespace RectorPrefix202208;
namespace RectorPrefix202209;
use Rector\Config\RectorConfig;
use Rector\EarlyReturn\Rector\Foreach_\ChangeNestedForeachIfsToEarlyContinueRector;

View File

@ -1,7 +1,7 @@
<?php
declare (strict_types=1);
namespace RectorPrefix202208;
namespace RectorPrefix202209;
use Rector\Config\RectorConfig;
use Rector\Renaming\Rector\MethodCall\RenameMethodRector;

View File

@ -1,7 +1,7 @@
<?php
declare (strict_types=1);
namespace RectorPrefix202208;
namespace RectorPrefix202209;
use Rector\Config\RectorConfig;
use Rector\Core\ValueObject\PhpVersion;

View File

@ -1,7 +1,7 @@
<?php
declare (strict_types=1);
namespace RectorPrefix202208;
namespace RectorPrefix202209;
use Rector\Config\RectorConfig;
use Rector\Core\ValueObject\PhpVersion;

View File

@ -1,7 +1,7 @@
<?php
declare (strict_types=1);
namespace RectorPrefix202208;
namespace RectorPrefix202209;
use Rector\Config\RectorConfig;
use Rector\Core\ValueObject\PhpVersion;

View File

@ -1,7 +1,7 @@
<?php
declare (strict_types=1);
namespace RectorPrefix202208;
namespace RectorPrefix202209;
use Rector\Config\RectorConfig;
use Rector\Core\ValueObject\PhpVersion;

View File

@ -1,7 +1,7 @@
<?php
declare (strict_types=1);
namespace RectorPrefix202208;
namespace RectorPrefix202209;
use Rector\Config\RectorConfig;
use Rector\Core\ValueObject\PhpVersion;

View File

@ -1,7 +1,7 @@
<?php
declare (strict_types=1);
namespace RectorPrefix202208;
namespace RectorPrefix202209;
use Rector\Config\RectorConfig;
use Rector\Core\ValueObject\PhpVersion;

View File

@ -1,7 +1,7 @@
<?php
declare (strict_types=1);
namespace RectorPrefix202208;
namespace RectorPrefix202209;
use Rector\Config\RectorConfig;
use Rector\Core\ValueObject\PhpVersion;

View File

@ -1,7 +1,7 @@
<?php
declare (strict_types=1);
namespace RectorPrefix202208;
namespace RectorPrefix202209;
use Rector\Config\RectorConfig;
use Rector\Core\ValueObject\PhpVersion;

View File

@ -1,7 +1,7 @@
<?php
declare (strict_types=1);
namespace RectorPrefix202208;
namespace RectorPrefix202209;
use Rector\Config\RectorConfig;
use Rector\Core\ValueObject\PhpVersion;

View File

@ -1,7 +1,7 @@
<?php
declare (strict_types=1);
namespace RectorPrefix202208;
namespace RectorPrefix202209;
use Rector\Config\RectorConfig;
use Rector\Core\ValueObject\PhpVersion;

View File

@ -1,7 +1,7 @@
<?php
declare (strict_types=1);
namespace RectorPrefix202208;
namespace RectorPrefix202209;
use Rector\Config\RectorConfig;
use Rector\Core\ValueObject\PhpVersion;

View File

@ -1,7 +1,7 @@
<?php
declare (strict_types=1);
namespace RectorPrefix202208;
namespace RectorPrefix202209;
use Rector\Config\RectorConfig;
use Rector\Renaming\Rector\MethodCall\RenameMethodRector;

View File

@ -1,7 +1,7 @@
<?php
declare (strict_types=1);
namespace RectorPrefix202208;
namespace RectorPrefix202209;
use Rector\Arguments\Rector\FuncCall\SwapFuncCallArgumentsRector;
use Rector\Arguments\ValueObject\SwapFuncCallArguments;

View File

@ -1,7 +1,7 @@
<?php
declare (strict_types=1);
namespace RectorPrefix202208;
namespace RectorPrefix202209;
use Rector\Config\RectorConfig;
use Rector\Naming\Rector\Assign\RenameVariableToMatchMethodCallReturnTypeRector;

View File

@ -1,7 +1,7 @@
<?php
declare (strict_types=1);
namespace RectorPrefix202208;
namespace RectorPrefix202209;
use Rector\Config\RectorConfig;
use Rector\Php52\Rector\Property\VarToPublicPropertyRector;

View File

@ -1,7 +1,7 @@
<?php
declare (strict_types=1);
namespace RectorPrefix202208;
namespace RectorPrefix202209;
use Rector\Config\RectorConfig;
use Rector\Php53\Rector\FuncCall\DirNameFileConstantToDirConstantRector;

View File

@ -1,7 +1,7 @@
<?php
declare (strict_types=1);
namespace RectorPrefix202208;
namespace RectorPrefix202209;
use Rector\Config\RectorConfig;
use Rector\Php54\Rector\Array_\LongArrayToShortArrayRector;

View File

@ -1,7 +1,7 @@
<?php
declare (strict_types=1);
namespace RectorPrefix202208;
namespace RectorPrefix202209;
use Rector\Config\RectorConfig;
use Rector\Php55\Rector\Class_\ClassConstantToSelfClassRector;

View File

@ -1,7 +1,7 @@
<?php
declare (strict_types=1);
namespace RectorPrefix202208;
namespace RectorPrefix202209;
use Rector\Config\RectorConfig;
use Rector\Php56\Rector\FuncCall\PowToExpRector;

View File

@ -1,7 +1,7 @@
<?php
declare (strict_types=1);
namespace RectorPrefix202208;
namespace RectorPrefix202209;
use Rector\Config\RectorConfig;
use Rector\Php70\Rector\Assign\ListSplitStringRector;

View File

@ -1,7 +1,7 @@
<?php
declare (strict_types=1);
namespace RectorPrefix202208;
namespace RectorPrefix202209;
use Rector\Config\RectorConfig;
use Rector\Php71\Rector\Assign\AssignArrayToStringRector;

View File

@ -1,7 +1,7 @@
<?php
declare (strict_types=1);
namespace RectorPrefix202208;
namespace RectorPrefix202209;
use Rector\Config\RectorConfig;
use Rector\Php72\Rector\Assign\ListEachRector;

View File

@ -1,7 +1,7 @@
<?php
declare (strict_types=1);
namespace RectorPrefix202208;
namespace RectorPrefix202209;
use Rector\Config\RectorConfig;
use Rector\Php52\Rector\Switch_\ContinueToBreakInSwitchRector;

View File

@ -1,7 +1,7 @@
<?php
declare (strict_types=1);
namespace RectorPrefix202208;
namespace RectorPrefix202209;
use Rector\Config\RectorConfig;
use Rector\Php74\Rector\ArrayDimFetch\CurlyToSquareBracketArrayStringRector;

View File

@ -1,7 +1,7 @@
<?php
declare (strict_types=1);
namespace RectorPrefix202208;
namespace RectorPrefix202209;
use Rector\Arguments\Rector\ClassMethod\ArgumentAdderRector;
use Rector\Arguments\Rector\FuncCall\FunctionArgumentDefaultValueReplacerRector;

View File

@ -1,7 +1,7 @@
<?php
declare (strict_types=1);
namespace RectorPrefix202208;
namespace RectorPrefix202209;
use Rector\Config\RectorConfig;
use Rector\Php81\Rector\Array_\FirstClassCallableRector;

View File

@ -1,7 +1,7 @@
<?php
declare (strict_types=1);
namespace RectorPrefix202208;
namespace RectorPrefix202209;
use Rector\Config\RectorConfig;
use Rector\Php82\Rector\Class_\ReadOnlyClassRector;

View File

@ -1,7 +1,7 @@
<?php
declare (strict_types=1);
namespace RectorPrefix202208;
namespace RectorPrefix202209;
use Rector\Config\RectorConfig;
use Rector\Privatization\Rector\Class_\ChangeGlobalVariablesToPropertiesRector;

View File

@ -1,7 +1,7 @@
<?php
declare (strict_types=1);
namespace RectorPrefix202208;
namespace RectorPrefix202209;
use Rector\Config\RectorConfig;
use Rector\PSR4\Rector\FileWithoutNamespace\NormalizeNamespaceByPSR4ComposerAutoloadRector;

View File

@ -1,7 +1,7 @@
<?php
declare (strict_types=1);
namespace RectorPrefix202208;
namespace RectorPrefix202209;
use Rector\CodeQuality\Rector\ClassMethod\ReturnTypeFromStrictScalarReturnExprRector;
use Rector\Config\RectorConfig;

View File

@ -1,7 +1,7 @@
<?php
declare (strict_types=1);
namespace RectorPrefix202208;
namespace RectorPrefix202209;
use Rector\Config\RectorConfig;
use Rector\TypeDeclaration\Rector\ClassMethod\AddArrayParamDocTypeRector;

View File

@ -6,7 +6,7 @@ namespace Rector\BetterPhpDocParser\PhpDocInfo;
use PHPStan\PhpDocParser\Lexer\Lexer;
use PHPStan\PhpDocParser\Parser\TokenIterator;
use Rector\BetterPhpDocParser\ValueObject\Parser\BetterTokenIterator;
use RectorPrefix202208\Symplify\PackageBuilder\Reflection\PrivatesAccessor;
use RectorPrefix202209\Symplify\PackageBuilder\Reflection\PrivatesAccessor;
final class TokenIteratorFactory
{
/**

View File

@ -3,7 +3,7 @@
declare (strict_types=1);
namespace Rector\BetterPhpDocParser\PhpDocManipulator;
use RectorPrefix202208\Nette\Utils\Strings;
use RectorPrefix202209\Nette\Utils\Strings;
use PhpParser\Node;
use Rector\BetterPhpDocParser\PhpDoc\ArrayItemNode;
use Rector\BetterPhpDocParser\PhpDoc\DoctrineAnnotationTagValueNode;

View File

@ -21,7 +21,7 @@ use Rector\BetterPhpDocParser\ValueObject\PhpDocAttributeKey;
use Rector\BetterPhpDocParser\ValueObject\StartAndEnd;
use Rector\Core\Configuration\CurrentNodeProvider;
use Rector\Core\Exception\ShouldNotHappenException;
use RectorPrefix202208\Symplify\PackageBuilder\Reflection\PrivatesCaller;
use RectorPrefix202209\Symplify\PackageBuilder\Reflection\PrivatesCaller;
/**
* @see \Rector\Tests\BetterPhpDocParser\PhpDocParser\TagValueNodeReprint\TagValueNodeReprintTest
*/

View File

@ -3,7 +3,7 @@
declare (strict_types=1);
namespace Rector\BetterPhpDocParser\PhpDocParser;
use RectorPrefix202208\Nette\Utils\Strings;
use RectorPrefix202209\Nette\Utils\Strings;
use PhpParser\Node;
use PHPStan\PhpDocParser\Ast\PhpDoc\GenericTagValueNode;
use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocChildNode;

View File

@ -17,7 +17,7 @@ use Rector\BetterPhpDocParser\ValueObject\Parser\BetterTokenIterator;
use Rector\BetterPhpDocParser\ValueObject\PhpDocAttributeKey;
use Rector\Core\Configuration\CurrentNodeProvider;
use Rector\Core\Exception\ShouldNotHappenException;
use RectorPrefix202208\Symfony\Contracts\Service\Attribute\Required;
use RectorPrefix202209\Symfony\Contracts\Service\Attribute\Required;
final class PlainValueParser
{
/**

View File

@ -3,7 +3,7 @@
declare (strict_types=1);
namespace Rector\BetterPhpDocParser\Printer;
use RectorPrefix202208\Nette\Utils\Strings;
use RectorPrefix202209\Nette\Utils\Strings;
final class DocBlockInliner
{
/**

View File

@ -3,7 +3,7 @@
declare (strict_types=1);
namespace Rector\BetterPhpDocParser\Printer;
use RectorPrefix202208\Nette\Utils\Strings;
use RectorPrefix202209\Nette\Utils\Strings;
use PhpParser\Node\Stmt\InlineHTML;
use PHPStan\PhpDocParser\Ast\PhpDoc\ParamTagValueNode;
use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocChildNode;

View File

@ -5,7 +5,7 @@ namespace Rector\BetterPhpDocParser\ValueObject\Parser;
use PHPStan\PhpDocParser\Parser\TokenIterator;
use Rector\Core\Exception\ShouldNotHappenException;
use RectorPrefix202208\Symplify\PackageBuilder\Reflection\PrivatesAccessor;
use RectorPrefix202209\Symplify\PackageBuilder\Reflection\PrivatesAccessor;
final class BetterTokenIterator extends TokenIterator
{
/**

View File

@ -5,7 +5,7 @@ namespace Rector\BetterPhpDocParser\ValueObject\PhpDoc\DoctrineAnnotation;
use Rector\BetterPhpDocParser\PhpDoc\ArrayItemNode;
use Stringable;
use RectorPrefix202208\Webmozart\Assert\Assert;
use RectorPrefix202209\Webmozart\Assert\Assert;
final class CurlyListNode extends \Rector\BetterPhpDocParser\ValueObject\PhpDoc\DoctrineAnnotation\AbstractValuesAwareNode
{
/**

View File

@ -6,8 +6,8 @@ namespace Rector\Caching;
use Rector\Caching\ValueObject\Storage\FileCacheStorage;
use Rector\Caching\ValueObject\Storage\MemoryCacheStorage;
use Rector\Core\Configuration\Option;
use RectorPrefix202208\Symfony\Component\Filesystem\Filesystem;
use RectorPrefix202208\Symplify\PackageBuilder\Parameter\ParameterProvider;
use RectorPrefix202209\Symfony\Component\Filesystem\Filesystem;
use RectorPrefix202209\Symplify\PackageBuilder\Parameter\ParameterProvider;
final class CacheFactory
{
/**

View File

@ -4,12 +4,12 @@ declare (strict_types=1);
namespace Rector\Caching\Config;
use Rector\Core\Exception\ShouldNotHappenException;
use RectorPrefix202208\Symfony\Component\Config\FileLocator;
use RectorPrefix202208\Symfony\Component\Config\Loader\LoaderInterface;
use RectorPrefix202208\Symfony\Component\Config\Loader\LoaderResolver;
use RectorPrefix202208\Symfony\Component\DependencyInjection\ContainerBuilder;
use RectorPrefix202208\Symfony\Component\DependencyInjection\Loader\GlobFileLoader;
use RectorPrefix202208\Symfony\Component\DependencyInjection\Loader\PhpFileLoader;
use RectorPrefix202209\Symfony\Component\Config\FileLocator;
use RectorPrefix202209\Symfony\Component\Config\Loader\LoaderInterface;
use RectorPrefix202209\Symfony\Component\Config\Loader\LoaderResolver;
use RectorPrefix202209\Symfony\Component\DependencyInjection\ContainerBuilder;
use RectorPrefix202209\Symfony\Component\DependencyInjection\Loader\GlobFileLoader;
use RectorPrefix202209\Symfony\Component\DependencyInjection\Loader\PhpFileLoader;
/**
* Inspired by https://github.com/symplify/easy-coding-standard/blob/e598ab54686e416788f28fcfe007fd08e0f371d9/packages/changed-files-detector/src/FileHashComputer.php
*/

View File

@ -3,11 +3,10 @@
declare (strict_types=1);
namespace Rector\Caching\Detector;
use RectorPrefix202208\Nette\Utils\Strings;
use RectorPrefix202209\Nette\Utils\Strings;
use Rector\Caching\Cache;
use Rector\Caching\Config\FileHashComputer;
use Rector\Caching\Enum\CacheKey;
use Symplify\SmartFileSystem\SmartFileInfo;
/**
* Inspired by https://github.com/symplify/symplify/pull/90/files#diff-72041b2e1029a08930e13d79d298ef11
*
@ -33,23 +32,23 @@ final class ChangedFilesDetector
/**
* @param string[] $dependentFiles
*/
public function addFileWithDependencies(SmartFileInfo $smartFileInfo, array $dependentFiles) : void
public function addFileWithDependencies(string $filePath, array $dependentFiles) : void
{
$fileInfoCacheKey = $this->getFileInfoCacheKey($smartFileInfo);
$hash = $this->hashFile($smartFileInfo);
$this->cache->save($fileInfoCacheKey, CacheKey::FILE_HASH_KEY, $hash);
$this->cache->save($fileInfoCacheKey . '_files', CacheKey::DEPENDENT_FILES_KEY, $dependentFiles);
$filePathCacheKey = $this->getFilePathCacheKey($filePath);
$hash = $this->hashFile($filePath);
$this->cache->save($filePathCacheKey, CacheKey::FILE_HASH_KEY, $hash);
$this->cache->save($filePathCacheKey . '_files', CacheKey::DEPENDENT_FILES_KEY, $dependentFiles);
}
public function hasFileChanged(SmartFileInfo $smartFileInfo) : bool
public function hasFileChanged(string $filePath) : bool
{
$currentFileHash = $this->hashFile($smartFileInfo);
$fileInfoCacheKey = $this->getFileInfoCacheKey($smartFileInfo);
$currentFileHash = $this->hashFile($filePath);
$fileInfoCacheKey = $this->getFilePathCacheKey($filePath);
$cachedValue = $this->cache->load($fileInfoCacheKey, CacheKey::FILE_HASH_KEY);
return $currentFileHash !== $cachedValue;
}
public function invalidateFile(SmartFileInfo $smartFileInfo) : void
public function invalidateFile(string $filePath) : void
{
$fileInfoCacheKey = $this->getFileInfoCacheKey($smartFileInfo);
$fileInfoCacheKey = $this->getFilePathCacheKey($filePath);
$this->cache->clean($fileInfoCacheKey);
}
public function clear() : void
@ -57,24 +56,24 @@ final class ChangedFilesDetector
$this->cache->clear();
}
/**
* @return SmartFileInfo[]
* @return string[]
*/
public function getDependentFileInfos(SmartFileInfo $fileInfo) : array
public function getDependentFilePaths(string $filePath) : array
{
$fileInfoCacheKey = $this->getFileInfoCacheKey($fileInfo);
$fileInfoCacheKey = $this->getFilePathCacheKey($filePath);
$cacheValue = $this->cache->load($fileInfoCacheKey . '_files', CacheKey::DEPENDENT_FILES_KEY);
if ($cacheValue === null) {
return [];
}
$dependentFileInfos = [];
$existingDependentFiles = [];
$dependentFiles = $cacheValue;
foreach ($dependentFiles as $dependentFile) {
if (!\file_exists($dependentFile)) {
continue;
}
$dependentFileInfos[] = new SmartFileInfo($dependentFile);
$existingDependentFiles[] = $dependentFile;
}
return $dependentFileInfos;
return $existingDependentFiles;
}
/**
* @api
@ -85,13 +84,13 @@ final class ChangedFilesDetector
$configHash = $this->fileHashComputer->compute($filePath);
$this->storeConfigurationDataHash($filePath, $configHash);
}
private function getFileInfoCacheKey(SmartFileInfo $smartFileInfo) : string
private function getFilePathCacheKey(string $filePath) : string
{
return \sha1($smartFileInfo->getRealPath());
return \sha1($filePath);
}
private function hashFile(SmartFileInfo $smartFileInfo) : string
private function hashFile(string $filePath) : string
{
return (string) \sha1_file($smartFileInfo->getRealPath());
return (string) \sha1_file($filePath);
}
private function storeConfigurationDataHash(string $filePath, string $configurationHash) : void
{

View File

@ -7,7 +7,7 @@ use PhpParser\Node\Stmt;
use PHPStan\Analyser\MutatingScope;
use PHPStan\Analyser\NodeScopeResolver;
use PHPStan\Dependency\DependencyResolver as PHPStanDependencyResolver;
use RectorPrefix202208\Symplify\PackageBuilder\Reflection\PrivatesAccessor;
use RectorPrefix202209\Symplify\PackageBuilder\Reflection\PrivatesAccessor;
final class DependencyResolver
{
/**

View File

@ -4,7 +4,6 @@ declare (strict_types=1);
namespace Rector\Caching;
use Rector\Caching\Detector\ChangedFilesDetector;
use Symplify\SmartFileSystem\SmartFileInfo;
final class UnchangedFilesFilter
{
/**
@ -17,23 +16,20 @@ final class UnchangedFilesFilter
$this->changedFilesDetector = $changedFilesDetector;
}
/**
* @param SmartFileInfo[]|string[] $fileInfos
* @return SmartFileInfo[]
* @param string[] $filePaths
* @return string[]
*/
public function filterAndJoinWithDependentFileInfos(array $fileInfos) : array
public function filterAndJoinWithDependentFileInfos(array $filePaths) : array
{
$changedFileInfos = [];
$dependentFileInfos = [];
foreach ($fileInfos as $fileInfo) {
if (\is_string($fileInfo)) {
$fileInfo = new SmartFileInfo($fileInfo);
}
if (!$this->changedFilesDetector->hasFileChanged($fileInfo)) {
foreach ($filePaths as $filePath) {
if (!$this->changedFilesDetector->hasFileChanged($filePath)) {
continue;
}
$changedFileInfos[] = $fileInfo;
$this->changedFilesDetector->invalidateFile($fileInfo);
$dependentFileInfos = \array_merge($dependentFileInfos, $this->changedFilesDetector->getDependentFileInfos($fileInfo));
$changedFileInfos[] = $filePath;
$this->changedFilesDetector->invalidateFile($filePath);
$dependentFileInfos = \array_merge($dependentFileInfos, $this->changedFilesDetector->getDependentFilePaths($filePath));
}
// add dependent files
$dependentFileInfos = \array_merge($dependentFileInfos, $changedFileInfos);

View File

@ -4,8 +4,8 @@ declare (strict_types=1);
namespace Rector\Caching\ValueObject\Storage;
use FilesystemIterator;
use RectorPrefix202208\Nette\Utils\FileSystem;
use RectorPrefix202208\Nette\Utils\Random;
use RectorPrefix202209\Nette\Utils\FileSystem;
use RectorPrefix202209\Nette\Utils\Random;
use Rector\Caching\Contract\ValueObject\Storage\CacheStorageInterface;
use Rector\Caching\ValueObject\CacheFilePaths;
use Rector\Caching\ValueObject\CacheItem;
@ -24,7 +24,7 @@ final class FileCacheStorage implements CacheStorageInterface
* @var \Symfony\Component\Filesystem\Filesystem
*/
private $filesystem;
public function __construct(string $directory, \RectorPrefix202208\Symfony\Component\Filesystem\Filesystem $filesystem)
public function __construct(string $directory, \RectorPrefix202209\Symfony\Component\Filesystem\Filesystem $filesystem)
{
$this->directory = $directory;
$this->filesystem = $filesystem;

View File

@ -3,7 +3,7 @@
declare (strict_types=1);
namespace Rector\ChangesReporting\Annotation;
use RectorPrefix202208\Nette\Utils\Strings;
use RectorPrefix202209\Nette\Utils\Strings;
use Rector\Core\Contract\Rector\RectorInterface;
use ReflectionClass;
/**

View File

@ -12,8 +12,7 @@ final class AffectedFilesCollector
private $affectedFiles = [];
public function addFile(File $file) : void
{
$smartFileInfo = $file->getSmartFileInfo();
$this->affectedFiles[$smartFileInfo->getRealPath()] = $file;
$this->affectedFiles[$file->getFilePath()] = $file;
}
public function getNext() : ?File
{
@ -24,7 +23,6 @@ final class AffectedFilesCollector
}
public function removeFromList(File $file) : void
{
$smartFileInfo = $file->getSmartFileInfo();
unset($this->affectedFiles[$smartFileInfo->getRealPath()]);
unset($this->affectedFiles[$file->getFilePath()]);
}
}

View File

@ -3,7 +3,7 @@
declare (strict_types=1);
namespace Rector\ChangesReporting\Output;
use RectorPrefix202208\Nette\Utils\Strings;
use RectorPrefix202209\Nette\Utils\Strings;
use Rector\ChangesReporting\Annotation\RectorsChangelogResolver;
use Rector\ChangesReporting\Contract\Output\OutputFormatterInterface;
use Rector\Core\Contract\Console\OutputStyleInterface;

View File

@ -3,7 +3,7 @@
declare (strict_types=1);
namespace Rector\ChangesReporting\Output;
use RectorPrefix202208\Nette\Utils\Json;
use RectorPrefix202209\Nette\Utils\Json;
use Rector\ChangesReporting\Annotation\RectorsChangelogResolver;
use Rector\ChangesReporting\Contract\Output\OutputFormatterInterface;
use Rector\Core\ValueObject\Configuration;

View File

@ -4,8 +4,8 @@ declare (strict_types=1);
namespace Rector\ChangesReporting\ValueObject;
use Rector\Core\Contract\Rector\RectorInterface;
use RectorPrefix202208\Symplify\EasyParallel\Contract\SerializableInterface;
use RectorPrefix202208\Webmozart\Assert\Assert;
use RectorPrefix202209\Symplify\EasyParallel\Contract\SerializableInterface;
use RectorPrefix202209\Webmozart\Assert\Assert;
final class RectorWithLineChange implements SerializableInterface
{
/**
@ -52,7 +52,7 @@ final class RectorWithLineChange implements SerializableInterface
* @param array<string, mixed> $json
* @return $this
*/
public static function decode(array $json) : \RectorPrefix202208\Symplify\EasyParallel\Contract\SerializableInterface
public static function decode(array $json) : \RectorPrefix202209\Symplify\EasyParallel\Contract\SerializableInterface
{
$rectorClass = $json[self::KEY_RECTOR_CLASS];
Assert::string($rectorClass);

View File

@ -7,7 +7,6 @@ use PHPStan\AnalysedCodeException;
use Rector\Core\Error\ExceptionCorrector;
use Rector\Core\FileSystem\FilePathHelper;
use Rector\Core\ValueObject\Error\SystemError;
use Symplify\SmartFileSystem\SmartFileInfo;
final class ErrorFactory
{
/**
@ -25,10 +24,10 @@ final class ErrorFactory
$this->exceptionCorrector = $exceptionCorrector;
$this->filePathHelper = $filePathHelper;
}
public function createAutoloadError(AnalysedCodeException $analysedCodeException, SmartFileInfo $smartFileInfo) : SystemError
public function createAutoloadError(AnalysedCodeException $analysedCodeException, string $filePath) : SystemError
{
$message = $this->exceptionCorrector->getAutoloadExceptionMessageAndAddLocation($analysedCodeException);
$relativeFilePath = $this->filePathHelper->relativePath($smartFileInfo->getRealPath());
$relativeFilePath = $this->filePathHelper->relativePath($filePath);
return new SystemError($message, $relativeFilePath);
}
}

View File

@ -7,7 +7,7 @@ use Rector\Core\Differ\DefaultDiffer;
use Rector\Core\FileSystem\FilePathHelper;
use Rector\Core\ValueObject\Application\File;
use Rector\Core\ValueObject\Reporting\FileDiff;
use RectorPrefix202208\Symplify\PackageBuilder\Console\Output\ConsoleDiffer;
use RectorPrefix202209\Symplify\PackageBuilder\Console\Output\ConsoleDiffer;
final class FileDiffFactory
{
/**

View File

@ -9,8 +9,8 @@ use Rector\Core\Configuration\ValueObjectInliner;
use Rector\Core\Contract\Rector\ConfigurableRectorInterface;
use Rector\Core\Contract\Rector\RectorInterface;
use Rector\Core\ValueObject\PhpVersion;
use RectorPrefix202208\Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use RectorPrefix202208\Webmozart\Assert\Assert;
use RectorPrefix202209\Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use RectorPrefix202209\Webmozart\Assert\Assert;
/**
* @api
* Same as Symfony container configurator, with patched return type for "set()" method for easier DX.

View File

@ -27,7 +27,7 @@ use Rector\FamilyTree\ValueObject\PropertyType;
use Rector\NodeNameResolver\NodeNameResolver;
use Rector\PHPStanStaticTypeMapper\Enum\TypeKind;
use Rector\StaticTypeMapper\StaticTypeMapper;
use RectorPrefix202208\Symplify\PackageBuilder\Reflection\PrivatesAccessor;
use RectorPrefix202209\Symplify\PackageBuilder\Reflection\PrivatesAccessor;
final class FamilyRelationsAnalyzer
{
/**

View File

@ -3,13 +3,12 @@
declare (strict_types=1);
namespace Rector\FileSystemRector\Parser;
use RectorPrefix202209\Nette\Utils\FileSystem;
use PhpParser\Node\Stmt;
use Rector\Core\PhpParser\NodeTraverser\FileWithoutNamespaceNodeTraverser;
use Rector\Core\PhpParser\Parser\RectorParser;
use Rector\Core\ValueObject\Application\File;
use Rector\NodeTypeResolver\NodeScopeAndMetadataDecorator;
use Rector\Testing\Fixture\FixtureTempFileDumper;
use Symplify\SmartFileSystem\SmartFileInfo;
/**
* Only for testing, @todo move to testing
*/
@ -38,16 +37,12 @@ final class FileInfoParser
}
/**
* @return Stmt[]
* @param \Symplify\SmartFileSystem\SmartFileInfo|string $smartFileInfo
*/
public function parseFileInfoToNodesAndDecorate($smartFileInfo) : array
public function parseFileInfoToNodesAndDecorate(string $filePath) : array
{
if (\is_string($smartFileInfo)) {
$smartFileInfo = FixtureTempFileDumper::dump($smartFileInfo);
}
$stmts = $this->rectorParser->parseFile($smartFileInfo);
$stmts = $this->rectorParser->parseFile($filePath);
$stmts = $this->fileWithoutNamespaceNodeTraverser->traverse($stmts);
$file = new File($smartFileInfo, $smartFileInfo->getContents());
$file = new File($filePath, FileSystem::read($filePath));
return $this->nodeScopeAndMetadataDecorator->decorateNodesFromFile($file, $stmts);
}
}

View File

@ -46,9 +46,9 @@ final class InvalidNameNodeReporter
$message = \sprintf('Pick more specific node than "%s", e.g. "$node->name"', \get_class($node));
$file = $this->currentFileProvider->getFile();
if ($file instanceof File) {
$smartFileInfo = $file->getSmartFileInfo();
// $smartFileInfo = $file->getFilePath(); // getSmartFileInfo();
$message .= \PHP_EOL . \PHP_EOL;
$relatilveFilePath = $this->filePathHelper->relativePath($smartFileInfo->getRealPath());
$relatilveFilePath = $this->filePathHelper->relativePath($file->getFilePath());
$message .= \sprintf('Caused in "%s" file on line %d on code "%s"', $relatilveFilePath, $node->getStartLine(), $this->nodePrinter->print($node));
}
$backtrace = \debug_backtrace();

View File

@ -7,7 +7,7 @@ use PhpParser\Node;
use PhpParser\Node\Expr\ClassConstFetch;
use Rector\NodeNameResolver\Contract\NodeNameResolverInterface;
use Rector\NodeNameResolver\NodeNameResolver;
use RectorPrefix202208\Symfony\Contracts\Service\Attribute\Required;
use RectorPrefix202209\Symfony\Contracts\Service\Attribute\Required;
/**
* @implements NodeNameResolverInterface<ClassConstFetch>
*/

View File

@ -7,7 +7,7 @@ use PhpParser\Node;
use PhpParser\Node\Stmt\ClassConst;
use Rector\NodeNameResolver\Contract\NodeNameResolverInterface;
use Rector\NodeNameResolver\NodeNameResolver;
use RectorPrefix202208\Symfony\Contracts\Service\Attribute\Required;
use RectorPrefix202209\Symfony\Contracts\Service\Attribute\Required;
/**
* @implements NodeNameResolverInterface<ClassConst>
*/

View File

@ -8,7 +8,7 @@ use PhpParser\Node\Name;
use PhpParser\Node\Stmt\ClassLike;
use Rector\NodeNameResolver\Contract\NodeNameResolverInterface;
use Rector\NodeNameResolver\NodeNameResolver;
use RectorPrefix202208\Symfony\Contracts\Service\Attribute\Required;
use RectorPrefix202209\Symfony\Contracts\Service\Attribute\Required;
/**
* @implements NodeNameResolverInterface<ClassLike>
*/

View File

@ -7,7 +7,7 @@ use PhpParser\Node;
use PhpParser\Node\Param;
use Rector\NodeNameResolver\Contract\NodeNameResolverInterface;
use Rector\NodeNameResolver\NodeNameResolver;
use RectorPrefix202208\Symfony\Contracts\Service\Attribute\Required;
use RectorPrefix202209\Symfony\Contracts\Service\Attribute\Required;
/**
* @implements NodeNameResolverInterface<Param>
*/

View File

@ -7,7 +7,7 @@ use PhpParser\Node;
use PhpParser\Node\Stmt\Property;
use Rector\NodeNameResolver\Contract\NodeNameResolverInterface;
use Rector\NodeNameResolver\NodeNameResolver;
use RectorPrefix202208\Symfony\Contracts\Service\Attribute\Required;
use RectorPrefix202209\Symfony\Contracts\Service\Attribute\Required;
/**
* @implements NodeNameResolverInterface<Property>
*/

View File

@ -7,7 +7,7 @@ use PhpParser\Node;
use PhpParser\Node\Stmt\Use_;
use Rector\NodeNameResolver\Contract\NodeNameResolverInterface;
use Rector\NodeNameResolver\NodeNameResolver;
use RectorPrefix202208\Symfony\Contracts\Service\Attribute\Required;
use RectorPrefix202209\Symfony\Contracts\Service\Attribute\Required;
/**
* @implements NodeNameResolverInterface<Use_>
*/

View File

@ -3,7 +3,7 @@
declare (strict_types=1);
namespace Rector\NodeNameResolver\Regex;
use RectorPrefix202208\Nette\Utils\Strings;
use RectorPrefix202209\Nette\Utils\Strings;
final class RegexPatternDetector
{
/**

View File

@ -18,7 +18,7 @@ use Rector\Core\Configuration\Option;
use Rector\Core\Exception\ShouldNotHappenException;
use Rector\NodeTypeResolver\Reflection\BetterReflection\SourceLocatorProvider\DynamicSourceLocatorProvider;
use ReflectionClass;
use RectorPrefix202208\Symplify\PackageBuilder\Parameter\ParameterProvider;
use RectorPrefix202209\Symplify\PackageBuilder\Parameter\ParameterProvider;
/**
* Factory so Symfony app can use services from PHPStan container
*/

View File

@ -45,8 +45,7 @@ final class NodeScopeAndMetadataDecorator
*/
public function decorateNodesFromFile(File $file, array $stmts) : array
{
$smartFileInfo = $file->getSmartFileInfo();
$stmts = $this->phpStanNodeScopeResolver->processNodes($stmts, $smartFileInfo);
$stmts = $this->phpStanNodeScopeResolver->processNodes($stmts, $file->getFilePath());
$nodeTraverser = new NodeTraverser();
// needed also for format preserving printing
$nodeTraverser->addVisitor($this->cloningVisitor);

View File

@ -13,7 +13,7 @@ use PHPStan\Type\Type;
use Rector\Core\PhpParser\Node\BetterNodeFinder;
use Rector\NodeTypeResolver\Contract\NodeTypeResolverInterface;
use Rector\NodeTypeResolver\NodeTypeResolver;
use RectorPrefix202208\Symfony\Contracts\Service\Attribute\Required;
use RectorPrefix202209\Symfony\Contracts\Service\Attribute\Required;
/**
* @implements NodeTypeResolverInterface<ClassMethod|ClassConst>
*/

View File

@ -22,7 +22,7 @@ use Rector\NodeTypeResolver\Node\AttributeKey;
use Rector\NodeTypeResolver\NodeTypeResolver;
use Rector\PhpDocParser\NodeTraverser\SimpleCallableNodeTraverser;
use Rector\StaticTypeMapper\StaticTypeMapper;
use RectorPrefix202208\Symfony\Contracts\Service\Attribute\Required;
use RectorPrefix202209\Symfony\Contracts\Service\Attribute\Required;
/**
* @see \Rector\Tests\NodeTypeResolver\PerNodeTypeResolver\ParamTypeResolver\ParamTypeResolverTest
*

View File

@ -16,7 +16,7 @@ use Rector\NodeNameResolver\NodeNameResolver;
use Rector\NodeTypeResolver\Contract\NodeTypeResolverInterface;
use Rector\NodeTypeResolver\Node\AttributeKey;
use Rector\NodeTypeResolver\NodeTypeResolver;
use RectorPrefix202208\Symfony\Contracts\Service\Attribute\Required;
use RectorPrefix202209\Symfony\Contracts\Service\Attribute\Required;
/**
* @see \Rector\Tests\NodeTypeResolver\PerNodeTypeResolver\PropertyFetchTypeResolver\PropertyFetchTypeResolverTest
*

View File

@ -11,7 +11,7 @@ use PHPStan\Type\Type;
use Rector\NodeTypeResolver\Contract\NodeTypeResolverInterface;
use Rector\NodeTypeResolver\Node\AttributeKey;
use Rector\NodeTypeResolver\NodeTypeResolver;
use RectorPrefix202208\Symfony\Contracts\Service\Attribute\Required;
use RectorPrefix202209\Symfony\Contracts\Service\Attribute\Required;
/**
* @see \Rector\Tests\NodeTypeResolver\PerNodeTypeResolver\PropertyTypeResolver\PropertyTypeResolverTest
*

View File

@ -9,7 +9,7 @@ use PHPStan\Type\Type;
use PHPStan\Type\VoidType;
use Rector\NodeTypeResolver\Contract\NodeTypeResolverInterface;
use Rector\NodeTypeResolver\NodeTypeResolver;
use RectorPrefix202208\Symfony\Contracts\Service\Attribute\Required;
use RectorPrefix202209\Symfony\Contracts\Service\Attribute\Required;
/**
* @implements NodeTypeResolverInterface<Return_>
*/

View File

@ -16,7 +16,7 @@ use Rector\NodeTypeResolver\Contract\NodeTypeResolverInterface;
use Rector\NodeTypeResolver\Node\AttributeKey;
use Rector\NodeTypeResolver\NodeTypeResolver;
use Rector\NodeTypeResolver\PHPStan\ParametersAcceptorSelectorVariantsWrapper;
use RectorPrefix202208\Symfony\Contracts\Service\Attribute\Required;
use RectorPrefix202209\Symfony\Contracts\Service\Attribute\Required;
/**
* @implements NodeTypeResolverInterface<StaticCall|MethodCall>
*/

View File

@ -11,7 +11,7 @@ use PhpParser\NodeTraverser;
use PhpParser\NodeVisitorAbstract;
use Rector\Core\Configuration\Option;
use Rector\Core\PhpParser\Node\BetterNodeFinder;
use RectorPrefix202208\Symplify\PackageBuilder\Parameter\ParameterProvider;
use RectorPrefix202209\Symplify\PackageBuilder\Parameter\ParameterProvider;
/**
* Skips performance trap in PHPStan: https://github.com/phpstan/phpstan/issues/254
*/

View File

@ -50,9 +50,8 @@ use Rector\Core\Util\StringUtils;
use Rector\NodeNameResolver\NodeNameResolver;
use Rector\NodeTypeResolver\Node\AttributeKey;
use Rector\NodeTypeResolver\PHPStan\Scope\NodeVisitor\RemoveDeepChainMethodCallNodeVisitor;
use RectorPrefix202208\Symplify\PackageBuilder\Reflection\PrivatesAccessor;
use Symplify\SmartFileSystem\SmartFileInfo;
use RectorPrefix202208\Webmozart\Assert\Assert;
use RectorPrefix202209\Symplify\PackageBuilder\Reflection\PrivatesAccessor;
use RectorPrefix202209\Webmozart\Assert\Assert;
/**
* @inspired by https://github.com/silverstripe/silverstripe-upgrader/blob/532182b23e854d02e0b27e68ebc394f436de0682/src/UpgradeRule/PHP/Visitor/PHPStanScopeVisitor.php
* - https://github.com/silverstripe/silverstripe-upgrader/pull/57/commits/e5c7cfa166ad940d9d4ff69537d9f7608e992359#diff-5e0807bb3dc03d6a8d8b6ad049abd774
@ -136,7 +135,7 @@ final class PHPStanNodeScopeResolver
* @param Stmt[] $stmts
* @return Stmt[]
*/
public function processNodes(array $stmts, SmartFileInfo $smartFileInfo, ?MutatingScope $formerMutatingScope = null) : array
public function processNodes(array $stmts, string $filePath, ?MutatingScope $formerMutatingScope = null) : array
{
$isScopeRefreshing = $formerMutatingScope instanceof MutatingScope;
/**
@ -145,9 +144,9 @@ final class PHPStanNodeScopeResolver
*/
Assert::allIsInstanceOf($stmts, Stmt::class);
$this->removeDeepChainMethodCallNodes($stmts);
$scope = $formerMutatingScope ?? $this->scopeFactory->createFromFile($smartFileInfo);
$scope = $formerMutatingScope ?? $this->scopeFactory->createFromFile($filePath);
// skip chain method calls, performance issue: https://github.com/phpstan/phpstan/issues/254
$nodeCallback = function (Node $node, MutatingScope $mutatingScope) use(&$nodeCallback, $isScopeRefreshing, $smartFileInfo) : void {
$nodeCallback = function (Node $node, MutatingScope $mutatingScope) use(&$nodeCallback, $isScopeRefreshing, $filePath) : void {
if (($node instanceof Expression || $node instanceof Return_ || $node instanceof Assign || $node instanceof EnumCase || $node instanceof AssignOp) && $node->expr instanceof Expr) {
$node->expr->setAttribute(AttributeKey::SCOPE, $mutatingScope);
}
@ -171,7 +170,7 @@ final class PHPStanNodeScopeResolver
$this->processSwitch($node, $mutatingScope);
}
if ($node instanceof TryCatch) {
$this->processTryCatch($node, $smartFileInfo, $mutatingScope);
$this->processTryCatch($node, $filePath, $mutatingScope);
}
if ($node instanceof ArrayItem) {
$this->processArrayItem($node, $mutatingScope);
@ -205,12 +204,12 @@ final class PHPStanNodeScopeResolver
}
// special case for unreachable nodes
if ($node instanceof UnreachableStatementNode) {
$this->processUnreachableStatementNode($node, $smartFileInfo, $mutatingScope);
$this->processUnreachableStatementNode($node, $filePath, $mutatingScope);
} else {
$node->setAttribute(AttributeKey::SCOPE, $mutatingScope);
}
};
return $this->processNodesWithDependentFiles($smartFileInfo, $stmts, $scope, $nodeCallback);
return $this->processNodesWithDependentFiles($filePath, $stmts, $scope, $nodeCallback);
}
private function processArrayItem(ArrayItem $arrayItem, MutatingScope $mutatingScope) : void
{
@ -236,7 +235,7 @@ final class PHPStanNodeScopeResolver
$case->setAttribute(AttributeKey::SCOPE, $mutatingScope);
}
}
private function processTryCatch(TryCatch $tryCatch, SmartFileInfo $smartFileInfo, MutatingScope $mutatingScope) : void
private function processTryCatch(TryCatch $tryCatch, string $filePath, MutatingScope $mutatingScope) : void
{
foreach ($tryCatch->catches as $catch) {
$varName = $catch->var instanceof Variable ? $this->nodeNameResolver->getName($catch->var) : null;
@ -244,22 +243,22 @@ final class PHPStanNodeScopeResolver
return new ObjectType((string) $name);
}, $catch->types));
$catchMutatingScope = $mutatingScope->enterCatchType($type, $varName);
$this->processNodes($catch->stmts, $smartFileInfo, $catchMutatingScope);
$this->processNodes($catch->stmts, $filePath, $catchMutatingScope);
}
if ($tryCatch->finally instanceof Finally_) {
$tryCatch->finally->setAttribute(AttributeKey::SCOPE, $mutatingScope);
}
}
private function processUnreachableStatementNode(UnreachableStatementNode $unreachableStatementNode, SmartFileInfo $smartFileInfo, MutatingScope $mutatingScope) : void
private function processUnreachableStatementNode(UnreachableStatementNode $unreachableStatementNode, string $filePath, MutatingScope $mutatingScope) : void
{
$originalStmt = $unreachableStatementNode->getOriginalStatement();
$originalStmt->setAttribute(AttributeKey::IS_UNREACHABLE, \true);
$originalStmt->setAttribute(AttributeKey::SCOPE, $mutatingScope);
$this->processNodes([$originalStmt], $smartFileInfo, $mutatingScope);
$this->processNodes([$originalStmt], $filePath, $mutatingScope);
$nextNode = $originalStmt->getAttribute(AttributeKey::NEXT_NODE);
while ($nextNode instanceof Stmt) {
$nextNode->setAttribute(AttributeKey::IS_UNREACHABLE, \true);
$this->processNodes([$nextNode], $smartFileInfo, $mutatingScope);
$this->processNodes([$nextNode], $filePath, $mutatingScope);
$nextNode = $nextNode->getAttribute(AttributeKey::NEXT_NODE);
}
}
@ -294,10 +293,10 @@ final class PHPStanNodeScopeResolver
* @param callable(Node $node, MutatingScope $scope): void $nodeCallback
* @return Stmt[]
*/
private function processNodesWithDependentFiles(SmartFileInfo $smartFileInfo, array $stmts, MutatingScope $mutatingScope, callable $nodeCallback) : array
private function processNodesWithDependentFiles(string $filePath, array $stmts, MutatingScope $mutatingScope, callable $nodeCallback) : array
{
$this->nodeScopeResolver->processNodes($stmts, $mutatingScope, $nodeCallback);
$this->resolveAndSaveDependentFiles($stmts, $mutatingScope, $smartFileInfo);
$this->resolveAndSaveDependentFiles($stmts, $mutatingScope, $filePath);
return $stmts;
}
/**
@ -346,7 +345,7 @@ final class PHPStanNodeScopeResolver
/**
* @param Stmt[] $stmts
*/
private function resolveAndSaveDependentFiles(array $stmts, MutatingScope $mutatingScope, SmartFileInfo $smartFileInfo) : void
private function resolveAndSaveDependentFiles(array $stmts, MutatingScope $mutatingScope, string $filePath) : void
{
$dependentFiles = [];
foreach ($stmts as $stmt) {
@ -357,7 +356,7 @@ final class PHPStanNodeScopeResolver
// @ignoreException
}
}
$this->changedFilesDetector->addFileWithDependencies($smartFileInfo, $dependentFiles);
$this->changedFilesDetector->addFileWithDependencies($filePath, $dependentFiles);
}
/**
* In case PHPStan tried to parse a file with missing class, it fails.

View File

@ -6,7 +6,6 @@ namespace Rector\NodeTypeResolver\PHPStan\Scope;
use PHPStan\Analyser\MutatingScope;
use PHPStan\Analyser\ScopeContext;
use PHPStan\Analyser\ScopeFactory as PHPStanScopeFactory;
use Symplify\SmartFileSystem\SmartFileInfo;
final class ScopeFactory
{
/**
@ -18,9 +17,9 @@ final class ScopeFactory
{
$this->phpStanScopeFactory = $phpStanScopeFactory;
}
public function createFromFile(SmartFileInfo $fileInfo) : MutatingScope
public function createFromFile(string $filePath) : MutatingScope
{
$scopeContext = ScopeContext::create($fileInfo->getRealPath());
$scopeContext = ScopeContext::create($filePath);
return $this->phpStanScopeFactory->create($scopeContext);
}
}

View File

@ -3,7 +3,7 @@
declare (strict_types=1);
namespace Rector\NodeTypeResolver\PhpDocNodeVisitor;
use RectorPrefix202208\Nette\Utils\Strings;
use RectorPrefix202209\Nette\Utils\Strings;
use PhpParser\Node as PhpParserNode;
use PHPStan\PhpDocParser\Ast\Node;
use PHPStan\PhpDocParser\Ast\PhpDoc\TemplateTagValueNode;
@ -21,8 +21,8 @@ use Rector\PhpDocParser\PhpDocParser\PhpDocNodeVisitor\AbstractPhpDocNodeVisitor
use Rector\PostRector\Collector\UseNodesToAddCollector;
use Rector\StaticTypeMapper\StaticTypeMapper;
use Rector\StaticTypeMapper\ValueObject\Type\FullyQualifiedObjectType;
use RectorPrefix202208\Symplify\PackageBuilder\Parameter\ParameterProvider;
use RectorPrefix202208\Symplify\PackageBuilder\Reflection\ClassLikeExistenceChecker;
use RectorPrefix202209\Symplify\PackageBuilder\Parameter\ParameterProvider;
use RectorPrefix202209\Symplify\PackageBuilder\Reflection\ClassLikeExistenceChecker;
final class NameImportingPhpDocNodeVisitor extends AbstractPhpDocNodeVisitor
{
/**

View File

@ -3,7 +3,7 @@
declare (strict_types=1);
namespace Rector\NodeTypeResolver\PhpDocNodeVisitor;
use RectorPrefix202208\Nette\Utils\Strings;
use RectorPrefix202209\Nette\Utils\Strings;
use PHPStan\PhpDocParser\Ast\Node;
use PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode;
use PHPStan\Type\ObjectType;

View File

@ -11,6 +11,7 @@ use PHPStan\Reflection\BetterReflection\SourceLocator\OptimizedDirectorySourceLo
use PHPStan\Reflection\BetterReflection\SourceLocator\OptimizedSingleFileSourceLocator;
use Rector\NodeTypeResolver\Contract\SourceLocatorProviderInterface;
use Rector\Testing\PHPUnit\StaticPHPUnitEnvironment;
use RectorPrefix202209\Webmozart\Assert\Assert;
final class DynamicSourceLocatorProvider implements SourceLocatorProviderInterface
{
/**
@ -73,6 +74,7 @@ final class DynamicSourceLocatorProvider implements SourceLocatorProviderInterfa
*/
public function addFilesByDirectory(string $directory, array $files) : void
{
Assert::allString($files);
$this->filesByDirectory[$directory] = $files;
}
}

View File

@ -28,7 +28,7 @@ use Rector\PHPStanStaticTypeMapper\PHPStanStaticTypeMapper;
use Rector\PHPStanStaticTypeMapper\TypeAnalyzer\UnionTypeCommonTypeNarrower;
use Rector\TypeDeclaration\NodeTypeAnalyzer\DetailedTypeAnalyzer;
use Rector\TypeDeclaration\TypeAnalyzer\GenericClassStringTypeNormalizer;
use RectorPrefix202208\Symfony\Contracts\Service\Attribute\Required;
use RectorPrefix202209\Symfony\Contracts\Service\Attribute\Required;
/**
* @see \Rector\Tests\PHPStanStaticTypeMapper\TypeMapper\ArrayTypeMapperTest
*

View File

@ -14,7 +14,7 @@ use Rector\BetterPhpDocParser\ValueObject\Type\SpacingAwareCallableTypeNode;
use Rector\PHPStanStaticTypeMapper\Contract\TypeMapperInterface;
use Rector\PHPStanStaticTypeMapper\Enum\TypeKind;
use Rector\PHPStanStaticTypeMapper\PHPStanStaticTypeMapper;
use RectorPrefix202208\Symfony\Contracts\Service\Attribute\Required;
use RectorPrefix202209\Symfony\Contracts\Service\Attribute\Required;
/**
* @implements TypeMapperInterface<CallableType>
*/

View File

@ -15,7 +15,7 @@ use PHPStan\Type\ObjectType;
use PHPStan\Type\Type;
use Rector\PHPStanStaticTypeMapper\Contract\TypeMapperInterface;
use Rector\PHPStanStaticTypeMapper\PHPStanStaticTypeMapper;
use RectorPrefix202208\Symfony\Contracts\Service\Attribute\Required;
use RectorPrefix202209\Symfony\Contracts\Service\Attribute\Required;
/**
* @implements TypeMapperInterface<ClassStringType>
*/

View File

@ -13,7 +13,7 @@ use Rector\BetterPhpDocParser\ValueObject\Type\SpacingAwareCallableTypeNode;
use Rector\PHPStanStaticTypeMapper\Contract\TypeMapperInterface;
use Rector\PHPStanStaticTypeMapper\Enum\TypeKind;
use Rector\PHPStanStaticTypeMapper\PHPStanStaticTypeMapper;
use RectorPrefix202208\Symfony\Contracts\Service\Attribute\Required;
use RectorPrefix202209\Symfony\Contracts\Service\Attribute\Required;
/**
* @implements TypeMapperInterface<ClosureType>
*/

View File

@ -17,7 +17,7 @@ use Rector\Core\Php\PhpVersionProvider;
use Rector\Core\ValueObject\PhpVersionFeature;
use Rector\PHPStanStaticTypeMapper\Contract\TypeMapperInterface;
use Rector\PHPStanStaticTypeMapper\PHPStanStaticTypeMapper;
use RectorPrefix202208\Symfony\Contracts\Service\Attribute\Required;
use RectorPrefix202209\Symfony\Contracts\Service\Attribute\Required;
/**
* @implements TypeMapperInterface<IntersectionType>
*/

View File

@ -14,7 +14,7 @@ use Rector\BetterPhpDocParser\ValueObject\Type\BracketsAwareUnionTypeNode;
use Rector\BetterPhpDocParser\ValueObject\Type\SpacingAwareArrayTypeNode;
use Rector\PHPStanStaticTypeMapper\Contract\TypeMapperInterface;
use Rector\PHPStanStaticTypeMapper\PHPStanStaticTypeMapper;
use RectorPrefix202208\Symfony\Contracts\Service\Attribute\Required;
use RectorPrefix202209\Symfony\Contracts\Service\Attribute\Required;
/**
* @implements TypeMapperInterface<IterableType>
*/

View File

@ -3,7 +3,7 @@
declare (strict_types=1);
namespace Rector\PHPStanStaticTypeMapper\TypeMapper;
use RectorPrefix202208\Nette\Utils\Strings;
use RectorPrefix202209\Nette\Utils\Strings;
use PhpParser\Node;
use PhpParser\Node\Name;
use PhpParser\Node\Name\FullyQualified;
@ -23,7 +23,7 @@ use Rector\StaticTypeMapper\ValueObject\Type\FullyQualifiedObjectType;
use Rector\StaticTypeMapper\ValueObject\Type\NonExistingObjectType;
use Rector\StaticTypeMapper\ValueObject\Type\SelfObjectType;
use Rector\StaticTypeMapper\ValueObject\Type\ShortenedObjectType;
use RectorPrefix202208\Symfony\Contracts\Service\Attribute\Required;
use RectorPrefix202209\Symfony\Contracts\Service\Attribute\Required;
/**
* @implements TypeMapperInterface<ObjectType>
*/

View File

@ -39,7 +39,7 @@ use Rector\PHPStanStaticTypeMapper\TypeAnalyzer\BoolUnionTypeAnalyzer;
use Rector\PHPStanStaticTypeMapper\TypeAnalyzer\UnionTypeAnalyzer;
use Rector\PHPStanStaticTypeMapper\TypeAnalyzer\UnionTypeCommonTypeNarrower;
use Rector\PHPStanStaticTypeMapper\ValueObject\UnionTypeAnalysis;
use RectorPrefix202208\Symfony\Contracts\Service\Attribute\Required;
use RectorPrefix202209\Symfony\Contracts\Service\Attribute\Required;
/**
* @implements TypeMapperInterface<UnionType>
*/

View File

@ -3,29 +3,29 @@
declare (strict_types=1);
namespace Rector\Parallel\Application;
use RectorPrefix202208\Clue\React\NDJson\Decoder;
use RectorPrefix202208\Clue\React\NDJson\Encoder;
use RectorPrefix202208\Nette\Utils\Random;
use RectorPrefix202208\React\EventLoop\StreamSelectLoop;
use RectorPrefix202208\React\Socket\ConnectionInterface;
use RectorPrefix202208\React\Socket\TcpServer;
use RectorPrefix202209\Clue\React\NDJson\Decoder;
use RectorPrefix202209\Clue\React\NDJson\Encoder;
use RectorPrefix202209\Nette\Utils\Random;
use RectorPrefix202209\React\EventLoop\StreamSelectLoop;
use RectorPrefix202209\React\Socket\ConnectionInterface;
use RectorPrefix202209\React\Socket\TcpServer;
use Rector\Core\Configuration\Option;
use Rector\Core\Console\Command\ProcessCommand;
use Rector\Core\ValueObject\Error\SystemError;
use Rector\Core\ValueObject\Reporting\FileDiff;
use Rector\Parallel\Command\WorkerCommandLineFactory;
use Rector\Parallel\ValueObject\Bridge;
use RectorPrefix202208\Symfony\Component\Console\Command\Command;
use RectorPrefix202208\Symfony\Component\Console\Input\InputInterface;
use RectorPrefix202208\Symplify\EasyParallel\Contract\SerializableInterface;
use RectorPrefix202208\Symplify\EasyParallel\Enum\Action;
use RectorPrefix202208\Symplify\EasyParallel\Enum\Content;
use RectorPrefix202208\Symplify\EasyParallel\Enum\ReactCommand;
use RectorPrefix202208\Symplify\EasyParallel\Enum\ReactEvent;
use RectorPrefix202208\Symplify\EasyParallel\ValueObject\ParallelProcess;
use RectorPrefix202208\Symplify\EasyParallel\ValueObject\ProcessPool;
use RectorPrefix202208\Symplify\EasyParallel\ValueObject\Schedule;
use RectorPrefix202208\Symplify\PackageBuilder\Parameter\ParameterProvider;
use RectorPrefix202209\Symfony\Component\Console\Command\Command;
use RectorPrefix202209\Symfony\Component\Console\Input\InputInterface;
use RectorPrefix202209\Symplify\EasyParallel\Contract\SerializableInterface;
use RectorPrefix202209\Symplify\EasyParallel\Enum\Action;
use RectorPrefix202209\Symplify\EasyParallel\Enum\Content;
use RectorPrefix202209\Symplify\EasyParallel\Enum\ReactCommand;
use RectorPrefix202209\Symplify\EasyParallel\Enum\ReactEvent;
use RectorPrefix202209\Symplify\EasyParallel\ValueObject\ParallelProcess;
use RectorPrefix202209\Symplify\EasyParallel\ValueObject\ProcessPool;
use RectorPrefix202209\Symplify\EasyParallel\ValueObject\Schedule;
use RectorPrefix202209\Symplify\PackageBuilder\Parameter\ParameterProvider;
use Throwable;
/**
* Inspired from @see

View File

@ -5,10 +5,10 @@ namespace Rector\Parallel\Command;
use Rector\ChangesReporting\Output\JsonOutputFormatter;
use Rector\Core\Configuration\Option;
use RectorPrefix202208\Symfony\Component\Console\Command\Command;
use RectorPrefix202208\Symfony\Component\Console\Input\InputInterface;
use RectorPrefix202208\Symplify\EasyParallel\Exception\ParallelShouldNotHappenException;
use RectorPrefix202208\Symplify\EasyParallel\Reflection\CommandFromReflectionFactory;
use RectorPrefix202209\Symfony\Component\Console\Command\Command;
use RectorPrefix202209\Symfony\Component\Console\Input\InputInterface;
use RectorPrefix202209\Symplify\EasyParallel\Exception\ParallelShouldNotHappenException;
use RectorPrefix202209\Symplify\EasyParallel\Reflection\CommandFromReflectionFactory;
/**
* @see \Rector\Tests\Parallel\Command\WorkerCommandLineFactoryTest
* @todo possibly extract to symplify/easy-parallel

View File

@ -3,8 +3,9 @@
declare (strict_types=1);
namespace Rector\Parallel;
use RectorPrefix202208\Clue\React\NDJson\Decoder;
use RectorPrefix202208\Clue\React\NDJson\Encoder;
use RectorPrefix202209\Clue\React\NDJson\Decoder;
use RectorPrefix202209\Clue\React\NDJson\Encoder;
use RectorPrefix202209\Nette\Utils\FileSystem;
use PHPStan\Analyser\NodeScopeResolver;
use Rector\Core\Application\FileProcessor\PhpFileProcessor;
use Rector\Core\Console\Style\RectorConsoleOutputStyle;
@ -14,11 +15,10 @@ use Rector\Core\ValueObject\Application\File;
use Rector\Core\ValueObject\Configuration;
use Rector\Core\ValueObject\Error\SystemError;
use Rector\Parallel\ValueObject\Bridge;
use RectorPrefix202208\Symplify\EasyParallel\Enum\Action;
use RectorPrefix202208\Symplify\EasyParallel\Enum\ReactCommand;
use RectorPrefix202208\Symplify\EasyParallel\Enum\ReactEvent;
use RectorPrefix202208\Symplify\PackageBuilder\Yaml\ParametersMerger;
use Symplify\SmartFileSystem\SmartFileInfo;
use RectorPrefix202209\Symplify\EasyParallel\Enum\Action;
use RectorPrefix202209\Symplify\EasyParallel\Enum\ReactCommand;
use RectorPrefix202209\Symplify\EasyParallel\Enum\ReactEvent;
use RectorPrefix202209\Symplify\PackageBuilder\Yaml\ParametersMerger;
use Throwable;
final class WorkerRunner
{
@ -90,8 +90,7 @@ final class WorkerRunner
$this->nodeScopeResolver->setAnalysedFiles($filePaths);
foreach ($filePaths as $filePath) {
try {
$smartFileInfo = new SmartFileInfo($filePath);
$file = new File($smartFileInfo, $smartFileInfo->getContents());
$file = new File($filePath, FileSystem::read($filePath));
$this->currentFileProvider->setFile($file);
if (!$this->phpFileProcessor->supports($file, $configuration)) {
continue;

View File

@ -13,8 +13,8 @@ use Rector\Core\PhpParser\Node\Value\ValueResolver;
use Rector\PhpAttribute\AnnotationToAttributeMapper;
use Rector\PhpAttribute\Contract\AnnotationToAttributeMapperInterface;
use Rector\PhpAttribute\Enum\DocTagNodeState;
use RectorPrefix202208\Symfony\Contracts\Service\Attribute\Required;
use RectorPrefix202208\Webmozart\Assert\Assert;
use RectorPrefix202209\Symfony\Contracts\Service\Attribute\Required;
use RectorPrefix202209\Webmozart\Assert\Assert;
/**
* @implements AnnotationToAttributeMapperInterface<mixed[]>
*/

View File

@ -9,7 +9,7 @@ use PhpParser\Node\Scalar\String_;
use Rector\BetterPhpDocParser\PhpDoc\ArrayItemNode;
use Rector\PhpAttribute\AnnotationToAttributeMapper;
use Rector\PhpAttribute\Contract\AnnotationToAttributeMapperInterface;
use RectorPrefix202208\Symfony\Contracts\Service\Attribute\Required;
use RectorPrefix202209\Symfony\Contracts\Service\Attribute\Required;
/**
* @implements AnnotationToAttributeMapperInterface<ArrayItemNode>
*/

Some files were not shown because too many files have changed in this diff Show More