mirror of https://github.com/rectorphp/rector.git
Updated Rector to commit 6e9378e3bf2a4ae78fb53d93e193be473ffcb5d4
6e9378e3bf
[DX] Merge RectorOutputStyle, OutputStyleInterface to RectorStyle (#4711)
This commit is contained in:
parent
8689c339f5
commit
cd0b3a7cca
|
@ -8,7 +8,7 @@ use Rector\ChangesReporting\Output\JsonOutputFormatter;
|
|||
use Rector\Core\Bootstrap\RectorConfigsResolver;
|
||||
use Rector\Core\Configuration\Option;
|
||||
use Rector\Core\Console\ConsoleApplication;
|
||||
use Rector\Core\Console\Style\RectorConsoleOutputStyleFactory;
|
||||
use Rector\Core\Console\Style\SymfonyStyleFactory;
|
||||
use Rector\Core\DependencyInjection\RectorContainerFactory;
|
||||
use Rector\Core\Kernel\RectorKernel;
|
||||
use Rector\Core\Util\Reflection\PrivatesAccessor;
|
||||
|
@ -121,9 +121,9 @@ try {
|
|||
echo Json::encode(['fatal_errors' => [$throwable->getMessage()]]);
|
||||
} else {
|
||||
// report fatal errors in console format
|
||||
$rectorConsoleOutputStyleFactory = new RectorConsoleOutputStyleFactory(new PrivatesAccessor());
|
||||
$rectorConsoleOutputStyle = $rectorConsoleOutputStyleFactory->create();
|
||||
$rectorConsoleOutputStyle->error($throwable->getMessage());
|
||||
$symfonyStyleFactory = new SymfonyStyleFactory(new PrivatesAccessor());
|
||||
$symfonyStyle = $symfonyStyleFactory->create();
|
||||
$symfonyStyle->error($throwable->getMessage());
|
||||
}
|
||||
exit(Command::FAILURE);
|
||||
}
|
||||
|
|
|
@ -40,8 +40,7 @@ use Rector\Core\Configuration\ConfigInitializer;
|
|||
use Rector\Core\Console\Command\ListRulesCommand;
|
||||
use Rector\Core\Console\ConsoleApplication;
|
||||
use Rector\Core\Console\Output\OutputFormatterCollector;
|
||||
use Rector\Core\Console\Style\RectorConsoleOutputStyle;
|
||||
use Rector\Core\Console\Style\RectorConsoleOutputStyleFactory;
|
||||
use Rector\Core\Console\Style\RectorStyle;
|
||||
use Rector\Core\Console\Style\SymfonyStyleFactory;
|
||||
use Rector\Core\Contract\Processor\FileProcessorInterface;
|
||||
use Rector\Core\Contract\Rector\NonPhpRectorInterface;
|
||||
|
@ -137,7 +136,6 @@ return static function (RectorConfig $rectorConfig) : void {
|
|||
$services->set(BuilderFactory::class);
|
||||
$services->set(CloningVisitor::class);
|
||||
$services->set(NodeFinder::class);
|
||||
$services->set(RectorConsoleOutputStyle::class)->factory([service(RectorConsoleOutputStyleFactory::class), 'create']);
|
||||
$services->set(Parser::class)->factory([service(PHPStanServicesFactory::class), 'createPHPStanParser']);
|
||||
$services->set(Lexer::class)->factory([service(PHPStanServicesFactory::class), 'createEmulativeLexer']);
|
||||
$services->set(InflectorFactory::class);
|
||||
|
@ -145,6 +143,7 @@ return static function (RectorConfig $rectorConfig) : void {
|
|||
$services->set(VersionParser::class);
|
||||
// console
|
||||
$services->set(SymfonyStyleFactory::class);
|
||||
$services->alias(RectorStyle::class, SymfonyStyle::class);
|
||||
$services->set(SymfonyStyle::class)->factory([service(SymfonyStyleFactory::class), 'create']);
|
||||
// cache
|
||||
$services->set(DependencyResolver::class)->factory([service(PHPStanServicesFactory::class), 'createDependencyResolver']);
|
||||
|
|
|
@ -6,18 +6,18 @@ namespace Rector\ChangesReporting\Output;
|
|||
use RectorPrefix202308\Nette\Utils\Strings;
|
||||
use Rector\ChangesReporting\Annotation\RectorsChangelogResolver;
|
||||
use Rector\ChangesReporting\Contract\Output\OutputFormatterInterface;
|
||||
use Rector\Core\Contract\Console\OutputStyleInterface;
|
||||
use Rector\Core\ValueObject\Configuration;
|
||||
use Rector\Core\ValueObject\Error\SystemError;
|
||||
use Rector\Core\ValueObject\ProcessResult;
|
||||
use Rector\Core\ValueObject\Reporting\FileDiff;
|
||||
use RectorPrefix202308\Symfony\Component\Console\Style\SymfonyStyle;
|
||||
final class ConsoleOutputFormatter implements OutputFormatterInterface
|
||||
{
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Core\Contract\Console\OutputStyleInterface
|
||||
* @var \Symfony\Component\Console\Style\SymfonyStyle
|
||||
*/
|
||||
private $rectorOutputStyle;
|
||||
private $symfonyStyle;
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\ChangesReporting\Annotation\RectorsChangelogResolver
|
||||
|
@ -32,9 +32,9 @@ final class ConsoleOutputFormatter implements OutputFormatterInterface
|
|||
* @see https://regex101.com/r/q8I66g/1
|
||||
*/
|
||||
private const ON_LINE_REGEX = '# on line #';
|
||||
public function __construct(OutputStyleInterface $rectorOutputStyle, RectorsChangelogResolver $rectorsChangelogResolver)
|
||||
public function __construct(SymfonyStyle $symfonyStyle, RectorsChangelogResolver $rectorsChangelogResolver)
|
||||
{
|
||||
$this->rectorOutputStyle = $rectorOutputStyle;
|
||||
$this->symfonyStyle = $symfonyStyle;
|
||||
$this->rectorsChangelogResolver = $rectorsChangelogResolver;
|
||||
}
|
||||
public function report(ProcessResult $processResult, Configuration $configuration) : void
|
||||
|
@ -48,10 +48,10 @@ final class ConsoleOutputFormatter implements OutputFormatterInterface
|
|||
}
|
||||
// to keep space between progress bar and success message
|
||||
if ($configuration->shouldShowProgressBar() && $processResult->getFileDiffs() === []) {
|
||||
$this->rectorOutputStyle->newLine();
|
||||
$this->symfonyStyle->newLine();
|
||||
}
|
||||
$message = $this->createSuccessMessage($processResult, $configuration);
|
||||
$this->rectorOutputStyle->success($message);
|
||||
$this->symfonyStyle->success($message);
|
||||
}
|
||||
public function getName() : string
|
||||
{
|
||||
|
@ -68,7 +68,7 @@ final class ConsoleOutputFormatter implements OutputFormatterInterface
|
|||
// normalize
|
||||
\ksort($fileDiffs);
|
||||
$message = \sprintf('%d file%s with changes', \count($fileDiffs), \count($fileDiffs) === 1 ? '' : 's');
|
||||
$this->rectorOutputStyle->title($message);
|
||||
$this->symfonyStyle->title($message);
|
||||
$i = 0;
|
||||
foreach ($fileDiffs as $fileDiff) {
|
||||
$relativeFilePath = $fileDiff->getRelativeFilePath();
|
||||
|
@ -78,14 +78,14 @@ final class ConsoleOutputFormatter implements OutputFormatterInterface
|
|||
$relativeFilePath .= ':' . $firstLineNumber;
|
||||
}
|
||||
$message = \sprintf('<options=bold>%d) %s</>', ++$i, $relativeFilePath);
|
||||
$this->rectorOutputStyle->writeln($message);
|
||||
$this->rectorOutputStyle->newLine();
|
||||
$this->rectorOutputStyle->writeln($fileDiff->getDiffConsoleFormatted());
|
||||
$this->symfonyStyle->writeln($message);
|
||||
$this->symfonyStyle->newLine();
|
||||
$this->symfonyStyle->writeln($fileDiff->getDiffConsoleFormatted());
|
||||
$rectorsChangelogsLines = $this->createRectorChangelogLines($fileDiff);
|
||||
if ($fileDiff->getRectorChanges() !== []) {
|
||||
$this->rectorOutputStyle->writeln('<options=underscore>Applied rules:</>');
|
||||
$this->rectorOutputStyle->listing($rectorsChangelogsLines);
|
||||
$this->rectorOutputStyle->newLine();
|
||||
$this->symfonyStyle->writeln('<options=underscore>Applied rules:</>');
|
||||
$this->symfonyStyle->listing($rectorsChangelogsLines);
|
||||
$this->symfonyStyle->newLine();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -101,7 +101,7 @@ final class ConsoleOutputFormatter implements OutputFormatterInterface
|
|||
if ($error->getLine() !== null) {
|
||||
$message .= ' On line: ' . $error->getLine();
|
||||
}
|
||||
$this->rectorOutputStyle->error($message);
|
||||
$this->symfonyStyle->error($message);
|
||||
}
|
||||
}
|
||||
private function normalizePathsToRelativeWithLine(string $errorMessage) : string
|
||||
|
|
|
@ -8,7 +8,6 @@ use PHPStan\Analyser\NodeScopeResolver;
|
|||
use Rector\Caching\Detector\ChangedFilesDetector;
|
||||
use Rector\Core\Configuration\Option;
|
||||
use Rector\Core\Configuration\Parameter\SimpleParameterProvider;
|
||||
use Rector\Core\Contract\Console\OutputStyleInterface;
|
||||
use Rector\Core\Contract\Processor\FileProcessorInterface;
|
||||
use Rector\Core\Provider\CurrentFileProvider;
|
||||
use Rector\Core\Util\ArrayParametersMerger;
|
||||
|
@ -21,6 +20,7 @@ use Rector\Parallel\Application\ParallelFileProcessor;
|
|||
use Rector\Parallel\ValueObject\Bridge;
|
||||
use Rector\Testing\PHPUnit\StaticPHPUnitEnvironment;
|
||||
use RectorPrefix202308\Symfony\Component\Console\Input\InputInterface;
|
||||
use RectorPrefix202308\Symfony\Component\Console\Style\SymfonyStyle;
|
||||
use RectorPrefix202308\Symplify\EasyParallel\CpuCoreCountProvider;
|
||||
use RectorPrefix202308\Symplify\EasyParallel\Exception\ParallelShouldNotHappenException;
|
||||
use RectorPrefix202308\Symplify\EasyParallel\ScheduleFactory;
|
||||
|
@ -29,9 +29,9 @@ final class ApplicationFileProcessor
|
|||
{
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Core\Contract\Console\OutputStyleInterface
|
||||
* @var \Symfony\Component\Console\Style\SymfonyStyle
|
||||
*/
|
||||
private $rectorOutputStyle;
|
||||
private $symfonyStyle;
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Core\ValueObjectFactory\Application\FileFactory
|
||||
|
@ -88,9 +88,9 @@ final class ApplicationFileProcessor
|
|||
/**
|
||||
* @param FileProcessorInterface[] $fileProcessors
|
||||
*/
|
||||
public function __construct(OutputStyleInterface $rectorOutputStyle, FileFactory $fileFactory, NodeScopeResolver $nodeScopeResolver, ArrayParametersMerger $arrayParametersMerger, ParallelFileProcessor $parallelFileProcessor, ScheduleFactory $scheduleFactory, CpuCoreCountProvider $cpuCoreCountProvider, ChangedFilesDetector $changedFilesDetector, CurrentFileProvider $currentFileProvider, iterable $fileProcessors)
|
||||
public function __construct(SymfonyStyle $symfonyStyle, FileFactory $fileFactory, NodeScopeResolver $nodeScopeResolver, ArrayParametersMerger $arrayParametersMerger, ParallelFileProcessor $parallelFileProcessor, ScheduleFactory $scheduleFactory, CpuCoreCountProvider $cpuCoreCountProvider, ChangedFilesDetector $changedFilesDetector, CurrentFileProvider $currentFileProvider, iterable $fileProcessors)
|
||||
{
|
||||
$this->rectorOutputStyle = $rectorOutputStyle;
|
||||
$this->symfonyStyle = $symfonyStyle;
|
||||
$this->fileFactory = $fileFactory;
|
||||
$this->nodeScopeResolver = $nodeScopeResolver;
|
||||
$this->arrayParametersMerger = $arrayParametersMerger;
|
||||
|
@ -133,8 +133,8 @@ final class ApplicationFileProcessor
|
|||
// progress bar on parallel handled on runParallel()
|
||||
if (!$isParallel && $shouldShowProgressBar) {
|
||||
$fileCount = \count($filePaths);
|
||||
$this->rectorOutputStyle->progressStart($fileCount);
|
||||
$this->rectorOutputStyle->progressAdvance(0);
|
||||
$this->symfonyStyle->progressStart($fileCount);
|
||||
$this->symfonyStyle->progressAdvance(0);
|
||||
}
|
||||
$systemErrorsAndFileDiffs = [Bridge::SYSTEM_ERRORS => [], Bridge::FILE_DIFFS => [], Bridge::SYSTEM_ERRORS_COUNT => 0];
|
||||
foreach ($filePaths as $filePath) {
|
||||
|
@ -145,7 +145,7 @@ final class ApplicationFileProcessor
|
|||
// progress bar +1,
|
||||
// progress bar on parallel handled on runParallel()
|
||||
if (!$isParallel && $shouldShowProgressBar) {
|
||||
$this->rectorOutputStyle->progressAdvance();
|
||||
$this->symfonyStyle->progressAdvance();
|
||||
}
|
||||
} catch (Throwable $throwable) {
|
||||
$this->invalidateFile($file);
|
||||
|
@ -185,7 +185,7 @@ final class ApplicationFileProcessor
|
|||
{
|
||||
$errorMessage = \sprintf('System error: "%s"', $throwable->getMessage()) . \PHP_EOL;
|
||||
$filePath = $filePath instanceof File ? $filePath->getFilePath() : $filePath;
|
||||
if ($this->rectorOutputStyle->isDebug()) {
|
||||
if ($this->symfonyStyle->isDebug()) {
|
||||
return new SystemError($errorMessage . \PHP_EOL . 'Stack trace:' . \PHP_EOL . $throwable->getTraceAsString(), $filePath, $throwable->getLine());
|
||||
}
|
||||
$errorMessage .= 'Run Rector with "--debug" option and post the report here: https://github.com/rectorphp/rector/issues/new';
|
||||
|
@ -232,10 +232,10 @@ final class ApplicationFileProcessor
|
|||
};
|
||||
if ($configuration->shouldShowProgressBar()) {
|
||||
$fileCount = \count($filePaths);
|
||||
$this->rectorOutputStyle->progressStart($fileCount);
|
||||
$this->rectorOutputStyle->progressAdvance(0);
|
||||
$this->symfonyStyle->progressStart($fileCount);
|
||||
$this->symfonyStyle->progressAdvance(0);
|
||||
$postFileCallback = function (int $stepCount) : void {
|
||||
$this->rectorOutputStyle->progressAdvance($stepCount);
|
||||
$this->symfonyStyle->progressAdvance($stepCount);
|
||||
// running in parallel here → nothing else to do
|
||||
};
|
||||
}
|
||||
|
|
|
@ -9,7 +9,6 @@ use Rector\Caching\Detector\ChangedFilesDetector;
|
|||
use Rector\ChangesReporting\ValueObjectFactory\ErrorFactory;
|
||||
use Rector\ChangesReporting\ValueObjectFactory\FileDiffFactory;
|
||||
use Rector\Core\Application\FileProcessor;
|
||||
use Rector\Core\Contract\Console\OutputStyleInterface;
|
||||
use Rector\Core\Contract\Processor\FileProcessorInterface;
|
||||
use Rector\Core\Exception\ShouldNotHappenException;
|
||||
use Rector\Core\FileSystem\FilePathHelper;
|
||||
|
@ -21,6 +20,7 @@ use Rector\Core\ValueObject\Reporting\FileDiff;
|
|||
use Rector\Parallel\ValueObject\Bridge;
|
||||
use Rector\PostRector\Application\PostFileProcessor;
|
||||
use Rector\Testing\PHPUnit\StaticPHPUnitEnvironment;
|
||||
use RectorPrefix202308\Symfony\Component\Console\Style\SymfonyStyle;
|
||||
use Throwable;
|
||||
final class PhpFileProcessor implements FileProcessorInterface
|
||||
{
|
||||
|
@ -36,9 +36,9 @@ final class PhpFileProcessor implements FileProcessorInterface
|
|||
private $fileProcessor;
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Core\Contract\Console\OutputStyleInterface
|
||||
* @var \Symfony\Component\Console\Style\SymfonyStyle
|
||||
*/
|
||||
private $rectorOutputStyle;
|
||||
private $symfonyStyle;
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\ChangesReporting\ValueObjectFactory\FileDiffFactory
|
||||
|
@ -69,11 +69,11 @@ final class PhpFileProcessor implements FileProcessorInterface
|
|||
* @see https://regex101.com/r/xP2MGa/1
|
||||
*/
|
||||
private const OPEN_TAG_SPACED_REGEX = '#^(?<open_tag_spaced>[^\\S\\r\\n]+\\<\\?php)#m';
|
||||
public function __construct(FormatPerservingPrinter $formatPerservingPrinter, FileProcessor $fileProcessor, OutputStyleInterface $rectorOutputStyle, FileDiffFactory $fileDiffFactory, ChangedFilesDetector $changedFilesDetector, PostFileProcessor $postFileProcessor, ErrorFactory $errorFactory, FilePathHelper $filePathHelper)
|
||||
public function __construct(FormatPerservingPrinter $formatPerservingPrinter, FileProcessor $fileProcessor, SymfonyStyle $symfonyStyle, FileDiffFactory $fileDiffFactory, ChangedFilesDetector $changedFilesDetector, PostFileProcessor $postFileProcessor, ErrorFactory $errorFactory, FilePathHelper $filePathHelper)
|
||||
{
|
||||
$this->formatPerservingPrinter = $formatPerservingPrinter;
|
||||
$this->fileProcessor = $fileProcessor;
|
||||
$this->rectorOutputStyle = $rectorOutputStyle;
|
||||
$this->symfonyStyle = $symfonyStyle;
|
||||
$this->fileDiffFactory = $fileDiffFactory;
|
||||
$this->changedFilesDetector = $changedFilesDetector;
|
||||
$this->postFileProcessor = $postFileProcessor;
|
||||
|
@ -158,7 +158,7 @@ final class PhpFileProcessor implements FileProcessorInterface
|
|||
$autoloadSystemError = $this->errorFactory->createAutoloadError($analysedCodeException, $file->getFilePath());
|
||||
return [$autoloadSystemError];
|
||||
} catch (Throwable $throwable) {
|
||||
if ($this->rectorOutputStyle->isVerbose() || StaticPHPUnitEnvironment::isPHPUnitRun()) {
|
||||
if ($this->symfonyStyle->isVerbose() || StaticPHPUnitEnvironment::isPHPUnitRun()) {
|
||||
throw $throwable;
|
||||
}
|
||||
$relativeFilePath = $this->filePathHelper->relativePath($file->getFilePath());
|
||||
|
@ -203,10 +203,10 @@ final class PhpFileProcessor implements FileProcessorInterface
|
|||
}
|
||||
private function notifyFile(File $file) : void
|
||||
{
|
||||
if (!$this->rectorOutputStyle->isVerbose()) {
|
||||
if (!$this->symfonyStyle->isVerbose()) {
|
||||
return;
|
||||
}
|
||||
$relativeFilePath = $this->filePathHelper->relativePath($file->getFilePath());
|
||||
$this->rectorOutputStyle->writeln($relativeFilePath);
|
||||
$this->symfonyStyle->writeln($relativeFilePath);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,12 +19,12 @@ final class VersionResolver
|
|||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const PACKAGE_VERSION = 'acce9fa86f3942563d11dddf5c37114ee5ae8c00';
|
||||
public const PACKAGE_VERSION = '6e9378e3bf2a4ae78fb53d93e193be473ffcb5d4';
|
||||
/**
|
||||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const RELEASE_DATE = '2023-08-07 18:34:02';
|
||||
public const RELEASE_DATE = '2023-08-07 21:45:42';
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
|
|
|
@ -5,19 +5,19 @@ namespace Rector\Core\Configuration;
|
|||
|
||||
use Rector\ChangesReporting\Output\ConsoleOutputFormatter;
|
||||
use Rector\Core\Configuration\Parameter\SimpleParameterProvider;
|
||||
use Rector\Core\Contract\Console\OutputStyleInterface;
|
||||
use Rector\Core\ValueObject\Configuration;
|
||||
use RectorPrefix202308\Symfony\Component\Console\Input\InputInterface;
|
||||
use RectorPrefix202308\Symfony\Component\Console\Style\SymfonyStyle;
|
||||
final class ConfigurationFactory
|
||||
{
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Core\Contract\Console\OutputStyleInterface
|
||||
* @var \Symfony\Component\Console\Style\SymfonyStyle
|
||||
*/
|
||||
private $rectorOutputStyle;
|
||||
public function __construct(OutputStyleInterface $rectorOutputStyle)
|
||||
private $symfonyStyle;
|
||||
public function __construct(SymfonyStyle $symfonyStyle)
|
||||
{
|
||||
$this->rectorOutputStyle = $rectorOutputStyle;
|
||||
$this->symfonyStyle = $symfonyStyle;
|
||||
}
|
||||
/**
|
||||
* @api used in tests
|
||||
|
@ -52,7 +52,7 @@ final class ConfigurationFactory
|
|||
if ($noProgressBar) {
|
||||
return \false;
|
||||
}
|
||||
if ($this->rectorOutputStyle->isVerbose()) {
|
||||
if ($this->symfonyStyle->isVerbose()) {
|
||||
return \false;
|
||||
}
|
||||
return $outputFormat === ConsoleOutputFormatter::NAME;
|
||||
|
|
|
@ -6,7 +6,6 @@ namespace Rector\Core\Console\Command;
|
|||
use RectorPrefix202308\Nette\Utils\Json;
|
||||
use Rector\ChangesReporting\Output\ConsoleOutputFormatter;
|
||||
use Rector\Core\Configuration\Option;
|
||||
use Rector\Core\Console\Output\RectorOutputStyle;
|
||||
use Rector\Core\Contract\Rector\RectorInterface;
|
||||
use Rector\PostRector\Contract\Rector\ComplementaryRectorInterface;
|
||||
use Rector\PostRector\Contract\Rector\PostRectorInterface;
|
||||
|
@ -15,14 +14,15 @@ use RectorPrefix202308\Symfony\Component\Console\Command\Command;
|
|||
use RectorPrefix202308\Symfony\Component\Console\Input\InputInterface;
|
||||
use RectorPrefix202308\Symfony\Component\Console\Input\InputOption;
|
||||
use RectorPrefix202308\Symfony\Component\Console\Output\OutputInterface;
|
||||
use RectorPrefix202308\Symfony\Component\Console\Style\SymfonyStyle;
|
||||
use RectorPrefix202308\Symfony\Component\DependencyInjection\Argument\RewindableGenerator;
|
||||
final class ListRulesCommand extends Command
|
||||
{
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Core\Console\Output\RectorOutputStyle
|
||||
* @var \Symfony\Component\Console\Style\SymfonyStyle
|
||||
*/
|
||||
private $rectorOutputStyle;
|
||||
private $symfonyStyle;
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Skipper\SkipCriteriaResolver\SkippedClassResolver
|
||||
|
@ -35,9 +35,9 @@ final class ListRulesCommand extends Command
|
|||
/**
|
||||
* @param RewindableGenerator<RectorInterface>|RectorInterface[] $rectors
|
||||
*/
|
||||
public function __construct(RectorOutputStyle $rectorOutputStyle, SkippedClassResolver $skippedClassResolver, iterable $rectors)
|
||||
public function __construct(SymfonyStyle $symfonyStyle, SkippedClassResolver $skippedClassResolver, iterable $rectors)
|
||||
{
|
||||
$this->rectorOutputStyle = $rectorOutputStyle;
|
||||
$this->symfonyStyle = $symfonyStyle;
|
||||
$this->skippedClassResolver = $skippedClassResolver;
|
||||
parent::__construct();
|
||||
if ($rectors instanceof RewindableGenerator) {
|
||||
|
@ -61,11 +61,11 @@ final class ListRulesCommand extends Command
|
|||
echo Json::encode($data, Json::PRETTY) . \PHP_EOL;
|
||||
return Command::SUCCESS;
|
||||
}
|
||||
$this->rectorOutputStyle->title('Loaded Rector rules');
|
||||
$this->rectorOutputStyle->listing($rectorClasses);
|
||||
$this->symfonyStyle->title('Loaded Rector rules');
|
||||
$this->symfonyStyle->listing($rectorClasses);
|
||||
if ($skippedClasses !== []) {
|
||||
$this->rectorOutputStyle->title('Skipped Rector rules');
|
||||
$this->rectorOutputStyle->listing($skippedClasses);
|
||||
$this->symfonyStyle->title('Skipped Rector rules');
|
||||
$this->symfonyStyle->listing($skippedClasses);
|
||||
}
|
||||
return Command::SUCCESS;
|
||||
}
|
||||
|
|
|
@ -11,7 +11,6 @@ use Rector\Core\Configuration\ConfigInitializer;
|
|||
use Rector\Core\Configuration\Option;
|
||||
use Rector\Core\Console\ExitCode;
|
||||
use Rector\Core\Console\Output\OutputFormatterCollector;
|
||||
use Rector\Core\Contract\Console\OutputStyleInterface;
|
||||
use Rector\Core\Exception\ShouldNotHappenException;
|
||||
use Rector\Core\StaticReflection\DynamicSourceLocatorDecorator;
|
||||
use Rector\Core\Util\MemoryLimiter;
|
||||
|
@ -21,6 +20,7 @@ use Rector\Core\ValueObjectFactory\ProcessResultFactory;
|
|||
use RectorPrefix202308\Symfony\Component\Console\Application;
|
||||
use RectorPrefix202308\Symfony\Component\Console\Input\InputInterface;
|
||||
use RectorPrefix202308\Symfony\Component\Console\Output\OutputInterface;
|
||||
use RectorPrefix202308\Symfony\Component\Console\Style\SymfonyStyle;
|
||||
final class ProcessCommand extends \Rector\Core\Console\Command\AbstractProcessCommand
|
||||
{
|
||||
/**
|
||||
|
@ -60,15 +60,15 @@ final class ProcessCommand extends \Rector\Core\Console\Command\AbstractProcessC
|
|||
private $outputFormatterCollector;
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Core\Contract\Console\OutputStyleInterface
|
||||
* @var \Symfony\Component\Console\Style\SymfonyStyle
|
||||
*/
|
||||
private $rectorOutputStyle;
|
||||
private $symfonyStyle;
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Core\Util\MemoryLimiter
|
||||
*/
|
||||
private $memoryLimiter;
|
||||
public function __construct(AdditionalAutoloader $additionalAutoloader, ChangedFilesDetector $changedFilesDetector, ConfigInitializer $configInitializer, ApplicationFileProcessor $applicationFileProcessor, ProcessResultFactory $processResultFactory, DynamicSourceLocatorDecorator $dynamicSourceLocatorDecorator, OutputFormatterCollector $outputFormatterCollector, OutputStyleInterface $rectorOutputStyle, MemoryLimiter $memoryLimiter)
|
||||
public function __construct(AdditionalAutoloader $additionalAutoloader, ChangedFilesDetector $changedFilesDetector, ConfigInitializer $configInitializer, ApplicationFileProcessor $applicationFileProcessor, ProcessResultFactory $processResultFactory, DynamicSourceLocatorDecorator $dynamicSourceLocatorDecorator, OutputFormatterCollector $outputFormatterCollector, SymfonyStyle $symfonyStyle, MemoryLimiter $memoryLimiter)
|
||||
{
|
||||
$this->additionalAutoloader = $additionalAutoloader;
|
||||
$this->changedFilesDetector = $changedFilesDetector;
|
||||
|
@ -77,7 +77,7 @@ final class ProcessCommand extends \Rector\Core\Console\Command\AbstractProcessC
|
|||
$this->processResultFactory = $processResultFactory;
|
||||
$this->dynamicSourceLocatorDecorator = $dynamicSourceLocatorDecorator;
|
||||
$this->outputFormatterCollector = $outputFormatterCollector;
|
||||
$this->rectorOutputStyle = $rectorOutputStyle;
|
||||
$this->symfonyStyle = $symfonyStyle;
|
||||
$this->memoryLimiter = $memoryLimiter;
|
||||
parent::__construct();
|
||||
}
|
||||
|
@ -98,7 +98,7 @@ final class ProcessCommand extends \Rector\Core\Console\Command\AbstractProcessC
|
|||
$this->memoryLimiter->adjust($configuration);
|
||||
// disable console output in case of json output formatter
|
||||
if ($configuration->getOutputFormat() === JsonOutputFormatter::NAME) {
|
||||
$this->rectorOutputStyle->setVerbosity(OutputInterface::VERBOSITY_QUIET);
|
||||
$this->symfonyStyle->setVerbosity(OutputInterface::VERBOSITY_QUIET);
|
||||
}
|
||||
$this->additionalAutoloader->autoloadInput($input);
|
||||
$this->additionalAutoloader->autoloadPaths();
|
||||
|
@ -106,7 +106,7 @@ final class ProcessCommand extends \Rector\Core\Console\Command\AbstractProcessC
|
|||
// 1. add files and directories to static locator
|
||||
$this->dynamicSourceLocatorDecorator->addPaths($paths);
|
||||
if ($this->dynamicSourceLocatorDecorator->isPathsEmpty()) {
|
||||
$this->rectorOutputStyle->error('The given paths do not match any files');
|
||||
$this->symfonyStyle->error('The given paths do not match any files');
|
||||
return ExitCode::FAILURE;
|
||||
}
|
||||
// MAIN PHASE
|
||||
|
|
|
@ -7,6 +7,7 @@ use RectorPrefix202308\Composer\XdebugHandler\XdebugHandler;
|
|||
use Rector\ChangesReporting\Output\ConsoleOutputFormatter;
|
||||
use Rector\Core\Application\VersionResolver;
|
||||
use Rector\Core\Configuration\Option;
|
||||
use Rector\Core\Util\Reflection\PrivatesAccessor;
|
||||
use RectorPrefix202308\Symfony\Component\Console\Application;
|
||||
use RectorPrefix202308\Symfony\Component\Console\Command\Command;
|
||||
use RectorPrefix202308\Symfony\Component\Console\Input\InputDefinition;
|
||||
|
@ -32,6 +33,13 @@ final class ConsoleApplication extends Application
|
|||
}
|
||||
Assert::allIsInstanceOf($commands, Command::class);
|
||||
$this->addCommands($commands);
|
||||
// remove unused commands
|
||||
$privatesAccessor = new PrivatesAccessor();
|
||||
$privatesAccessor->propertyClosure($this, 'commands', static function (array $commands) : array {
|
||||
unset($commands['completion']);
|
||||
unset($commands['help']);
|
||||
return $commands;
|
||||
});
|
||||
// run this command, if no command name is provided
|
||||
$this->setDefaultCommand('process');
|
||||
}
|
||||
|
|
|
@ -1,78 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\Core\Console\Output;
|
||||
|
||||
use Rector\Core\Console\Style\RectorConsoleOutputStyle;
|
||||
use Rector\Core\Contract\Console\OutputStyleInterface;
|
||||
/**
|
||||
* This services helps to abstract from Symfony, and allow custom output formatters to use this Rector internal class.
|
||||
* It is very helpful while scoping Rector from analysed project.
|
||||
*/
|
||||
final class RectorOutputStyle implements OutputStyleInterface
|
||||
{
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Core\Console\Style\RectorConsoleOutputStyle
|
||||
*/
|
||||
private $rectorConsoleOutputStyle;
|
||||
public function __construct(RectorConsoleOutputStyle $rectorConsoleOutputStyle)
|
||||
{
|
||||
$this->rectorConsoleOutputStyle = $rectorConsoleOutputStyle;
|
||||
}
|
||||
public function progressStart(int $fileCount) : void
|
||||
{
|
||||
$this->rectorConsoleOutputStyle->createProgressBar($fileCount);
|
||||
}
|
||||
public function progressAdvance(int $step = 1) : void
|
||||
{
|
||||
$this->rectorConsoleOutputStyle->progressAdvance($step);
|
||||
}
|
||||
public function error(string $message) : void
|
||||
{
|
||||
$this->rectorConsoleOutputStyle->error($message);
|
||||
}
|
||||
public function warning(string $message) : void
|
||||
{
|
||||
$this->rectorConsoleOutputStyle->warning($message);
|
||||
}
|
||||
public function success(string $message) : void
|
||||
{
|
||||
$this->rectorConsoleOutputStyle->success($message);
|
||||
}
|
||||
public function note(string $message) : void
|
||||
{
|
||||
$this->rectorConsoleOutputStyle->note($message);
|
||||
}
|
||||
public function title(string $message) : void
|
||||
{
|
||||
$this->rectorConsoleOutputStyle->title($message);
|
||||
}
|
||||
public function writeln(string $message) : void
|
||||
{
|
||||
$this->rectorConsoleOutputStyle->writeln($message);
|
||||
}
|
||||
public function newLine(int $count = 1) : void
|
||||
{
|
||||
$this->rectorConsoleOutputStyle->newLine($count);
|
||||
}
|
||||
/**
|
||||
* @param string[] $elements
|
||||
*/
|
||||
public function listing(array $elements) : void
|
||||
{
|
||||
$this->rectorConsoleOutputStyle->listing($elements);
|
||||
}
|
||||
public function isVerbose() : bool
|
||||
{
|
||||
return $this->rectorConsoleOutputStyle->isVerbose();
|
||||
}
|
||||
public function isDebug() : bool
|
||||
{
|
||||
return $this->rectorConsoleOutputStyle->isDebug();
|
||||
}
|
||||
public function setVerbosity(int $level) : void
|
||||
{
|
||||
$this->rectorConsoleOutputStyle->setVerbosity($level);
|
||||
}
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\Core\Console\Style;
|
||||
|
||||
use Rector\Core\Util\Reflection\PrivatesAccessor;
|
||||
use RectorPrefix202308\Symfony\Component\Console\Application;
|
||||
use RectorPrefix202308\Symfony\Component\Console\Input\ArgvInput;
|
||||
use RectorPrefix202308\Symfony\Component\Console\Output\ConsoleOutput;
|
||||
use RectorPrefix202308\Symfony\Component\Console\Output\OutputInterface;
|
||||
final class RectorConsoleOutputStyleFactory
|
||||
{
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Core\Util\Reflection\PrivatesAccessor
|
||||
*/
|
||||
private $privatesAccessor;
|
||||
public function __construct(PrivatesAccessor $privatesAccessor)
|
||||
{
|
||||
$this->privatesAccessor = $privatesAccessor;
|
||||
}
|
||||
public function create() : \Rector\Core\Console\Style\RectorConsoleOutputStyle
|
||||
{
|
||||
$argvInput = new ArgvInput();
|
||||
$consoleOutput = new ConsoleOutput();
|
||||
// to configure all -v, -vv, -vvv options without memory-lock to Application run() arguments
|
||||
$this->privatesAccessor->callPrivateMethod(new Application(), 'configureIO', [$argvInput, $consoleOutput]);
|
||||
// --debug is called
|
||||
if ($argvInput->hasParameterOption('--debug')) {
|
||||
$consoleOutput->setVerbosity(OutputInterface::VERBOSITY_DEBUG);
|
||||
}
|
||||
return new \Rector\Core\Console\Style\RectorConsoleOutputStyle($argvInput, $consoleOutput);
|
||||
}
|
||||
}
|
|
@ -9,7 +9,7 @@ use RectorPrefix202308\Symfony\Component\Console\Helper\ProgressBar;
|
|||
use RectorPrefix202308\Symfony\Component\Console\Input\InputInterface;
|
||||
use RectorPrefix202308\Symfony\Component\Console\Output\OutputInterface;
|
||||
use RectorPrefix202308\Symfony\Component\Console\Style\SymfonyStyle;
|
||||
final class RectorConsoleOutputStyle extends SymfonyStyle
|
||||
final class RectorStyle extends SymfonyStyle
|
||||
{
|
||||
/**
|
||||
* @var \Symfony\Component\Console\Helper\ProgressBar|null
|
|
@ -41,7 +41,7 @@ final class SymfonyStyleFactory
|
|||
if ($this->isPHPUnitRun()) {
|
||||
$consoleOutput->setVerbosity(OutputInterface::VERBOSITY_QUIET);
|
||||
}
|
||||
return new SymfonyStyle($argvInput, $consoleOutput);
|
||||
return new \Rector\Core\Console\Style\RectorStyle($argvInput, $consoleOutput);
|
||||
}
|
||||
/**
|
||||
* Never ever used static methods if not neccesary, this is just handy for tests + src to prevent duplication.
|
||||
|
|
|
@ -1,24 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\Core\Contract\Console;
|
||||
|
||||
interface OutputStyleInterface
|
||||
{
|
||||
public function error(string $message) : void;
|
||||
public function success(string $message) : void;
|
||||
public function warning(string $message) : void;
|
||||
public function note(string $message) : void;
|
||||
public function title(string $message) : void;
|
||||
public function writeln(string $message) : void;
|
||||
public function newLine(int $count = 1) : void;
|
||||
/**
|
||||
* @param string[] $elements
|
||||
*/
|
||||
public function listing(array $elements) : void;
|
||||
public function isVerbose() : bool;
|
||||
public function isDebug() : bool;
|
||||
public function setVerbosity(int $level) : void;
|
||||
public function progressStart(int $fileCount) : void;
|
||||
public function progressAdvance(int $step = 1) : void;
|
||||
}
|
|
@ -42,11 +42,8 @@ use Rector\Core\Application\FileProcessor\PhpFileProcessor;
|
|||
use Rector\Core\Configuration\ConfigInitializer;
|
||||
use Rector\Core\Configuration\CurrentNodeProvider;
|
||||
use Rector\Core\Console\Output\OutputFormatterCollector;
|
||||
use Rector\Core\Console\Output\RectorOutputStyle;
|
||||
use Rector\Core\Console\Style\RectorConsoleOutputStyle;
|
||||
use Rector\Core\Console\Style\RectorConsoleOutputStyleFactory;
|
||||
use Rector\Core\Console\Style\RectorStyle;
|
||||
use Rector\Core\Console\Style\SymfonyStyleFactory;
|
||||
use Rector\Core\Contract\Console\OutputStyleInterface;
|
||||
use Rector\Core\Contract\Processor\FileProcessorInterface;
|
||||
use Rector\Core\Contract\Rector\NonPhpRectorInterface;
|
||||
use Rector\Core\Contract\Rector\PhpRectorInterface;
|
||||
|
@ -258,7 +255,6 @@ final class LazyContainerFactory
|
|||
$inflectorFactory = new InflectorFactory();
|
||||
return $inflectorFactory->build();
|
||||
});
|
||||
$lazyRectorConfig->singleton(OutputStyleInterface::class, RectorOutputStyle::class);
|
||||
$lazyRectorConfig->singleton(PhpFileProcessor::class);
|
||||
$lazyRectorConfig->tag(PhpFileProcessor::class, FileProcessorInterface::class);
|
||||
$lazyRectorConfig->singleton(NonPhpFileProcessor::class);
|
||||
|
@ -268,10 +264,6 @@ final class LazyContainerFactory
|
|||
$lazyRectorConfig->when(FileFactory::class)->needs('$fileProcessors')->giveTagged(FileProcessorInterface::class);
|
||||
$lazyRectorConfig->when(RectorNodeTraverser::class)->needs('$phpRectors')->giveTagged(PhpRectorInterface::class);
|
||||
$lazyRectorConfig->when(ConfigInitializer::class)->needs('$rectors')->giveTagged(RectorInterface::class);
|
||||
$lazyRectorConfig->singleton(RectorConsoleOutputStyle::class, static function (Container $container) : RectorConsoleOutputStyle {
|
||||
$rectorConsoleOutputStyleFactory = $container->make(RectorConsoleOutputStyleFactory::class);
|
||||
return $rectorConsoleOutputStyleFactory->create();
|
||||
});
|
||||
$lazyRectorConfig->when(ClassNameImportSkipper::class)->needs('$classNameImportSkipVoters')->giveTagged(ClassNameImportSkipVoterInterface::class);
|
||||
$lazyRectorConfig->singleton(DynamicSourceLocatorProvider::class, static function (Container $container) : DynamicSourceLocatorProvider {
|
||||
$phpStanServicesFactory = $container->make(PHPStanServicesFactory::class);
|
||||
|
@ -292,7 +284,7 @@ final class LazyContainerFactory
|
|||
// node name resolvers
|
||||
$lazyRectorConfig->when(NodeNameResolver::class)->needs('$nodeNameResolvers')->giveTagged(NodeNameResolverInterface::class);
|
||||
$lazyRectorConfig->afterResolving(AbstractRector::class, static function (AbstractRector $rector, Container $container) : void {
|
||||
$rector->autowire($container->make(NodeNameResolver::class), $container->make(NodeTypeResolver::class), $container->make(SimpleCallableNodeTraverser::class), $container->make(NodeFactory::class), $container->make(PhpDocInfoFactory::class), $container->make(StaticTypeMapper::class), $container->make(CurrentRectorProvider::class), $container->make(CurrentNodeProvider::class), $container->make(Skipper::class), $container->make(ValueResolver::class), $container->make(BetterNodeFinder::class), $container->make(NodeComparator::class), $container->make(CurrentFileProvider::class), $container->make(RectifiedAnalyzer::class), $container->make(CreatedByRuleDecorator::class), $container->make(ChangedNodeScopeRefresher::class), $container->make(RectorOutputStyle::class), $container->make(FilePathHelper::class));
|
||||
$rector->autowire($container->make(NodeNameResolver::class), $container->make(NodeTypeResolver::class), $container->make(SimpleCallableNodeTraverser::class), $container->make(NodeFactory::class), $container->make(PhpDocInfoFactory::class), $container->make(StaticTypeMapper::class), $container->make(CurrentRectorProvider::class), $container->make(CurrentNodeProvider::class), $container->make(Skipper::class), $container->make(ValueResolver::class), $container->make(BetterNodeFinder::class), $container->make(NodeComparator::class), $container->make(CurrentFileProvider::class), $container->make(RectifiedAnalyzer::class), $container->make(CreatedByRuleDecorator::class), $container->make(ChangedNodeScopeRefresher::class), $container->make(RectorStyle::class), $container->make(FilePathHelper::class));
|
||||
});
|
||||
$this->registerTagged($lazyRectorConfig, self::PHP_PARSER_NODE_MAPPER_CLASSES, PhpParserNodeMapperInterface::class);
|
||||
$this->registerTagged($lazyRectorConfig, self::PHP_DOC_NODE_DECORATOR_CLASSES, PhpDocNodeDecoratorInterface::class);
|
||||
|
@ -302,6 +294,7 @@ final class LazyContainerFactory
|
|||
$this->registerTagged($lazyRectorConfig, self::NODE_TYPE_RESOLVER_CLASSES, NodeTypeResolverInterface::class);
|
||||
$this->registerTagged($lazyRectorConfig, self::OUTPUT_FORMATTER_CLASSES, OutputFormatterInterface::class);
|
||||
$this->registerTagged($lazyRectorConfig, self::CLASS_NAME_IMPORT_SKIPPER_CLASSES, ClassNameImportSkipVoterInterface::class);
|
||||
$lazyRectorConfig->alias(RectorStyle::class, SymfonyStyle::class);
|
||||
$lazyRectorConfig->singleton(SymfonyStyle::class, static function (Container $container) : SymfonyStyle {
|
||||
$symfonyStyleFactory = $container->make(SymfonyStyleFactory::class);
|
||||
return $symfonyStyleFactory->create();
|
||||
|
|
|
@ -18,7 +18,6 @@ use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory;
|
|||
use Rector\ChangesReporting\ValueObject\RectorWithLineChange;
|
||||
use Rector\Core\Application\ChangedNodeScopeRefresher;
|
||||
use Rector\Core\Configuration\CurrentNodeProvider;
|
||||
use Rector\Core\Console\Output\RectorOutputStyle;
|
||||
use Rector\Core\Contract\Rector\PhpRectorInterface;
|
||||
use Rector\Core\Exception\ShouldNotHappenException;
|
||||
use Rector\Core\FileSystem\FilePathHelper;
|
||||
|
@ -37,6 +36,7 @@ use Rector\NodeTypeResolver\NodeTypeResolver;
|
|||
use Rector\PhpDocParser\NodeTraverser\SimpleCallableNodeTraverser;
|
||||
use Rector\Skipper\Skipper\Skipper;
|
||||
use Rector\StaticTypeMapper\StaticTypeMapper;
|
||||
use RectorPrefix202308\Symfony\Component\Console\Style\SymfonyStyle;
|
||||
use RectorPrefix202308\Symfony\Contracts\Service\Attribute\Required;
|
||||
abstract class AbstractRector extends NodeVisitorAbstract implements PhpRectorInterface
|
||||
{
|
||||
|
@ -131,9 +131,9 @@ CODE_SAMPLE;
|
|||
*/
|
||||
private $createdByRuleDecorator;
|
||||
/**
|
||||
* @var \Rector\Core\Console\Output\RectorOutputStyle
|
||||
* @var \Symfony\Component\Console\Style\SymfonyStyle
|
||||
*/
|
||||
private $rectorOutputStyle;
|
||||
private $symfonyStyle;
|
||||
/**
|
||||
* @var \Rector\Core\FileSystem\FilePathHelper
|
||||
*/
|
||||
|
@ -145,7 +145,7 @@ CODE_SAMPLE;
|
|||
/**
|
||||
* @required
|
||||
*/
|
||||
public function autowire(NodeNameResolver $nodeNameResolver, NodeTypeResolver $nodeTypeResolver, SimpleCallableNodeTraverser $simpleCallableNodeTraverser, NodeFactory $nodeFactory, PhpDocInfoFactory $phpDocInfoFactory, StaticTypeMapper $staticTypeMapper, CurrentRectorProvider $currentRectorProvider, CurrentNodeProvider $currentNodeProvider, Skipper $skipper, ValueResolver $valueResolver, BetterNodeFinder $betterNodeFinder, NodeComparator $nodeComparator, CurrentFileProvider $currentFileProvider, RectifiedAnalyzer $rectifiedAnalyzer, CreatedByRuleDecorator $createdByRuleDecorator, ChangedNodeScopeRefresher $changedNodeScopeRefresher, RectorOutputStyle $rectorOutputStyle, FilePathHelper $filePathHelper) : void
|
||||
public function autowire(NodeNameResolver $nodeNameResolver, NodeTypeResolver $nodeTypeResolver, SimpleCallableNodeTraverser $simpleCallableNodeTraverser, NodeFactory $nodeFactory, PhpDocInfoFactory $phpDocInfoFactory, StaticTypeMapper $staticTypeMapper, CurrentRectorProvider $currentRectorProvider, CurrentNodeProvider $currentNodeProvider, Skipper $skipper, ValueResolver $valueResolver, BetterNodeFinder $betterNodeFinder, NodeComparator $nodeComparator, CurrentFileProvider $currentFileProvider, RectifiedAnalyzer $rectifiedAnalyzer, CreatedByRuleDecorator $createdByRuleDecorator, ChangedNodeScopeRefresher $changedNodeScopeRefresher, SymfonyStyle $symfonyStyle, FilePathHelper $filePathHelper) : void
|
||||
{
|
||||
$this->nodeNameResolver = $nodeNameResolver;
|
||||
$this->nodeTypeResolver = $nodeTypeResolver;
|
||||
|
@ -163,7 +163,7 @@ CODE_SAMPLE;
|
|||
$this->rectifiedAnalyzer = $rectifiedAnalyzer;
|
||||
$this->createdByRuleDecorator = $createdByRuleDecorator;
|
||||
$this->changedNodeScopeRefresher = $changedNodeScopeRefresher;
|
||||
$this->rectorOutputStyle = $rectorOutputStyle;
|
||||
$this->symfonyStyle = $symfonyStyle;
|
||||
$this->filePathHelper = $filePathHelper;
|
||||
}
|
||||
/**
|
||||
|
@ -187,7 +187,7 @@ CODE_SAMPLE;
|
|||
if ($this->shouldSkipCurrentNode($node)) {
|
||||
return null;
|
||||
}
|
||||
$isDebug = $this->rectorOutputStyle->isDebug();
|
||||
$isDebug = $this->symfonyStyle->isDebug();
|
||||
$this->currentRectorProvider->changeCurrentRector($this);
|
||||
// for PHP doc info factory and change notifier
|
||||
$this->currentNodeProvider->setNode($node);
|
||||
|
@ -363,15 +363,15 @@ CODE_SAMPLE;
|
|||
private function printCurrentFileAndRule() : void
|
||||
{
|
||||
$relativeFilePath = $this->filePathHelper->relativePath($this->file->getFilePath());
|
||||
$this->rectorOutputStyle->writeln('[file] ' . $relativeFilePath);
|
||||
$this->rectorOutputStyle->writeln('[rule] ' . static::class);
|
||||
$this->symfonyStyle->writeln('[file] ' . $relativeFilePath);
|
||||
$this->symfonyStyle->writeln('[rule] ' . static::class);
|
||||
}
|
||||
private function printConsumptions(float $startTime, int $previousMemory) : void
|
||||
{
|
||||
$elapsedTime = \microtime(\true) - $startTime;
|
||||
$currentTotalMemory = \memory_get_peak_usage(\true);
|
||||
$consumed = \sprintf('--- consumed %s, total %s, took %.2f s', BytesHelper::bytes($currentTotalMemory - $previousMemory), BytesHelper::bytes($currentTotalMemory), $elapsedTime);
|
||||
$this->rectorOutputStyle->writeln($consumed);
|
||||
$this->rectorOutputStyle->newLine(1);
|
||||
$this->symfonyStyle->writeln($consumed);
|
||||
$this->symfonyStyle->newLine(1);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,4 +22,4 @@ if (PHP_VERSION_ID < 50600) {
|
|||
|
||||
require_once __DIR__ . '/composer/autoload_real.php';
|
||||
|
||||
return ComposerAutoloaderInit1ab3abf084614a2564c15cafc53d154f::getLoader();
|
||||
return ComposerAutoloaderInit2de9e0e7fdbb90e14135faecd56343a6::getLoader();
|
||||
|
|
|
@ -1520,11 +1520,8 @@ return array(
|
|||
'Rector\\Core\\Console\\Formatter\\CompleteUnifiedDiffOutputBuilderFactory' => $baseDir . '/src/Console/Formatter/CompleteUnifiedDiffOutputBuilderFactory.php',
|
||||
'Rector\\Core\\Console\\Formatter\\ConsoleDiffer' => $baseDir . '/src/Console/Formatter/ConsoleDiffer.php',
|
||||
'Rector\\Core\\Console\\Output\\OutputFormatterCollector' => $baseDir . '/src/Console/Output/OutputFormatterCollector.php',
|
||||
'Rector\\Core\\Console\\Output\\RectorOutputStyle' => $baseDir . '/src/Console/Output/RectorOutputStyle.php',
|
||||
'Rector\\Core\\Console\\Style\\RectorConsoleOutputStyle' => $baseDir . '/src/Console/Style/RectorConsoleOutputStyle.php',
|
||||
'Rector\\Core\\Console\\Style\\RectorConsoleOutputStyleFactory' => $baseDir . '/src/Console/Style/RectorConsoleOutputStyleFactory.php',
|
||||
'Rector\\Core\\Console\\Style\\RectorStyle' => $baseDir . '/src/Console/Style/RectorStyle.php',
|
||||
'Rector\\Core\\Console\\Style\\SymfonyStyleFactory' => $baseDir . '/src/Console/Style/SymfonyStyleFactory.php',
|
||||
'Rector\\Core\\Contract\\Console\\OutputStyleInterface' => $baseDir . '/src/Contract/Console/OutputStyleInterface.php',
|
||||
'Rector\\Core\\Contract\\PHPStan\\Reflection\\TypeToCallReflectionResolver\\TypeToCallReflectionResolverInterface' => $baseDir . '/src/Contract/PHPStan/Reflection/TypeToCallReflectionResolver/TypeToCallReflectionResolverInterface.php',
|
||||
'Rector\\Core\\Contract\\PhpParser\\Node\\StmtsAwareInterface' => $baseDir . '/src/Contract/PhpParser/Node/StmtsAwareInterface.php',
|
||||
'Rector\\Core\\Contract\\Processor\\FileProcessorInterface' => $baseDir . '/src/Contract/Processor/FileProcessorInterface.php',
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
// autoload_real.php @generated by Composer
|
||||
|
||||
class ComposerAutoloaderInit1ab3abf084614a2564c15cafc53d154f
|
||||
class ComposerAutoloaderInit2de9e0e7fdbb90e14135faecd56343a6
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
|
@ -22,17 +22,17 @@ class ComposerAutoloaderInit1ab3abf084614a2564c15cafc53d154f
|
|||
return self::$loader;
|
||||
}
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInit1ab3abf084614a2564c15cafc53d154f', 'loadClassLoader'), true, true);
|
||||
spl_autoload_register(array('ComposerAutoloaderInit2de9e0e7fdbb90e14135faecd56343a6', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit1ab3abf084614a2564c15cafc53d154f', 'loadClassLoader'));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit2de9e0e7fdbb90e14135faecd56343a6', 'loadClassLoader'));
|
||||
|
||||
require __DIR__ . '/autoload_static.php';
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit1ab3abf084614a2564c15cafc53d154f::getInitializer($loader));
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit2de9e0e7fdbb90e14135faecd56343a6::getInitializer($loader));
|
||||
|
||||
$loader->setClassMapAuthoritative(true);
|
||||
$loader->register(true);
|
||||
|
||||
$filesToLoad = \Composer\Autoload\ComposerStaticInit1ab3abf084614a2564c15cafc53d154f::$files;
|
||||
$filesToLoad = \Composer\Autoload\ComposerStaticInit2de9e0e7fdbb90e14135faecd56343a6::$files;
|
||||
$requireFile = \Closure::bind(static function ($fileIdentifier, $file) {
|
||||
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
||||
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
namespace Composer\Autoload;
|
||||
|
||||
class ComposerStaticInit1ab3abf084614a2564c15cafc53d154f
|
||||
class ComposerStaticInit2de9e0e7fdbb90e14135faecd56343a6
|
||||
{
|
||||
public static $files = array (
|
||||
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
|
||||
|
@ -1774,11 +1774,8 @@ class ComposerStaticInit1ab3abf084614a2564c15cafc53d154f
|
|||
'Rector\\Core\\Console\\Formatter\\CompleteUnifiedDiffOutputBuilderFactory' => __DIR__ . '/../..' . '/src/Console/Formatter/CompleteUnifiedDiffOutputBuilderFactory.php',
|
||||
'Rector\\Core\\Console\\Formatter\\ConsoleDiffer' => __DIR__ . '/../..' . '/src/Console/Formatter/ConsoleDiffer.php',
|
||||
'Rector\\Core\\Console\\Output\\OutputFormatterCollector' => __DIR__ . '/../..' . '/src/Console/Output/OutputFormatterCollector.php',
|
||||
'Rector\\Core\\Console\\Output\\RectorOutputStyle' => __DIR__ . '/../..' . '/src/Console/Output/RectorOutputStyle.php',
|
||||
'Rector\\Core\\Console\\Style\\RectorConsoleOutputStyle' => __DIR__ . '/../..' . '/src/Console/Style/RectorConsoleOutputStyle.php',
|
||||
'Rector\\Core\\Console\\Style\\RectorConsoleOutputStyleFactory' => __DIR__ . '/../..' . '/src/Console/Style/RectorConsoleOutputStyleFactory.php',
|
||||
'Rector\\Core\\Console\\Style\\RectorStyle' => __DIR__ . '/../..' . '/src/Console/Style/RectorStyle.php',
|
||||
'Rector\\Core\\Console\\Style\\SymfonyStyleFactory' => __DIR__ . '/../..' . '/src/Console/Style/SymfonyStyleFactory.php',
|
||||
'Rector\\Core\\Contract\\Console\\OutputStyleInterface' => __DIR__ . '/../..' . '/src/Contract/Console/OutputStyleInterface.php',
|
||||
'Rector\\Core\\Contract\\PHPStan\\Reflection\\TypeToCallReflectionResolver\\TypeToCallReflectionResolverInterface' => __DIR__ . '/../..' . '/src/Contract/PHPStan/Reflection/TypeToCallReflectionResolver/TypeToCallReflectionResolverInterface.php',
|
||||
'Rector\\Core\\Contract\\PhpParser\\Node\\StmtsAwareInterface' => __DIR__ . '/../..' . '/src/Contract/PhpParser/Node/StmtsAwareInterface.php',
|
||||
'Rector\\Core\\Contract\\Processor\\FileProcessorInterface' => __DIR__ . '/../..' . '/src/Contract/Processor/FileProcessorInterface.php',
|
||||
|
@ -3012,9 +3009,9 @@ class ComposerStaticInit1ab3abf084614a2564c15cafc53d154f
|
|||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit1ab3abf084614a2564c15cafc53d154f::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit1ab3abf084614a2564c15cafc53d154f::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit1ab3abf084614a2564c15cafc53d154f::$classMap;
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit2de9e0e7fdbb90e14135faecd56343a6::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit2de9e0e7fdbb90e14135faecd56343a6::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit2de9e0e7fdbb90e14135faecd56343a6::$classMap;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue