Repository navigation
Conversation
doExecute() printed a "Command "x" is not defined." block and then rethrew the CommandNotFoundException, which execute() rendered a second time as "The command "x" does not exist.". Leave the output to the throwable rendering, as Symfony's Application does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Author
|
Approved |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary of Changes
Running an unknown command printed two error blocks:
doExecute()wroteCommand "nope" is not defined.itself, dispatchedCOMMAND_ERRORand rethrew theCommandNotFoundException, andexecute()then rendered the same exception again asThe command "nope" does not exist..This removes the extra block from
doExecute(), so the error is reported once, throughrenderThrowable()(on the error output for aConsoleOutput), as Symfony'sApplicationdoes. A side effect: withsetCatchThrowables(false)the application no longer prints anything itself for an unknown command and leaves the exception to the caller, like for every other error.Testing Instructions
ApplicationTest::testHandlingThrowablesnow asserts thatThe command "foo" does not exist.appears exactly once in the output and that theis not definedblock is gone. It fails on4.x-devand passes with this change.Manually: run an application with
new ArrayInput(['command' => 'nope'])and aBufferedOutput— before, both messages are printed; after, onlyThe command "nope" does not exist..Documentation Changes Required
None. The docs do not describe the unknown-command output.
🤖 Generated with Claude Code