Repository navigation
Conversation
get() threw "Command "x" does not exist." both for a name that is not in the command map and for a mapped name whose service the container does not have. The second case is a container misconfiguration, so it now throws a LogicException naming the missing service ID. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Author
|
Approved, but the documentation is rather confusing. |
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
ContainerLoader::get()threwCommand "x" does not exist.both for a name that is not in the command map and for a mapped name whose service the container does not have. The second case is a container misconfiguration, and the message sent people looking for a typo in the command name.get()now checks the two conditions separately: a name missing from the map still throwsCommandNotFoundExceptionwith the same message; a mapped name whose service is not registered throwsSymfony\Component\Console\Exception\LogicException:Command "x" is mapped to the service "y", which is not registered in the container.has()is unchanged (it still requires both the map entry and the service), soApplication::hasCommand()/getCommand()behave as before; the new exception surfaces when the loader is called directly.Behaviour change: code that calls
ContainerLoader::get()directly and catchesCommandNotFoundExceptionfor a mapped-but-unregistered service now gets aLogicExceptioninstead.Testing Instructions
tests/Loader/ContainerLoaderTest.php:testTheLoaderDoesNotRetrieveAnUnknownCommandnow uses a name that is not in the map and checks the message;testTheLoaderReportsAMappedCommandWhoseServiceIsMissingfails on4.x-dev(it gets theCommandNotFoundException) and passes with this change;testTheLoaderDoesNotHaveAMappedCommandWhoseServiceIsMissingpins the unchangedhas()behaviour.Documentation Changes Required
docs/overview.md: the "Things to know" paragraph aboutContainerLoadernow describes both cases.🤖 Generated with Claude Code