DependenciesCommand

Class
extends Command
Final: Yes

Orchestrates dependency analysis across the supported Composer analyzers.

Description

This command MUST report missing, unused, and misplaced dependencies using a single, deterministic report that is friendly for local development and CI runs.

Attributes
#[AsCommand]
$name : 'dev-tools:deps'
$description : 'Analyzes missing, unused, misplaced, and outdated Composer dependencies.'
$aliases : ['deps', 'dependencies']

Table of Contents

Constants

 = 'composer-dependency-analyser.php'

Properties

Methods

 : mixed
addJsonOption()

Adds the standard JSON output options to the current command.

 : static
configure()

Configures the dependency workflow options.

 : void
execute()

Executes the dependency analysis workflow.

 : int
isJsonOutput()

Determines whether JSON output was requested.

 : bool
isPrettyJsonOutput()

Determines whether pretty JSON output was requested.

 : bool
failure()

Logs a failed command result and returns the failure exit code.

 : int
getComposerDependencyAnalyserCommand()

Builds the Composer Dependency Analyser process.

 : Process
getComposerNormalizeCommand()

Builds the Composer Normalize process.

 : Process
getComposerUpdateCommand()

Builds the Composer update process.

 : Process
getJackBreakpointCommand()

Builds the Jack breakpoint process.

 : Process
getOpenVersionsCommand()

Builds the Jack open-versions process.

 : Process
getRaiseToInstalledCommand()

Builds the Jack raise-to-installed process.

 : Process
isImplicitJsonOutputEnabled()

Determines whether structured JSON output SHOULD be enabled implicitly.

 : bool
isOptionEnabled()

Determines whether a boolean input option was enabled.

 : bool
log()

Logs a non-terminal command message unless structured JSON output is active.

 : void
resolveMaximumOutdated()

Resolves the maximum outdated dependency threshold.

 : int
shouldIgnoreOutdatedFailures()

Determines whether Jack outdated failures SHOULD be ignored for the given threshold.

 : bool
success()

Logs a successful command result and returns the success exit code.

 : int
Constants

Constants

ANALYSER_CONFIG

Private
private string ANALYSER_CONFIG = 'composer-dependency-analyser.php'

DISABLE_OUTDATED_THRESHOLD

Private
private int DISABLE_OUTDATED_THRESHOLD = -1
Properties
Methods

addJsonOption()

Protected

Adds the standard JSON output options to the current command.

protected addJsonOption() : static
Return values
static

configure()

Protected

Configures the dependency workflow options.

protected configure() : void

execute()

Protected

Executes the dependency analysis workflow.

protected execute(InputInterface  $input, OutputInterface  $output) : int
Parameters
$input : InputInterface

Description

the runtime command input

$output : OutputInterface

Description

the console output stream

Return values
int

Description

the command execution status code

isJsonOutput()

Protected

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
bool

isPrettyJsonOutput()

Protected

Determines whether pretty JSON output was requested.

protected isPrettyJsonOutput(InputInterface  $input) : bool
Parameters
$input : InputInterface
Return values
bool

failure()

Private

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
int

getComposerDependencyAnalyserCommand()

Private

Builds the Composer Dependency Analyser process.

private getComposerDependencyAnalyserCommand(InputInterface  $input) : Process
Parameters
$input : InputInterface

Description

the runtime command input

Return values
Process

Description

the configured Composer Dependency Analyser process

getComposerNormalizeCommand()

Private

Builds the Composer Normalize process.

private getComposerNormalizeCommand() : Process
Return values
Process

Description

the configured Composer Normalize process

getComposerUpdateCommand()

Private

Builds the Composer update process.

private getComposerUpdateCommand() : Process
Return values
Process

Description

the configured Composer update process

getJackBreakpointCommand()

Private

Builds the Jack breakpoint process.

private getJackBreakpointCommand(InputInterface  $input, int  $maximumOutdated) : Process
Parameters
$input : InputInterface

Description

the runtime command input

$maximumOutdated : int

Description

the maximum number of outdated packages accepted by Jack

Return values
Process

Description

the configured Jack breakpoint process

getOpenVersionsCommand()

Private

Builds the Jack open-versions process.

private getOpenVersionsCommand(InputInterface  $input) : Process
Parameters
$input : InputInterface

Description

the runtime command input

Return values
Process

Description

the configured Jack open-versions process

getRaiseToInstalledCommand()

Private

Builds the Jack raise-to-installed process.

private getRaiseToInstalledCommand(InputInterface  $input) : Process
Parameters
$input : InputInterface

Description

the runtime command input

Return values
Process

Description

the configured Jack raise-to-installed process

isImplicitJsonOutputEnabled()

Private

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
bool

isOptionEnabled()

Private

Determines whether a boolean input option was enabled.

private isOptionEnabled(InputInterface  $input, string  $option) : bool
Parameters
$input : InputInterface
$option : string
Return values
bool

log()

Private

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

resolveMaximumOutdated()

Private

Resolves the maximum outdated dependency threshold.

private resolveMaximumOutdated(InputInterface  $input) : int
Parameters
$input : InputInterface

Description

the runtime command input

Return values
int

Description

the validated maximum number of outdated packages

shouldIgnoreOutdatedFailures()

Private

Determines whether Jack outdated failures SHOULD be ignored for the given threshold.

private shouldIgnoreOutdatedFailures( int  $maximumOutdated) : bool
Parameters
$maximumOutdated : int

Description

the validated outdated threshold option

Return values
bool

Description

true when the outdated threshold is explicitly disabled

success()

Private

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

Return values
int