Skip to content

[4.x] Inspect the application lazily in ApplicationDescription::getCommand() - #34

Open
Hackwar wants to merge 1 commit into
joomla-framework:4.x-devfrom
Hackwar:4.x-description-get-command
Open

Hackwar wants to merge 1 commit into
joomla-framework:4.x-devfrom
Hackwar:4.x-description-get-command

Conversation

@Hackwar

@Hackwar Hackwar commented Nov 12, 2026

Copy link
Copy Markdown
Contributor

Summary of Changes

ApplicationDescription::getCommand() read the internal command and alias lists without filling them first; only getCommands() and getNamespaces() trigger the inspection of the application. (new ApplicationDescription($app))->getCommand('list') therefore threw CommandNotFoundException: Command list does not exist. The TextDescriptor happens to call getCommands() first, so only other callers were affected.

getCommand() now inspects the application on first use, like the other getters, and inspectApplication() initialises the alias list together with the command and namespace lists.

Testing Instructions

New tests/Descriptor/ApplicationDescriptionTest.php: looking up a command and an alias on a fresh description (both fail on 4.x-dev with the exception above), an unknown name, and an application without aliases.

Documentation Changes Required

None. ApplicationDescription is not covered by the docs.

🤖 Generated with Claude Code

getCommand() read the command and alias lists without populating them,
so it threw "Command list does not exist." unless getCommands() or
getNamespaces() had been called first. It now inspects the application
on first use like the other getters, and the alias list is initialised
together with the command list.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Hackwar

Hackwar commented Nov 19, 2026

Copy link
Copy Markdown
Contributor Author

Approved

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant