Updated Rector to commit 6b84177a797f708f5abe2f69befe43d696e32ba5

6b84177a79 [DX] Add ProcessConfigureDecorator to avoid superfluous composition (#4734)
This commit is contained in:
Tomas Votruba 2023-08-09 13:17:04 +00:00
parent 8c38570f22
commit 7c1470fadd
9 changed files with 49 additions and 43 deletions

View File

@ -19,12 +19,12 @@ final class VersionResolver
* @api
* @var string
*/
public const PACKAGE_VERSION = '6942dabb36d6687b1f9a77eff1a357dd2acfbf47';
public const PACKAGE_VERSION = '6b84177a797f708f5abe2f69befe43d696e32ba5';
/**
* @api
* @var string
*/
public const RELEASE_DATE = '2023-08-09 20:03:32';
public const RELEASE_DATE = '2023-08-09 13:12:46';
/**
* @var int
*/

View File

@ -1,27 +0,0 @@
<?php
declare (strict_types=1);
namespace Rector\Core\Console\Command;
use Rector\ChangesReporting\Output\ConsoleOutputFormatter;
use Rector\Core\Configuration\Option;
use RectorPrefix202308\Symfony\Component\Console\Command\Command;
use RectorPrefix202308\Symfony\Component\Console\Input\InputArgument;
use RectorPrefix202308\Symfony\Component\Console\Input\InputOption;
abstract class AbstractProcessCommand extends Command
{
protected function configure() : void
{
$this->addArgument(Option::SOURCE, InputArgument::OPTIONAL | InputArgument::IS_ARRAY, 'Files or directories to be upgraded.');
$this->addOption(Option::DRY_RUN, Option::DRY_RUN_SHORT, InputOption::VALUE_NONE, 'Only see the diff of changes, do not save them to files.');
$this->addOption(Option::AUTOLOAD_FILE, Option::AUTOLOAD_FILE_SHORT, InputOption::VALUE_REQUIRED, 'Path to file with extra autoload (will be included)');
$this->addOption(Option::NO_PROGRESS_BAR, null, InputOption::VALUE_NONE, 'Hide progress bar. Useful e.g. for nicer CI output.');
$this->addOption(Option::NO_DIFFS, null, InputOption::VALUE_NONE, 'Hide diffs of changed files. Useful e.g. for nicer CI output.');
$this->addOption(Option::OUTPUT_FORMAT, null, InputOption::VALUE_REQUIRED, 'Select output format', ConsoleOutputFormatter::NAME);
$this->addOption(Option::DEBUG, null, InputOption::VALUE_NONE, 'Display debug output.');
$this->addOption(Option::MEMORY_LIMIT, null, InputOption::VALUE_REQUIRED, 'Memory limit for process');
$this->addOption(Option::CLEAR_CACHE, null, InputOption::VALUE_NONE, 'Clear unchanged files cache');
$this->addOption(Option::PARALLEL_PORT, null, InputOption::VALUE_REQUIRED);
$this->addOption(Option::PARALLEL_IDENTIFIER, null, InputOption::VALUE_REQUIRED);
}
}

View File

@ -12,6 +12,7 @@ use Rector\Core\Configuration\ConfigurationFactory;
use Rector\Core\Configuration\Option;
use Rector\Core\Console\ExitCode;
use Rector\Core\Console\Output\OutputFormatterCollector;
use Rector\Core\Console\ProcessConfigureDecorator;
use Rector\Core\Exception\ShouldNotHappenException;
use Rector\Core\StaticReflection\DynamicSourceLocatorDecorator;
use Rector\Core\Util\MemoryLimiter;
@ -19,10 +20,11 @@ use Rector\Core\ValueObject\Configuration;
use Rector\Core\ValueObject\ProcessResult;
use Rector\Core\ValueObjectFactory\ProcessResultFactory;
use RectorPrefix202308\Symfony\Component\Console\Application;
use RectorPrefix202308\Symfony\Component\Console\Command\Command;
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
final class ProcessCommand extends Command
{
/**
* @readonly
@ -92,6 +94,7 @@ final class ProcessCommand extends \Rector\Core\Console\Command\AbstractProcessC
{
$this->setName('process');
$this->setDescription('Upgrades or refactors source code with provided rectors');
ProcessConfigureDecorator::decorate($this);
parent::configure();
}
protected function execute(InputInterface $input, OutputInterface $output) : int

View File

@ -9,8 +9,10 @@ use RectorPrefix202308\React\EventLoop\StreamSelectLoop;
use RectorPrefix202308\React\Socket\ConnectionInterface;
use RectorPrefix202308\React\Socket\TcpConnector;
use Rector\Core\Configuration\ConfigurationFactory;
use Rector\Core\Console\ProcessConfigureDecorator;
use Rector\Core\Util\MemoryLimiter;
use Rector\Parallel\WorkerRunner;
use RectorPrefix202308\Symfony\Component\Console\Command\Command;
use RectorPrefix202308\Symfony\Component\Console\Input\InputInterface;
use RectorPrefix202308\Symfony\Component\Console\Output\OutputInterface;
use RectorPrefix202308\Symplify\EasyParallel\Enum\Action;
@ -22,7 +24,7 @@ use RectorPrefix202308\Symplify\EasyParallel\Enum\ReactCommand;
* ↓↓↓
* https://github.com/phpstan/phpstan-src/commit/b84acd2e3eadf66189a64fdbc6dd18ff76323f67#diff-7f625777f1ce5384046df08abffd6c911cfbb1cfc8fcb2bdeaf78f337689e3e2
*/
final class WorkerCommand extends \Rector\Core\Console\Command\AbstractProcessCommand
final class WorkerCommand extends Command
{
/**
* @readonly
@ -50,6 +52,7 @@ final class WorkerCommand extends \Rector\Core\Console\Command\AbstractProcessCo
{
$this->setName('worker');
$this->setDescription('[INTERNAL] Support for parallel process');
ProcessConfigureDecorator::decorate($this);
parent::configure();
}
protected function execute(InputInterface $input, OutputInterface $output) : int

View File

@ -0,0 +1,27 @@
<?php
declare (strict_types=1);
namespace Rector\Core\Console;
use Rector\ChangesReporting\Output\ConsoleOutputFormatter;
use Rector\Core\Configuration\Option;
use RectorPrefix202308\Symfony\Component\Console\Command\Command;
use RectorPrefix202308\Symfony\Component\Console\Input\InputArgument;
use RectorPrefix202308\Symfony\Component\Console\Input\InputOption;
final class ProcessConfigureDecorator
{
public static function decorate(Command $command) : void
{
$command->addArgument(Option::SOURCE, InputArgument::OPTIONAL | InputArgument::IS_ARRAY, 'Files or directories to be upgraded.');
$command->addOption(Option::DRY_RUN, Option::DRY_RUN_SHORT, InputOption::VALUE_NONE, 'Only see the diff of changes, do not save them to files.');
$command->addOption(Option::AUTOLOAD_FILE, Option::AUTOLOAD_FILE_SHORT, InputOption::VALUE_REQUIRED, 'Path to file with extra autoload (will be included)');
$command->addOption(Option::NO_PROGRESS_BAR, null, InputOption::VALUE_NONE, 'Hide progress bar. Useful e.g. for nicer CI output.');
$command->addOption(Option::NO_DIFFS, null, InputOption::VALUE_NONE, 'Hide diffs of changed files. Useful e.g. for nicer CI output.');
$command->addOption(Option::OUTPUT_FORMAT, null, InputOption::VALUE_REQUIRED, 'Select output format', ConsoleOutputFormatter::NAME);
$command->addOption(Option::DEBUG, null, InputOption::VALUE_NONE, 'Display debug output.');
$command->addOption(Option::MEMORY_LIMIT, null, InputOption::VALUE_REQUIRED, 'Memory limit for process');
$command->addOption(Option::CLEAR_CACHE, null, InputOption::VALUE_NONE, 'Clear unchanged files cache');
$command->addOption(Option::PARALLEL_PORT, null, InputOption::VALUE_REQUIRED);
$command->addOption(Option::PARALLEL_IDENTIFIER, null, InputOption::VALUE_REQUIRED);
}
}

2
vendor/autoload.php vendored
View File

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

View File

@ -1509,7 +1509,6 @@ return array(
'Rector\\Core\\Configuration\\Parameter\\SimpleParameterProvider' => $baseDir . '/src/Configuration/Parameter/SimpleParameterProvider.php',
'Rector\\Core\\Configuration\\RenamedClassesDataCollector' => $baseDir . '/src/Configuration/RenamedClassesDataCollector.php',
'Rector\\Core\\Configuration\\ValueObjectInliner' => $baseDir . '/src/Configuration/ValueObjectInliner.php',
'Rector\\Core\\Console\\Command\\AbstractProcessCommand' => $baseDir . '/src/Console/Command/AbstractProcessCommand.php',
'Rector\\Core\\Console\\Command\\ListRulesCommand' => $baseDir . '/src/Console/Command/ListRulesCommand.php',
'Rector\\Core\\Console\\Command\\ProcessCommand' => $baseDir . '/src/Console/Command/ProcessCommand.php',
'Rector\\Core\\Console\\Command\\SetupCICommand' => $baseDir . '/src/Console/Command/SetupCICommand.php',
@ -1520,6 +1519,7 @@ 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\\ProcessConfigureDecorator' => $baseDir . '/src/Console/ProcessConfigureDecorator.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\\PHPStan\\Reflection\\TypeToCallReflectionResolver\\TypeToCallReflectionResolverInterface' => $baseDir . '/src/Contract/PHPStan/Reflection/TypeToCallReflectionResolver/TypeToCallReflectionResolverInterface.php',

View File

@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer
class ComposerAutoloaderInitcf1ba97037155c04146a38dc1db90530
class ComposerAutoloaderInit6db86b119341b9e9eb732a23233720f0
{
private static $loader;
@ -22,17 +22,17 @@ class ComposerAutoloaderInitcf1ba97037155c04146a38dc1db90530
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInitcf1ba97037155c04146a38dc1db90530', 'loadClassLoader'), true, true);
spl_autoload_register(array('ComposerAutoloaderInit6db86b119341b9e9eb732a23233720f0', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
spl_autoload_unregister(array('ComposerAutoloaderInitcf1ba97037155c04146a38dc1db90530', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInit6db86b119341b9e9eb732a23233720f0', 'loadClassLoader'));
require __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInitcf1ba97037155c04146a38dc1db90530::getInitializer($loader));
call_user_func(\Composer\Autoload\ComposerStaticInit6db86b119341b9e9eb732a23233720f0::getInitializer($loader));
$loader->setClassMapAuthoritative(true);
$loader->register(true);
$filesToLoad = \Composer\Autoload\ComposerStaticInitcf1ba97037155c04146a38dc1db90530::$files;
$filesToLoad = \Composer\Autoload\ComposerStaticInit6db86b119341b9e9eb732a23233720f0::$files;
$requireFile = \Closure::bind(static function ($fileIdentifier, $file) {
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;

View File

@ -4,7 +4,7 @@
namespace Composer\Autoload;
class ComposerStaticInitcf1ba97037155c04146a38dc1db90530
class ComposerStaticInit6db86b119341b9e9eb732a23233720f0
{
public static $files = array (
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
@ -1763,7 +1763,6 @@ class ComposerStaticInitcf1ba97037155c04146a38dc1db90530
'Rector\\Core\\Configuration\\Parameter\\SimpleParameterProvider' => __DIR__ . '/../..' . '/src/Configuration/Parameter/SimpleParameterProvider.php',
'Rector\\Core\\Configuration\\RenamedClassesDataCollector' => __DIR__ . '/../..' . '/src/Configuration/RenamedClassesDataCollector.php',
'Rector\\Core\\Configuration\\ValueObjectInliner' => __DIR__ . '/../..' . '/src/Configuration/ValueObjectInliner.php',
'Rector\\Core\\Console\\Command\\AbstractProcessCommand' => __DIR__ . '/../..' . '/src/Console/Command/AbstractProcessCommand.php',
'Rector\\Core\\Console\\Command\\ListRulesCommand' => __DIR__ . '/../..' . '/src/Console/Command/ListRulesCommand.php',
'Rector\\Core\\Console\\Command\\ProcessCommand' => __DIR__ . '/../..' . '/src/Console/Command/ProcessCommand.php',
'Rector\\Core\\Console\\Command\\SetupCICommand' => __DIR__ . '/../..' . '/src/Console/Command/SetupCICommand.php',
@ -1774,6 +1773,7 @@ class ComposerStaticInitcf1ba97037155c04146a38dc1db90530
'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\\ProcessConfigureDecorator' => __DIR__ . '/../..' . '/src/Console/ProcessConfigureDecorator.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\\PHPStan\\Reflection\\TypeToCallReflectionResolver\\TypeToCallReflectionResolverInterface' => __DIR__ . '/../..' . '/src/Contract/PHPStan/Reflection/TypeToCallReflectionResolver/TypeToCallReflectionResolverInterface.php',
@ -3002,9 +3002,9 @@ class ComposerStaticInitcf1ba97037155c04146a38dc1db90530
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInitcf1ba97037155c04146a38dc1db90530::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInitcf1ba97037155c04146a38dc1db90530::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInitcf1ba97037155c04146a38dc1db90530::$classMap;
$loader->prefixLengthsPsr4 = ComposerStaticInit6db86b119341b9e9eb732a23233720f0::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit6db86b119341b9e9eb732a23233720f0::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit6db86b119341b9e9eb732a23233720f0::$classMap;
}, null, ClassLoader::class);
}