Updated Rector to commit 42c924a44bcf0e2a2cecdbcc77e829b844a87cf0

42c924a44b [dx] Prepend command name automatically if only paths are passed (#6759)
This commit is contained in:
Tomas Votruba 2025-04-03 08:18:22 +00:00
parent 9cb5f45562
commit d4f4649080
9 changed files with 33 additions and 19 deletions

View File

@ -60,13 +60,13 @@ return RectorConfig::configure()
Then dry run Rector:
```bash
vendor/bin/rector process src --dry-run
vendor/bin/rector src --dry-run
```
Rector will show you diff of files that it *would* change. To *make* the changes, drop `--dry-run`:
```bash
vendor/bin/rector process src
vendor/bin/rector src
```
## Documentation
@ -124,7 +124,7 @@ See [the contribution guide](/CONTRIBUTING.md) or go to development repository [
You can use `--debug` option, that will print nested exceptions output:
```bash
vendor/bin/rector process src/Controller --dry-run --debug
vendor/bin/rector src/Controller --dry-run --debug
```
Or with Xdebug:
@ -133,7 +133,7 @@ Or with Xdebug:
2. Add `--xdebug` option when running Rector
```bash
vendor/bin/rector process src/Controller --dry-run --xdebug
vendor/bin/rector src/Controller --dry-run --xdebug
```
To assist with simple debugging Rector provides 2 helpers to pretty-print AST-nodes:

View File

@ -19,12 +19,12 @@ final class VersionResolver
* @api
* @var string
*/
public const PACKAGE_VERSION = 'a2d3a9ac429cb0c63bb2786fca79eb6a5b570e0b';
public const PACKAGE_VERSION = '42c924a44bcf0e2a2cecdbcc77e829b844a87cf0';
/**
* @api
* @var string
*/
public const RELEASE_DATE = '2025-04-03 09:50:06';
public const RELEASE_DATE = '2025-04-03 08:15:43';
/**
* @var int
*/

View File

@ -140,12 +140,12 @@ EOF
foreach ($configuration->getLevelOverflows() as $levelOverflow) {
$this->reportLevelOverflow($levelOverflow);
}
// 0. warn about rules registered in both withRules() and sets to avoid bloated rector.php configs
// 1. warn about rules registered in both withRules() and sets to avoid bloated rector.php configs
$setAndRulesDuplicatedRegistrations = $configuration->getBothSetAndRulesDuplicatedRegistrations();
if ($setAndRulesDuplicatedRegistrations !== []) {
$this->symfonyStyle->warning(\sprintf('These rules are registered in both sets and "withRules()". Remove them from "withRules()" to avoid duplications: %s* %s', \PHP_EOL . \PHP_EOL, \implode(' * ', $setAndRulesDuplicatedRegistrations) . \PHP_EOL));
}
// 1. add files and directories to static locator
// 2. add files and directories to static locator
$this->dynamicSourceLocatorDecorator->addPaths($paths);
if ($this->dynamicSourceLocatorDecorator->isPathsEmpty()) {
// read from rector.php, no paths definition needs withPaths() config

View File

@ -7,6 +7,7 @@ use RectorPrefix202504\Composer\XdebugHandler\XdebugHandler;
use Rector\Application\VersionResolver;
use Rector\ChangesReporting\Output\ConsoleOutputFormatter;
use Rector\Configuration\Option;
use Rector\Util\Reflection\PrivatesAccessor;
use RectorPrefix202504\Symfony\Component\Console\Application;
use RectorPrefix202504\Symfony\Component\Console\Command\Command;
use RectorPrefix202504\Symfony\Component\Console\Input\InputDefinition;
@ -50,6 +51,15 @@ final class ConsoleApplication extends Application
if ($shouldFollowByNewline) {
$output->write(\PHP_EOL);
}
$commandName = $input->getFirstArgument();
// if paths exist
if (\is_string($commandName) && \file_exists($commandName)) {
// prepend command name if implicit
$privatesAccessor = new PrivatesAccessor();
$tokens = $privatesAccessor->getPrivateProperty($input, 'tokens');
$tokens = \array_merge(['process'], $tokens);
$privatesAccessor->setPrivateProperty($input, 'tokens', $tokens);
}
return parent::doRun($input, $output);
}
protected function getDefaultInputDefinition() : InputDefinition

View File

@ -39,6 +39,10 @@ final class WorkerCommandLineFactory
public function create(string $mainScript, string $mainCommandClass, string $workerCommandName, InputInterface $input, string $identifier, int $port) : string
{
$commandArguments = \array_slice($_SERVER['argv'], 1);
// add implicit "process" command name if missing
if ($commandArguments !== [] && ($commandArguments[0] !== 'process' && $commandArguments[0] !== 'p') && !\defined('PHPUNIT_COMPOSER_INSTALL')) {
$commandArguments = \array_merge(['process'], $commandArguments);
}
$args = \array_merge([\PHP_BINARY, $mainScript], $commandArguments);
$workerCommandArray = [];
$mainCommand = $this->commandFromReflectionFactory->create($mainCommandClass);

2
vendor/autoload.php vendored
View File

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

View File

@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer
class ComposerAutoloaderInit463a5eb4f43b9fdf649399cc7beca233
class ComposerAutoloaderInit621dd53b8fef55a02f867f764f9bd076
{
private static $loader;
@ -22,17 +22,17 @@ class ComposerAutoloaderInit463a5eb4f43b9fdf649399cc7beca233
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInit463a5eb4f43b9fdf649399cc7beca233', 'loadClassLoader'), true, true);
spl_autoload_register(array('ComposerAutoloaderInit621dd53b8fef55a02f867f764f9bd076', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
spl_autoload_unregister(array('ComposerAutoloaderInit463a5eb4f43b9fdf649399cc7beca233', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInit621dd53b8fef55a02f867f764f9bd076', 'loadClassLoader'));
require __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInit463a5eb4f43b9fdf649399cc7beca233::getInitializer($loader));
call_user_func(\Composer\Autoload\ComposerStaticInit621dd53b8fef55a02f867f764f9bd076::getInitializer($loader));
$loader->setClassMapAuthoritative(true);
$loader->register(true);
$filesToLoad = \Composer\Autoload\ComposerStaticInit463a5eb4f43b9fdf649399cc7beca233::$files;
$filesToLoad = \Composer\Autoload\ComposerStaticInit621dd53b8fef55a02f867f764f9bd076::$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 ComposerStaticInit463a5eb4f43b9fdf649399cc7beca233
class ComposerStaticInit621dd53b8fef55a02f867f764f9bd076
{
public static $files = array (
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
@ -2887,9 +2887,9 @@ class ComposerStaticInit463a5eb4f43b9fdf649399cc7beca233
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInit463a5eb4f43b9fdf649399cc7beca233::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit463a5eb4f43b9fdf649399cc7beca233::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit463a5eb4f43b9fdf649399cc7beca233::$classMap;
$loader->prefixLengthsPsr4 = ComposerStaticInit621dd53b8fef55a02f867f764f9bd076::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit621dd53b8fef55a02f867f764f9bd076::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit621dd53b8fef55a02f867f764f9bd076::$classMap;
}, null, ClassLoader::class);
}

View File

@ -30,7 +30,7 @@ if (!function_exists('humbug_phpscoper_expose_class')) {
}
}
humbug_phpscoper_expose_class('AutoloadIncluder', 'RectorPrefix202504\AutoloadIncluder');
humbug_phpscoper_expose_class('ComposerAutoloaderInit463a5eb4f43b9fdf649399cc7beca233', 'RectorPrefix202504\ComposerAutoloaderInit463a5eb4f43b9fdf649399cc7beca233');
humbug_phpscoper_expose_class('ComposerAutoloaderInit621dd53b8fef55a02f867f764f9bd076', 'RectorPrefix202504\ComposerAutoloaderInit621dd53b8fef55a02f867f764f9bd076');
humbug_phpscoper_expose_class('Product', 'RectorPrefix202504\Product');
humbug_phpscoper_expose_class('SomeTest', 'RectorPrefix202504\SomeTest');