-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[DependencyInjection] Fix typo in test name #35507
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[DependencyInjection] Fix typo in test name #35507
Conversation
Rename testThrowsExceptionWhenAddServiceOnACompiledContainer to testNoExceptionWhenAddServiceOnACompiledContainer.
Thank you for this PR. Here is the code for public function set(string $id, ?object $service)
{
if ($this->isCompiled() && (isset($this->definitions[$id]) && !$this->definitions[$id]->isSynthetic())) {
// setting a synthetic service on a compiled container is alright
throw new BadMethodCallException(sprintf('Setting service "%s" for an unknown or non-synthetic service definition on a compiled container is not allowed.', $id));
}
// ... I think there are more things that are not correct here. The exception message is
So currently, If the container is compiled:
I would like someone to confirm the correct logic. If the current logic is correct, I believe the exception message should be updated too. IE:
|
I am in favour of updating the exception message:
I find the word "unknown" in the current message confusing - if the definition is unknown, you are simply setting a new service. By the way, if the definition is known, you are setting the service anyways
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please submit any improved messages to the master branch.
Thank you @signor-pedro. |
This PR was merged into the 3.4 branch. Discussion ---------- [DependencyInjection] Fix typo in test name Rename testThrowsExceptionWhenAddServiceOnACompiledContainer to testNoExceptionWhenAddServiceOnACompiledContainer. | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | yes (technically) | New feature? | no | Deprecations? | no | Tickets | #35505 | License | MIT | Doc PR | symfony/symfony-docs#... <!-- required for new features --> Commits ------- 9cbfad5 [DependencyInjection] #35505 Fix typo in test name
Rename testThrowsExceptionWhenAddServiceOnACompiledContainer to testNoExceptionWhenAddServiceOnACompiledContainer.