Skip to content

PhpDocCommand

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

Provides operations to inspect, lint, and repair PHPDoc comments across the project.

The class MUST NOT be extended and SHALL coordinate tools like PHP-CS-Fixer and Rector.


Constants

Constant Visibility Type Value
FILENAME public string '.docheader'
CONFIG public string '.php-cs-fixer.dist.php'
CACHE_FILE public string '.php-cs-fixer.cache'

Methods

__construct

Creates a new PhpDocCommand instance.

public __construct(\FastForward\DevTools\Process\ProcessBuilderInterface $processBuilder, \FastForward\DevTools\Process\ProcessQueueInterface $processQueue, \FastForward\DevTools\Composer\Json\ComposerJsonInterface $composer, \Symfony\Component\Config\FileLocatorInterface $fileLocator, \FastForward\DevTools\Filesystem\FilesystemInterface $filesystem, \Twig\Environment $renderer, \Psr\Clock\ClockInterface $clock, \Psr\Log\LoggerInterface $logger): mixed

Parameters:

Parameter Type Description
$processBuilder \FastForward\DevTools\Process\ProcessBuilderInterface
$processQueue \FastForward\DevTools\Process\ProcessQueueInterface
$composer \FastForward\DevTools\Composer\Json\ComposerJsonInterface
$fileLocator \Symfony\Component\Config\FileLocatorInterface the locator for template resources
$filesystem \FastForward\DevTools\Filesystem\FilesystemInterface the filesystem component
$renderer \Twig\Environment
$clock \Psr\Clock\ClockInterface
$logger \Psr\Log\LoggerInterface the output-aware logger

configure

Configures the PHPDoc command.

protected configure(): void

This method MUST securely configure the expected inputs, such as the --fix option.


execute

Executes the PHPDoc checks and rectifications.

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

The method MUST ensure the .docheader template is present. It SHALL then invoke PHP-CS-Fixer and Rector. If both succeed, it MUST return self::SUCCESS.

Parameters:

Parameter Type Description
$input \Symfony\Component\Console\Input\InputInterface the command input parameters
$output \Symfony\Component\Console\Output\OutputInterface the system output handler

Return Value:

the success or failure state


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

addCacheOption

Adds the standard cache control option to the current command.

protected addCacheOption(string $description): static

Parameters:

Parameter Type Description
$description string the cache option description

addCacheDirOption

Adds the standard cache directory option to the current command.

protected addCacheDirOption(string $description, string $default): static

Parameters:

Parameter Type Description
$description string the cache directory option description
$default string the command-specific default cache directory

isCacheEnabled

Resolves whether cache writes SHOULD be enabled for the current invocation.

protected isCacheEnabled(\Symfony\Component\Console\Input\InputInterface $input, bool $default = true): bool

Parameters:

Parameter Type Description
$input \Symfony\Component\Console\Input\InputInterface the current command input
$default bool the command-specific default cache behavior when the option is omitted

resolveCacheArgument

Returns the explicit cache flag that SHOULD be forwarded to nested commands.

protected resolveCacheArgument(\Symfony\Component\Console\Input\InputInterface $input): ?string

Parameters:

Parameter Type Description
$input \Symfony\Component\Console\Input\InputInterface the current command input

resolveCacheDirArgument

Resolves a nested cache directory for a child command.

protected resolveCacheDirArgument(\Symfony\Component\Console\Input\InputInterface $input, string $path = ''): ?string

Parameters:

Parameter Type Description
$input \Symfony\Component\Console\Input\InputInterface the current command input
$path string the child cache path relative to the current command cache root

Clone this wiki locally