Skip to content

CodeStyleCommand

github-actions edited this page Apr 22, 2026 · 1 revision

Represents the command responsible for checking and fixing code style issues.

This class MUST NOT be overridden and SHALL rely on external tools like ECS and Composer Normalize.


Constants

Constant Visibility Type Value
CONFIG public string 'ecs.php'

Methods

__construct

Constructs a new command instance responsible for orchestrating code style checks.

public __construct(\Symfony\Component\Config\FileLocatorInterface $fileLocator, \FastForward\DevTools\Process\ProcessBuilderInterface $processBuilder, \FastForward\DevTools\Process\ProcessQueueInterface $processQueue, \Psr\Log\LoggerInterface $logger): mixed

The provided collaborators SHALL be used to locate the ECS configuration, build process definitions, and execute the resulting process queue. These dependencies MUST be valid service instances capable of supporting the command lifecycle expected by this class.

Parameters:

Parameter Type Description
$fileLocator \Symfony\Component\Config\FileLocatorInterface locates the configuration file required by EasyCodingStandard
$processBuilder \FastForward\DevTools\Process\ProcessBuilderInterface builds the process instances used to execute Composer and ECS commands
$processQueue \FastForward\DevTools\Process\ProcessQueueInterface queues and executes the generated processes in the required order
$logger \Psr\Log\LoggerInterface logs command feedback

configure

Configures the current command.

protected configure(): void

This method MUST define the name, description, help text, and options for the command. It SHALL register the --fix option to allow automatic resolutions of style issues.


execute

Executes the code style checks and fixes block.

protected execute(\Symfony\Component\Console\Input\InputInterface $input, \Symfony\Component\Console\Output\OutputInterface $output): int

The method MUST execute composer update --lock, composer normalize, and ECS using secure processes. It SHALL return self::SUCCESS if all commands succeed, or self::FAILURE otherwise.

Parameters:

Parameter Type Description
$input \Symfony\Component\Console\Input\InputInterface the input interface to retrieve options
$output \Symfony\Component\Console\Output\OutputInterface the output interface to log messages

Return Value:

the status code of the command


Inherited methods

addJsonOption

Adds the standard JSON output options to the current command.

protected addJsonOption(): static

isJsonOutput

Determines whether JSON output was requested.

protected isJsonOutput(\Symfony\Component\Console\Input\InputInterface $input): bool

The pretty-json flag SHALL imply JSON output.

Parameters:

Parameter Type Description
$input \Symfony\Component\Console\Input\InputInterface

isPrettyJsonOutput

Determines whether pretty JSON output was requested.

protected isPrettyJsonOutput(\Symfony\Component\Console\Input\InputInterface $input): bool

Parameters:

Parameter Type Description
$input \Symfony\Component\Console\Input\InputInterface

Clone this wiki locally