-
-
Notifications
You must be signed in to change notification settings - Fork 0
RefactorCommand
github-actions edited this page Apr 19, 2026
·
1 revision
Provides functionality to execute automated code refactoring using Rector.
This class MUST NOT be extended and SHALL encapsulate the logic for Rector invocation.
- Full name:
\FastForward\DevTools\Console\Command\RefactorCommand - Parent class:
BaseCommand - This class is marked as final and can't be subclassed
- This class is a Final class
| Constant | Visibility | Type | Value |
|---|---|---|---|
CONFIG |
public | string | 'rector.php' |
Creates a new RefactorCommand instance.
public __construct(\Symfony\Component\Config\FileLocatorInterface $fileLocator, \FastForward\DevTools\Process\ProcessBuilderInterface $processBuilder, \FastForward\DevTools\Process\ProcessQueueInterface $processQueue): mixedParameters:
| Parameter | Type | Description |
|---|---|---|
$fileLocator |
\Symfony\Component\Config\FileLocatorInterface | the file locator |
$processBuilder |
\FastForward\DevTools\Process\ProcessBuilderInterface | the process builder |
$processQueue |
\FastForward\DevTools\Process\ProcessQueueInterface | the process queue |
Configures the refactor command options and description.
protected configure(): voidThis method MUST define the expected --fix option. It SHALL configure the command name
and descriptions accurately.
Executes the refactoring process securely.
protected execute(\Symfony\Component\Console\Input\InputInterface $input, \Symfony\Component\Console\Output\OutputInterface $output): intThe method MUST execute Rector securely via Process. It SHALL use dry-run mode
unless the --fix option is specified. It MUST return self::SUCCESS or self::FAILURE.
Parameters:
| Parameter | Type | Description |
|---|---|---|
$input |
\Symfony\Component\Console\Input\InputInterface | the input interface to retrieve arguments properly |
$output |
\Symfony\Component\Console\Output\OutputInterface | the output interface to log outputs |
Return Value:
the status code denoting success or failure