mirror of
https://github.com/rectorphp/rector.git
synced 2024-06-09 04:32:33 +00:00
Updated Rector to commit 0c035c390d
5689cbe017
remove passing extra fileInfo with file, already included7bba40aa32
remove OPTION_ prefixc2ce6104d3
remove extra parma in value object77a90c5fd4
remove is cache debugff3de640d4
add shot options constant0c035c390d
misc
This commit is contained in:
parent
b5f061b071
commit
98ca09597d
|
@ -30,7 +30,7 @@ return static function (\Symfony\Component\DependencyInjection\Loader\Configurat
|
|||
// @see https://wiki.php.net/rfc/stringable
|
||||
'Stringable',
|
||||
]]]);
|
||||
$services->set(\Rector\DowngradePhp80\Rector\Class_\DowngradeAttributeToAnnotationRector::class)->call('configure', [[\Rector\DowngradePhp80\Rector\Class_\DowngradeAttributeToAnnotationRector::ATTRIBUTE_TO_ANNOTATION => \Symplify\SymfonyPhpConfig\ValueObjectInliner::inline([new \Rector\DowngradePhp80\ValueObject\DowngradeAttributeToAnnotation('Attribute', 'Attribute')])]]);
|
||||
$services->set(\Rector\DowngradePhp80\Rector\Class_\DowngradeAttributeToAnnotationRector::class)->call('configure', [[\Rector\DowngradePhp80\Rector\Class_\DowngradeAttributeToAnnotationRector::ATTRIBUTE_TO_ANNOTATION => \Symplify\SymfonyPhpConfig\ValueObjectInliner::inline([new \Rector\DowngradePhp80\ValueObject\DowngradeAttributeToAnnotation('Attribute')])]]);
|
||||
$services->set(\Rector\DowngradePhp80\Rector\Property\DowngradeUnionTypeTypedPropertyRector::class);
|
||||
$services->set(\Rector\DowngradePhp80\Rector\FunctionLike\DowngradeUnionTypeDeclarationRector::class);
|
||||
$services->set(\Rector\DowngradePhp80\Rector\FunctionLike\DowngradeMixedTypeDeclarationRector::class);
|
||||
|
|
|
@ -30,6 +30,6 @@ final class FileInfoParser
|
|||
{
|
||||
$oldStmts = $this->parser->parseFileInfo($smartFileInfo);
|
||||
$file = new \Rector\Core\ValueObject\Application\File($smartFileInfo, $smartFileInfo->getContents());
|
||||
return $this->nodeScopeAndMetadataDecorator->decorateNodesFromFile($file, $oldStmts, $smartFileInfo);
|
||||
return $this->nodeScopeAndMetadataDecorator->decorateNodesFromFile($file, $oldStmts);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,7 +16,6 @@ use Rector\NodeTypeResolver\NodeVisitor\FunctionMethodAndClassNodeVisitor;
|
|||
use Rector\NodeTypeResolver\NodeVisitor\NamespaceNodeVisitor;
|
||||
use Rector\NodeTypeResolver\NodeVisitor\StatementNodeVisitor;
|
||||
use Rector\NodeTypeResolver\PHPStan\Scope\PHPStanNodeScopeResolver;
|
||||
use Symplify\SmartFileSystem\SmartFileInfo;
|
||||
final class NodeScopeAndMetadataDecorator
|
||||
{
|
||||
/**
|
||||
|
@ -66,7 +65,7 @@ final class NodeScopeAndMetadataDecorator
|
|||
* @param Stmt[] $nodes
|
||||
* @return Stmt[]
|
||||
*/
|
||||
public function decorateNodesFromFile(\Rector\Core\ValueObject\Application\File $file, array $nodes, \Symplify\SmartFileSystem\SmartFileInfo $smartFileInfo) : array
|
||||
public function decorateNodesFromFile(\Rector\Core\ValueObject\Application\File $file, array $nodes) : array
|
||||
{
|
||||
$nodeTraverser = new \PhpParser\NodeTraverser();
|
||||
$nodeTraverser->addVisitor(new \PhpParser\NodeVisitor\NameResolver(null, [
|
||||
|
@ -74,7 +73,9 @@ final class NodeScopeAndMetadataDecorator
|
|||
// required by PHPStan
|
||||
'replaceNodes' => \true,
|
||||
]));
|
||||
/** @var Stmt[] $nodes */
|
||||
$nodes = $nodeTraverser->traverse($nodes);
|
||||
$smartFileInfo = $file->getSmartFileInfo();
|
||||
$nodes = $this->phpStanNodeScopeResolver->processNodes($nodes, $smartFileInfo);
|
||||
$nodeTraverser = new \PhpParser\NodeTraverser();
|
||||
$preservingNameResolver = new \PhpParser\NodeVisitor\NameResolver(null, [
|
||||
|
|
|
@ -178,7 +178,6 @@ final class PHPStanNodeScopeResolver
|
|||
if (!$this->configuration->isCacheEnabled()) {
|
||||
return;
|
||||
}
|
||||
$this->reportCacheDebug($smartFileInfo, $dependentFiles);
|
||||
// save for cache
|
||||
$this->changedFilesDetector->addFileWithDependencies($smartFileInfo, $dependentFiles);
|
||||
}
|
||||
|
@ -195,18 +194,4 @@ final class PHPStanNodeScopeResolver
|
|||
}
|
||||
return $classLike->name->toString();
|
||||
}
|
||||
/**
|
||||
* @param string[] $dependentFiles
|
||||
*/
|
||||
private function reportCacheDebug(\Symplify\SmartFileSystem\SmartFileInfo $smartFileInfo, array $dependentFiles) : void
|
||||
{
|
||||
if (!$this->configuration->isCacheDebug()) {
|
||||
return;
|
||||
}
|
||||
$message = \sprintf('[debug] %d dependencies for "%s" file', \count($dependentFiles), $smartFileInfo->getRealPath());
|
||||
$this->symfonyStyle->note($message);
|
||||
if ($dependentFiles !== []) {
|
||||
$this->symfonyStyle->listing($dependentFiles);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ final class TestingParser
|
|||
$this->parameterProvider->changeParameter(\Rector\Core\Configuration\Option::SOURCE, [$file]);
|
||||
$nodes = $this->parser->parseFileInfo($smartFileInfo);
|
||||
$file = new \Rector\Core\ValueObject\Application\File($smartFileInfo, $smartFileInfo->getContents());
|
||||
return $this->nodeScopeAndMetadataDecorator->decorateNodesFromFile($file, $nodes, $smartFileInfo);
|
||||
return $this->nodeScopeAndMetadataDecorator->decorateNodesFromFile($file, $nodes);
|
||||
}
|
||||
/**
|
||||
* @template T of Node
|
||||
|
|
|
@ -66,7 +66,7 @@ class SymfonyRoute
|
|||
}
|
||||
}
|
||||
CODE_SAMPLE
|
||||
, [self::ATTRIBUTE_TO_ANNOTATION => [new \Rector\DowngradePhp80\ValueObject\DowngradeAttributeToAnnotation('Symfony\\Component\\Routing\\Annotation\\Route', 'Symfony\\Component\\Routing\\Annotation\\Route')]])]);
|
||||
, [self::ATTRIBUTE_TO_ANNOTATION => [new \Rector\DowngradePhp80\ValueObject\DowngradeAttributeToAnnotation('Symfony\\Component\\Routing\\Annotation\\Route')]])]);
|
||||
}
|
||||
/**
|
||||
* @return array<class-string<Node>>
|
||||
|
|
|
@ -10,14 +10,14 @@ final class DowngradeAttributeToAnnotation
|
|||
*/
|
||||
private $attributeClass;
|
||||
/**
|
||||
* @var string
|
||||
* @var string|null
|
||||
*/
|
||||
private $tag;
|
||||
/**
|
||||
* @param class-string $attributeClass
|
||||
* @param class-string|string $tag
|
||||
* @param class-string|string|null $tag
|
||||
*/
|
||||
public function __construct(string $attributeClass, string $tag)
|
||||
public function __construct(string $attributeClass, ?string $tag = null)
|
||||
{
|
||||
$this->attributeClass = $attributeClass;
|
||||
$this->tag = $tag;
|
||||
|
@ -28,6 +28,9 @@ final class DowngradeAttributeToAnnotation
|
|||
}
|
||||
public function getTag() : string
|
||||
{
|
||||
if ($this->tag === null) {
|
||||
return $this->attributeClass;
|
||||
}
|
||||
return $this->tag;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ final class FileProcessor
|
|||
$smartFileInfo = $file->getSmartFileInfo();
|
||||
$oldStmts = $this->parser->parseFileInfo($smartFileInfo);
|
||||
$oldTokens = $this->lexer->getTokens();
|
||||
$newStmts = $this->nodeScopeAndMetadataDecorator->decorateNodesFromFile($file, $oldStmts, $smartFileInfo);
|
||||
$newStmts = $this->nodeScopeAndMetadataDecorator->decorateNodesFromFile($file, $oldStmts);
|
||||
$file->hydrateStmtsAndTokens($newStmts, $oldStmts, $oldTokens);
|
||||
}
|
||||
public function refactor(\Rector\Core\ValueObject\Application\File $file) : void
|
||||
|
|
|
@ -16,11 +16,11 @@ final class VersionResolver
|
|||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const PACKAGE_VERSION = '28891ea62d7ee55dd7a247668b43aa10e6aec4ae';
|
||||
public const PACKAGE_VERSION = '0c035c390d4afd73b76f186313d4b7f7d906e072';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const RELEASE_DATE = '2021-06-22 17:24:53';
|
||||
public const RELEASE_DATE = '2021-06-22 17:45:36';
|
||||
public static function resolvePackageVersion() : string
|
||||
{
|
||||
$process = new \RectorPrefix20210622\Symfony\Component\Process\Process(['git', 'log', '--pretty="%H"', '-n1', 'HEAD'], __DIR__);
|
||||
|
|
|
@ -33,11 +33,11 @@ final class AdditionalAutoloader
|
|||
}
|
||||
public function autoloadInput(\RectorPrefix20210622\Symfony\Component\Console\Input\InputInterface $input) : void
|
||||
{
|
||||
if (!$input->hasOption(\Rector\Core\Configuration\Option::OPTION_AUTOLOAD_FILE)) {
|
||||
if (!$input->hasOption(\Rector\Core\Configuration\Option::AUTOLOAD_FILE)) {
|
||||
return;
|
||||
}
|
||||
/** @var string|null $autoloadFile */
|
||||
$autoloadFile = $input->getOption(\Rector\Core\Configuration\Option::OPTION_AUTOLOAD_FILE);
|
||||
$autoloadFile = $input->getOption(\Rector\Core\Configuration\Option::AUTOLOAD_FILE);
|
||||
if ($autoloadFile === null) {
|
||||
return;
|
||||
}
|
||||
|
@ -47,9 +47,6 @@ final class AdditionalAutoloader
|
|||
public function autoloadPaths() : void
|
||||
{
|
||||
$autoloadPaths = $this->parameterProvider->provideArrayParameter(\Rector\Core\Configuration\Option::AUTOLOAD_PATHS);
|
||||
if ($autoloadPaths === []) {
|
||||
return;
|
||||
}
|
||||
$this->dynamicSourceLocatorDecorator->addPaths($autoloadPaths);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,10 +27,6 @@ final class Configuration
|
|||
* @var string
|
||||
*/
|
||||
private $outputFormat;
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
private $isCacheDebug = \false;
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
|
@ -67,12 +63,11 @@ final class Configuration
|
|||
*/
|
||||
public function resolveFromInput(\RectorPrefix20210622\Symfony\Component\Console\Input\InputInterface $input) : void
|
||||
{
|
||||
$this->isDryRun = (bool) $input->getOption(\Rector\Core\Configuration\Option::OPTION_DRY_RUN);
|
||||
$this->shouldClearCache = (bool) $input->getOption(\Rector\Core\Configuration\Option::OPTION_CLEAR_CACHE);
|
||||
$this->isDryRun = (bool) $input->getOption(\Rector\Core\Configuration\Option::DRY_RUN);
|
||||
$this->shouldClearCache = (bool) $input->getOption(\Rector\Core\Configuration\Option::CLEAR_CACHE);
|
||||
$this->showProgressBar = $this->canShowProgressBar($input);
|
||||
$this->showDiffs = !(bool) $input->getOption(\Rector\Core\Configuration\Option::OPTION_NO_DIFFS);
|
||||
$this->isCacheDebug = (bool) $input->getOption(\Rector\Core\Configuration\Option::CACHE_DEBUG);
|
||||
$this->outputFormat = (string) $input->getOption(\Rector\Core\Configuration\Option::OPTION_OUTPUT_FORMAT);
|
||||
$this->showDiffs = !(bool) $input->getOption(\Rector\Core\Configuration\Option::NO_DIFFS);
|
||||
$this->outputFormat = (string) $input->getOption(\Rector\Core\Configuration\Option::OUTPUT_FORMAT);
|
||||
$commandLinePaths = (array) $input->getArgument(\Rector\Core\Configuration\Option::SOURCE);
|
||||
// manual command line value has priority
|
||||
if ($commandLinePaths !== []) {
|
||||
|
@ -93,19 +88,12 @@ final class Configuration
|
|||
}
|
||||
public function shouldShowProgressBar() : bool
|
||||
{
|
||||
if ($this->isCacheDebug) {
|
||||
return \false;
|
||||
}
|
||||
return $this->showProgressBar;
|
||||
}
|
||||
public function shouldClearCache() : bool
|
||||
{
|
||||
return $this->shouldClearCache;
|
||||
}
|
||||
public function isCacheDebug() : bool
|
||||
{
|
||||
return $this->isCacheDebug;
|
||||
}
|
||||
public function isCacheEnabled() : bool
|
||||
{
|
||||
return $this->isCacheEnabled;
|
||||
|
@ -165,11 +153,11 @@ final class Configuration
|
|||
}
|
||||
private function canShowProgressBar(\RectorPrefix20210622\Symfony\Component\Console\Input\InputInterface $input) : bool
|
||||
{
|
||||
$noProgressBar = (bool) $input->getOption(\Rector\Core\Configuration\Option::OPTION_NO_PROGRESS_BAR);
|
||||
$noProgressBar = (bool) $input->getOption(\Rector\Core\Configuration\Option::NO_PROGRESS_BAR);
|
||||
if ($noProgressBar) {
|
||||
return \false;
|
||||
}
|
||||
$optionOutputFormat = $input->getOption(\Rector\Core\Configuration\Option::OPTION_OUTPUT_FORMAT);
|
||||
$optionOutputFormat = $input->getOption(\Rector\Core\Configuration\Option::OUTPUT_FORMAT);
|
||||
return $optionOutputFormat === \Rector\ChangesReporting\Output\ConsoleOutputFormatter::NAME;
|
||||
}
|
||||
/**
|
||||
|
|
|
@ -13,7 +13,7 @@ final class Option
|
|||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const OPTION_AUTOLOAD_FILE = 'autoload-file';
|
||||
public const AUTOLOAD_FILE = 'autoload-file';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
|
@ -21,15 +21,19 @@ final class Option
|
|||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const OPTION_DRY_RUN = 'dry-run';
|
||||
public const DRY_RUN = 'dry-run';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const OPTION_OUTPUT_FORMAT = 'output-format';
|
||||
public const DRY_RUN_SHORT = 'n';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const OPTION_NO_PROGRESS_BAR = 'no-progress-bar';
|
||||
public const OUTPUT_FORMAT = 'output-format';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const NO_PROGRESS_BAR = 'no-progress-bar';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
|
@ -53,15 +57,11 @@ final class Option
|
|||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const OPTION_CLEAR_CACHE = 'clear-cache';
|
||||
public const CLEAR_CACHE = 'clear-cache';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const ENABLE_CACHE = 'enable_cache';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const CACHE_DEBUG = 'cache-debug';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
|
@ -89,7 +89,7 @@ final class Option
|
|||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const OPTION_DEBUG = 'debug';
|
||||
public const DEBUG = 'debug';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
|
@ -97,7 +97,7 @@ final class Option
|
|||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const OPTION_CONFIG = 'config';
|
||||
public const CONFIG = 'config';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
|
@ -109,7 +109,7 @@ final class Option
|
|||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const OPTION_NO_DIFFS = 'no-diffs';
|
||||
public const NO_DIFFS = 'no-diffs';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
|
@ -118,4 +118,12 @@ final class Option
|
|||
* @var string
|
||||
*/
|
||||
public const ENABLE_EDITORCONFIG = 'enable_editorconfig';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const AUTOLOAD_FILE_SHORT = 'a';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const OUTPUT_FORMAT_SHORT = 'o';
|
||||
}
|
||||
|
|
|
@ -91,15 +91,14 @@ final class ProcessCommand extends \RectorPrefix20210622\Symfony\Component\Conso
|
|||
{
|
||||
$this->setDescription('Upgrade or refactor source code with provided rectors');
|
||||
$this->addArgument(\Rector\Core\Configuration\Option::SOURCE, \RectorPrefix20210622\Symfony\Component\Console\Input\InputArgument::OPTIONAL | \RectorPrefix20210622\Symfony\Component\Console\Input\InputArgument::IS_ARRAY, 'Files or directories to be upgraded.');
|
||||
$this->addOption(\Rector\Core\Configuration\Option::OPTION_DRY_RUN, 'n', \RectorPrefix20210622\Symfony\Component\Console\Input\InputOption::VALUE_NONE, 'See diff of changes, do not save them to files.');
|
||||
$this->addOption(\Rector\Core\Configuration\Option::OPTION_AUTOLOAD_FILE, 'a', \RectorPrefix20210622\Symfony\Component\Console\Input\InputOption::VALUE_REQUIRED, 'File with extra autoload');
|
||||
$this->addOption(\Rector\Core\Configuration\Option::DRY_RUN, \Rector\Core\Configuration\Option::DRY_RUN_SHORT, \RectorPrefix20210622\Symfony\Component\Console\Input\InputOption::VALUE_NONE, 'See diff of changes, do not save them to files.');
|
||||
$this->addOption(\Rector\Core\Configuration\Option::AUTOLOAD_FILE, \Rector\Core\Configuration\Option::AUTOLOAD_FILE_SHORT, \RectorPrefix20210622\Symfony\Component\Console\Input\InputOption::VALUE_REQUIRED, 'File with extra autoload');
|
||||
$names = $this->outputFormatterCollector->getNames();
|
||||
$description = \sprintf('Select output format: "%s".', \implode('", "', $names));
|
||||
$this->addOption(\Rector\Core\Configuration\Option::OPTION_OUTPUT_FORMAT, 'o', \RectorPrefix20210622\Symfony\Component\Console\Input\InputOption::VALUE_OPTIONAL, $description, \Rector\ChangesReporting\Output\ConsoleOutputFormatter::NAME);
|
||||
$this->addOption(\Rector\Core\Configuration\Option::OPTION_NO_PROGRESS_BAR, null, \RectorPrefix20210622\Symfony\Component\Console\Input\InputOption::VALUE_NONE, 'Hide progress bar. Useful e.g. for nicer CI output.');
|
||||
$this->addOption(\Rector\Core\Configuration\Option::OPTION_NO_DIFFS, null, \RectorPrefix20210622\Symfony\Component\Console\Input\InputOption::VALUE_NONE, 'Hide diffs of changed files. Useful e.g. for nicer CI output.');
|
||||
$this->addOption(\Rector\Core\Configuration\Option::CACHE_DEBUG, null, \RectorPrefix20210622\Symfony\Component\Console\Input\InputOption::VALUE_NONE, 'Debug changed file cache');
|
||||
$this->addOption(\Rector\Core\Configuration\Option::OPTION_CLEAR_CACHE, null, \RectorPrefix20210622\Symfony\Component\Console\Input\InputOption::VALUE_NONE, 'Clear unchaged files cache');
|
||||
$this->addOption(\Rector\Core\Configuration\Option::OUTPUT_FORMAT, \Rector\Core\Configuration\Option::OUTPUT_FORMAT_SHORT, \RectorPrefix20210622\Symfony\Component\Console\Input\InputOption::VALUE_OPTIONAL, $description, \Rector\ChangesReporting\Output\ConsoleOutputFormatter::NAME);
|
||||
$this->addOption(\Rector\Core\Configuration\Option::NO_PROGRESS_BAR, null, \RectorPrefix20210622\Symfony\Component\Console\Input\InputOption::VALUE_NONE, 'Hide progress bar. Useful e.g. for nicer CI output.');
|
||||
$this->addOption(\Rector\Core\Configuration\Option::NO_DIFFS, null, \RectorPrefix20210622\Symfony\Component\Console\Input\InputOption::VALUE_NONE, 'Hide diffs of changed files. Useful e.g. for nicer CI output.');
|
||||
$this->addOption(\Rector\Core\Configuration\Option::CLEAR_CACHE, null, \RectorPrefix20210622\Symfony\Component\Console\Input\InputOption::VALUE_NONE, 'Clear unchaged files cache');
|
||||
}
|
||||
protected function execute(\RectorPrefix20210622\Symfony\Component\Console\Input\InputInterface $input, \RectorPrefix20210622\Symfony\Component\Console\Output\OutputInterface $output) : int
|
||||
{
|
||||
|
@ -121,7 +120,7 @@ final class ProcessCommand extends \RectorPrefix20210622\Symfony\Component\Conso
|
|||
$this->configurePHPStanNodeScopeResolver($files);
|
||||
$this->applicationFileProcessor->run($files);
|
||||
// report diffs and errors
|
||||
$outputFormat = (string) $input->getOption(\Rector\Core\Configuration\Option::OPTION_OUTPUT_FORMAT);
|
||||
$outputFormat = (string) $input->getOption(\Rector\Core\Configuration\Option::OUTPUT_FORMAT);
|
||||
$outputFormatter = $this->outputFormatterCollector->getByName($outputFormat);
|
||||
// here should be value obect factory
|
||||
$processResult = $this->processResultFactory->create($files);
|
||||
|
@ -136,7 +135,7 @@ final class ProcessCommand extends \RectorPrefix20210622\Symfony\Component\Conso
|
|||
if (!$application instanceof \RectorPrefix20210622\Symfony\Component\Console\Application) {
|
||||
throw new \Rector\Core\Exception\ShouldNotHappenException();
|
||||
}
|
||||
$optionDebug = (bool) $input->getOption(\Rector\Core\Configuration\Option::OPTION_DEBUG);
|
||||
$optionDebug = (bool) $input->getOption(\Rector\Core\Configuration\Option::DEBUG);
|
||||
if ($optionDebug) {
|
||||
$application->setCatchExceptions(\false);
|
||||
// clear cache
|
||||
|
@ -144,7 +143,7 @@ final class ProcessCommand extends \RectorPrefix20210622\Symfony\Component\Conso
|
|||
return;
|
||||
}
|
||||
// clear cache
|
||||
$optionClearCache = (bool) $input->getOption(\Rector\Core\Configuration\Option::OPTION_CLEAR_CACHE);
|
||||
$optionClearCache = (bool) $input->getOption(\Rector\Core\Configuration\Option::CLEAR_CACHE);
|
||||
if ($optionClearCache) {
|
||||
$this->changedFilesDetector->clear();
|
||||
}
|
||||
|
|
|
@ -43,11 +43,11 @@ final class ShowCommand extends \RectorPrefix20210622\Symfony\Component\Console\
|
|||
$this->setDescription('Show loaded Rectors with their configuration');
|
||||
$names = $this->showOutputFormatterCollector->getNames();
|
||||
$description = \sprintf('Select output format: "%s".', \implode('", "', $names));
|
||||
$this->addOption(\Rector\Core\Configuration\Option::OPTION_OUTPUT_FORMAT, 'o', \RectorPrefix20210622\Symfony\Component\Console\Input\InputOption::VALUE_OPTIONAL, $description, \Rector\ChangesReporting\Output\ConsoleOutputFormatter::NAME);
|
||||
$this->addOption(\Rector\Core\Configuration\Option::OUTPUT_FORMAT, 'o', \RectorPrefix20210622\Symfony\Component\Console\Input\InputOption::VALUE_OPTIONAL, $description, \Rector\ChangesReporting\Output\ConsoleOutputFormatter::NAME);
|
||||
}
|
||||
protected function execute(\RectorPrefix20210622\Symfony\Component\Console\Input\InputInterface $input, \RectorPrefix20210622\Symfony\Component\Console\Output\OutputInterface $output) : int
|
||||
{
|
||||
$outputFormat = (string) $input->getOption(\Rector\Core\Configuration\Option::OPTION_OUTPUT_FORMAT);
|
||||
$outputFormat = (string) $input->getOption(\Rector\Core\Configuration\Option::OUTPUT_FORMAT);
|
||||
$this->reportLoadedRectors($outputFormat);
|
||||
return \RectorPrefix20210622\Symplify\PackageBuilder\Console\ShellCode::SUCCESS;
|
||||
}
|
||||
|
|
|
@ -103,10 +103,10 @@ final class ConsoleApplication extends \RectorPrefix20210622\Symfony\Component\C
|
|||
}
|
||||
private function addCustomOptions(\RectorPrefix20210622\Symfony\Component\Console\Input\InputDefinition $inputDefinition) : void
|
||||
{
|
||||
$inputDefinition->addOption(new \RectorPrefix20210622\Symfony\Component\Console\Input\InputOption(\Rector\Core\Configuration\Option::OPTION_CONFIG, 'c', \RectorPrefix20210622\Symfony\Component\Console\Input\InputOption::VALUE_REQUIRED, 'Path to config file', $this->getDefaultConfigPath()));
|
||||
$inputDefinition->addOption(new \RectorPrefix20210622\Symfony\Component\Console\Input\InputOption(\Rector\Core\Configuration\Option::OPTION_DEBUG, null, \RectorPrefix20210622\Symfony\Component\Console\Input\InputOption::VALUE_NONE, 'Enable debug verbosity (-vvv)'));
|
||||
$inputDefinition->addOption(new \RectorPrefix20210622\Symfony\Component\Console\Input\InputOption(\Rector\Core\Configuration\Option::CONFIG, 'c', \RectorPrefix20210622\Symfony\Component\Console\Input\InputOption::VALUE_REQUIRED, 'Path to config file', $this->getDefaultConfigPath()));
|
||||
$inputDefinition->addOption(new \RectorPrefix20210622\Symfony\Component\Console\Input\InputOption(\Rector\Core\Configuration\Option::DEBUG, null, \RectorPrefix20210622\Symfony\Component\Console\Input\InputOption::VALUE_NONE, 'Enable debug verbosity (-vvv)'));
|
||||
$inputDefinition->addOption(new \RectorPrefix20210622\Symfony\Component\Console\Input\InputOption(\Rector\Core\Configuration\Option::XDEBUG, null, \RectorPrefix20210622\Symfony\Component\Console\Input\InputOption::VALUE_NONE, 'Allow running xdebug'));
|
||||
$inputDefinition->addOption(new \RectorPrefix20210622\Symfony\Component\Console\Input\InputOption(\Rector\Core\Configuration\Option::OPTION_CLEAR_CACHE, null, \RectorPrefix20210622\Symfony\Component\Console\Input\InputOption::VALUE_NONE, 'Clear cache'));
|
||||
$inputDefinition->addOption(new \RectorPrefix20210622\Symfony\Component\Console\Input\InputOption(\Rector\Core\Configuration\Option::CLEAR_CACHE, null, \RectorPrefix20210622\Symfony\Component\Console\Input\InputOption::VALUE_NONE, 'Clear cache'));
|
||||
$inputDefinition->addOption(new \RectorPrefix20210622\Symfony\Component\Console\Input\InputOption('working-dir', null, \RectorPrefix20210622\Symfony\Component\Console\Input\InputOption::VALUE_REQUIRED, 'If specified, use the given directory as working directory.'));
|
||||
}
|
||||
private function getDefaultConfigPath() : string
|
||||
|
|
|
@ -77,7 +77,7 @@ final class FunctionLikeReflectionParser
|
|||
$nodes = (array) $this->parser->parse($fileContent);
|
||||
$smartFileInfo = new \Symplify\SmartFileSystem\SmartFileInfo($fileName);
|
||||
$file = new \Rector\Core\ValueObject\Application\File($smartFileInfo, $smartFileInfo->getContents());
|
||||
$nodes = $this->nodeScopeAndMetadataDecorator->decorateNodesFromFile($file, $nodes, $smartFileInfo);
|
||||
$nodes = $this->nodeScopeAndMetadataDecorator->decorateNodesFromFile($file, $nodes);
|
||||
$class = $this->nodeFinder->findFirstInstanceOf($nodes, \PhpParser\Node\Stmt\Class_::class);
|
||||
if (!$class instanceof \PhpParser\Node\Stmt\Class_) {
|
||||
return null;
|
||||
|
|
|
@ -35,6 +35,9 @@ final class DynamicSourceLocatorDecorator
|
|||
*/
|
||||
public function addPaths(array $paths) : void
|
||||
{
|
||||
if ($paths === []) {
|
||||
return;
|
||||
}
|
||||
$files = $this->fileSystemFilter->filterFiles($paths);
|
||||
$this->dynamicSourceLocatorProvider->addFiles($files);
|
||||
$directories = $this->fileSystemFilter->filterDirectories($paths);
|
||||
|
|
2
vendor/autoload.php
vendored
2
vendor/autoload.php
vendored
|
@ -4,4 +4,4 @@
|
|||
|
||||
require_once __DIR__ . '/composer/autoload_real.php';
|
||||
|
||||
return ComposerAutoloaderInitd80854e8a6fe965ca7944db3a256157f::getLoader();
|
||||
return ComposerAutoloaderInit3fbf0929cc1ff1fc5e070dfc2b26765b::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 ComposerAutoloaderInitd80854e8a6fe965ca7944db3a256157f
|
||||
class ComposerAutoloaderInit3fbf0929cc1ff1fc5e070dfc2b26765b
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
|
@ -22,15 +22,15 @@ class ComposerAutoloaderInitd80854e8a6fe965ca7944db3a256157f
|
|||
return self::$loader;
|
||||
}
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInitd80854e8a6fe965ca7944db3a256157f', 'loadClassLoader'), true, true);
|
||||
spl_autoload_register(array('ComposerAutoloaderInit3fbf0929cc1ff1fc5e070dfc2b26765b', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInitd80854e8a6fe965ca7944db3a256157f', 'loadClassLoader'));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit3fbf0929cc1ff1fc5e070dfc2b26765b', '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\ComposerStaticInitd80854e8a6fe965ca7944db3a256157f::getInitializer($loader));
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit3fbf0929cc1ff1fc5e070dfc2b26765b::getInitializer($loader));
|
||||
} else {
|
||||
$classMap = require __DIR__ . '/autoload_classmap.php';
|
||||
if ($classMap) {
|
||||
|
@ -42,19 +42,19 @@ class ComposerAutoloaderInitd80854e8a6fe965ca7944db3a256157f
|
|||
$loader->register(true);
|
||||
|
||||
if ($useStaticLoader) {
|
||||
$includeFiles = Composer\Autoload\ComposerStaticInitd80854e8a6fe965ca7944db3a256157f::$files;
|
||||
$includeFiles = Composer\Autoload\ComposerStaticInit3fbf0929cc1ff1fc5e070dfc2b26765b::$files;
|
||||
} else {
|
||||
$includeFiles = require __DIR__ . '/autoload_files.php';
|
||||
}
|
||||
foreach ($includeFiles as $fileIdentifier => $file) {
|
||||
composerRequired80854e8a6fe965ca7944db3a256157f($fileIdentifier, $file);
|
||||
composerRequire3fbf0929cc1ff1fc5e070dfc2b26765b($fileIdentifier, $file);
|
||||
}
|
||||
|
||||
return $loader;
|
||||
}
|
||||
}
|
||||
|
||||
function composerRequired80854e8a6fe965ca7944db3a256157f($fileIdentifier, $file)
|
||||
function composerRequire3fbf0929cc1ff1fc5e070dfc2b26765b($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 ComposerStaticInitd80854e8a6fe965ca7944db3a256157f
|
||||
class ComposerStaticInit3fbf0929cc1ff1fc5e070dfc2b26765b
|
||||
{
|
||||
public static $files = array (
|
||||
'a4a119a56e50fbb293281d9a48007e0e' => __DIR__ . '/..' . '/symfony/polyfill-php80/bootstrap.php',
|
||||
|
@ -3869,9 +3869,9 @@ class ComposerStaticInitd80854e8a6fe965ca7944db3a256157f
|
|||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInitd80854e8a6fe965ca7944db3a256157f::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInitd80854e8a6fe965ca7944db3a256157f::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInitd80854e8a6fe965ca7944db3a256157f::$classMap;
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit3fbf0929cc1ff1fc5e070dfc2b26765b::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit3fbf0929cc1ff1fc5e070dfc2b26765b::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit3fbf0929cc1ff1fc5e070dfc2b26765b::$classMap;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
|
|
10
vendor/scoper-autoload.php
vendored
10
vendor/scoper-autoload.php
vendored
|
@ -21,8 +21,8 @@ if (!class_exists('SomeTestCase', false) && !interface_exists('SomeTestCase', fa
|
|||
if (!class_exists('CheckoutEntityFactory', false) && !interface_exists('CheckoutEntityFactory', false) && !trait_exists('CheckoutEntityFactory', false)) {
|
||||
spl_autoload_call('RectorPrefix20210622\CheckoutEntityFactory');
|
||||
}
|
||||
if (!class_exists('ComposerAutoloaderInitd80854e8a6fe965ca7944db3a256157f', false) && !interface_exists('ComposerAutoloaderInitd80854e8a6fe965ca7944db3a256157f', false) && !trait_exists('ComposerAutoloaderInitd80854e8a6fe965ca7944db3a256157f', false)) {
|
||||
spl_autoload_call('RectorPrefix20210622\ComposerAutoloaderInitd80854e8a6fe965ca7944db3a256157f');
|
||||
if (!class_exists('ComposerAutoloaderInit3fbf0929cc1ff1fc5e070dfc2b26765b', false) && !interface_exists('ComposerAutoloaderInit3fbf0929cc1ff1fc5e070dfc2b26765b', false) && !trait_exists('ComposerAutoloaderInit3fbf0929cc1ff1fc5e070dfc2b26765b', false)) {
|
||||
spl_autoload_call('RectorPrefix20210622\ComposerAutoloaderInit3fbf0929cc1ff1fc5e070dfc2b26765b');
|
||||
}
|
||||
if (!class_exists('Doctrine\Inflector\Inflector', false) && !interface_exists('Doctrine\Inflector\Inflector', false) && !trait_exists('Doctrine\Inflector\Inflector', false)) {
|
||||
spl_autoload_call('RectorPrefix20210622\Doctrine\Inflector\Inflector');
|
||||
|
@ -3323,9 +3323,9 @@ if (!function_exists('print_node')) {
|
|||
return \RectorPrefix20210622\print_node(...func_get_args());
|
||||
}
|
||||
}
|
||||
if (!function_exists('composerRequired80854e8a6fe965ca7944db3a256157f')) {
|
||||
function composerRequired80854e8a6fe965ca7944db3a256157f() {
|
||||
return \RectorPrefix20210622\composerRequired80854e8a6fe965ca7944db3a256157f(...func_get_args());
|
||||
if (!function_exists('composerRequire3fbf0929cc1ff1fc5e070dfc2b26765b')) {
|
||||
function composerRequire3fbf0929cc1ff1fc5e070dfc2b26765b() {
|
||||
return \RectorPrefix20210622\composerRequire3fbf0929cc1ff1fc5e070dfc2b26765b(...func_get_args());
|
||||
}
|
||||
}
|
||||
if (!function_exists('parseArgs')) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user