Generates the package API documentation through phpDocumentor.
Description
The command prepares a temporary phpDocumentor configuration from the current package metadata, then delegates execution to the shared process queue so logging and grouped output stay consistent with the rest of the command surface.
'reports:docs'
'Generates API documentation.'
['reports:phpdoc', 'phpDocumentor', 'docs']
Constants
Properties
Methods
Creates a new DocsCommand instance.
Adds the standard cache directory option to the current command.
Adds the standard cache control option to the current command.
Adds the standard JSON output options to the current command.
Configures the command options used to generate API documentation.
Generates API documentation for the configured project surface.
Resolves whether cache writes SHOULD be enabled for the current invocation.
Determines whether JSON output was requested.
Determines whether pretty JSON output was requested.
Returns the explicit cache flag that SHOULD be forwarded to nested commands.
Resolves a nested cache directory for a child command.
Creates a temporary phpDocumentor configuration for the current project.
Logs a failed command result and returns the failure exit code.
Determines whether the current invocation explicitly passed `--cache-dir`.
Detects whether a source option still points at the default guide directory.
Determines whether structured JSON output SHOULD be enabled implicitly.
Determines whether cache writes were explicitly disabled for the current invocation.
Determines whether a boolean input option was enabled.
Logs a non-terminal command message unless structured JSON output is active.
Normalizes a project-relative path for resilient default-option comparisons.
Logs a successful command result and returns the success exit code.
private
ComposerJsonInterface
$composer
private
FilesystemInterface
$filesystem
private
ProcessBuilderInterface
$processBuilder
private
ProcessQueueInterface
$processQueue
private
ProjectCapabilitiesResolverInterface
$projectCapabilitiesResolver
private
Environment
$renderer
Creates a new DocsCommand instance.
public
__construct(ProcessBuilderInterface
$processBuilder, ProcessQueueInterface
$processQueue, Environment
$renderer, FilesystemInterface
$filesystem, ComposerJsonInterface
$composer, ProjectCapabilitiesResolverInterface
$projectCapabilitiesResolver) : mixed
Parameters
Description
the process builder for executing phpDocumentor
Description
the process queue for managing execution
$renderer
:
Environment
Description
renders phpDocumentor configuration templates
Description
the filesystem for handling file operations
Description
the composer.json handler for accessing project metadata
Description
the project capability resolver
Adds the standard cache directory option to the current command.
protected
addCacheDirOption(
string
$description,
string
$default) : static
Parameters
$description
:
string
Description
the cache directory option description
$default
:
string
Description
the command-specific default cache directory
Return values
Adds the standard cache control option to the current command.
protected
addCacheOption(
string
$description) : static
Parameters
$description
:
string
Description
the cache option description
Return values
Adds the standard JSON output options to the current command.
protected
addJsonOption() : static
Return values
Configures the command options used to generate API documentation.
protected
configure() : void
Generates API documentation for the configured project surface.
protected
execute(InputInterface
$input, OutputInterface
$output) : int
Parameters
$input
:
InputInterface
$output
:
OutputInterface
Return values
Resolves whether cache writes SHOULD be enabled for the current invocation.
protected
isCacheEnabled(InputInterface
$input[,
bool
$default = true]) : bool
Parameters
$input
:
InputInterface
Description
the current command input
$default
:
bool
=
true
Description
the command-specific default cache behavior when the option is omitted
Return values
Determines whether JSON output was requested.
protected
isJsonOutput(InputInterface
$input) : bool
Description
The pretty-json flag SHALL imply JSON output.
Parameters
$input
:
InputInterface
Return values
Determines whether pretty JSON output was requested.
protected
isPrettyJsonOutput(InputInterface
$input) : bool
Parameters
$input
:
InputInterface
Return values
Returns the explicit cache flag that SHOULD be forwarded to nested commands.
protected
resolveCacheArgument(InputInterface
$input) : string|null
Parameters
$input
:
InputInterface
Description
the current command input
Return values
Resolves a nested cache directory for a child command.
protected
resolveCacheDirArgument(InputInterface
$input[,
string
$path = '']) : string|null
Parameters
$input
:
InputInterface
Description
the current command input
$path
:
string
=
''
Description
the child cache path relative to the current command cache root
Return values
Creates a temporary phpDocumentor configuration for the current project.
private
createPhpDocumentorConfig(
string
$source,
string
$target,
string
$template,
string
$cacheDir, ProjectCapabilities
$projectCapabilities) : string
Parameters
$source
:
string
Description
the source directory for the generated documentation
$target
:
string
Description
the output directory for the generated documentation
$template
:
string
Description
the phpDocumentor template name or path
$cacheDir
:
string
Description
the cache directory for phpDocumentor
Description
the resolved project capability snapshot
Return values
Description
the absolute path to the generated configuration
Logs a failed command result and returns the failure exit code.
private
failure(
string
$message, InputInterface
$input[,
array<string, mixed>
$context = []][,
string|null
$file = null][,
int|null
$line = null]) : int
Parameters
$message
:
string
Description
the failure message
$input
:
InputInterface
Description
the originating command input
$context
:
array<string, mixed>
=
[]
Description
optional extra log context
$file
:
string|null
=
null
Description
the related file path when known
$line
:
int|null
=
null
Description
the related line when known
Return values
Determines whether the current invocation explicitly passed `--cache-dir`.
private
hasExplicitCacheDirArgument(InputInterface
$input) : bool
Parameters
$input
:
InputInterface
Description
the current command input
Return values
Detects whether a source option still points at the default guide directory.
private
isDefaultGuideSource(
string
$sourceOption) : bool
Parameters
$sourceOption
:
string
Description
the guide source option received from the CLI
Return values
Description
true when the provided path is equivalent to the default guide directory
Determines whether structured JSON output SHOULD be enabled implicitly.
private
isImplicitJsonOutputEnabled() : bool
Description
Commands MAY opt into runtime-environment-aware behavior by exposing a
$runtimeEnvironment property. Commands that do not expose it SHALL fall
back to the shared runtime-environment service from the DevTools container.
Return values
Determines whether cache writes were explicitly disabled for the current invocation.
private
isNoCacheRequested(InputInterface
$input) : bool
Description
The Composer application already provides a global --no-cache flag, so commands
SHALL reuse that switch instead of redefining a local negated variant.
Parameters
$input
:
InputInterface
Description
the current command input
Return values
Determines whether a boolean input option was enabled.
private
isOptionEnabled(InputInterface
$input,
string
$option) : bool
Parameters
$input
:
InputInterface
$option
:
string
Return values
Logs a non-terminal command message unless structured JSON output is active.
private
log(
string
$message, InputInterface
$input[,
array<string, mixed>
$context = []][,
string
$logLevel = LogLevel::INFO]) : void
Parameters
$message
:
string
Description
the progress message
$input
:
InputInterface
Description
the originating command input
$context
:
array<string, mixed>
=
[]
Description
optional extra log context
$logLevel
:
string
=
LogLevel::INFO
Description
the PSR-3 log level used for the message
Normalizes a project-relative path for resilient default-option comparisons.
private
normalizeProjectRelativePath(
string
$path) : string
Parameters
$path
:
string
Description
the project-relative path to normalize
Return values
Description
the normalized project-relative path
private
resolveRuntimeEnvironment() : RuntimeEnvironmentInterface|null
Return values
Logs a successful command result and returns the success exit code.
private
success(
string
$message, InputInterface
$input[,
array<string, mixed>
$context = []][,
string
$logLevel = LogLevel::INFO]) : int
Parameters
$message
:
string
Description
the success message
$input
:
InputInterface
Description
the originating command input
$context
:
array<string, mixed>
=
[]
Description
optional extra log context
$logLevel
:
string
=
LogLevel::INFO
Description
the PSR-3 log level used for the successful result