-
-
Notifications
You must be signed in to change notification settings - Fork 0
RefactorCommand
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 implements:
\FastForward\DevTools\Console\Command\LoggerAwareCommandInterface - 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, \Psr\Log\LoggerInterface $logger): 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 |
$logger |
\Psr\Log\LoggerInterface | the output-aware logger |
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
Adds the standard JSON output options to the current command.
protected addJsonOption(): staticDetermines whether JSON output was requested.
protected isJsonOutput(\Symfony\Component\Console\Input\InputInterface $input): boolThe pretty-json flag SHALL imply JSON output.
Parameters:
| Parameter | Type | Description |
|---|---|---|
$input |
\Symfony\Component\Console\Input\InputInterface |
Determines whether pretty JSON output was requested.
protected isPrettyJsonOutput(\Symfony\Component\Console\Input\InputInterface $input): boolParameters:
| Parameter | Type | Description |
|---|---|---|
$input |
\Symfony\Component\Console\Input\InputInterface |