-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[DependencyInjection] Removed extra strtolower calls #14470
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
Conversation
@@ -686,7 +686,7 @@ public function setAlias($alias, $id) | |||
throw new InvalidArgumentException('$id must be a string, or an Alias object.'); | |||
} | |||
|
|||
if ($alias === strtolower($id)) { | |||
if ($alias === $id) { |
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.
this seems wrong: string === Alias can never be true
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.
Done, casted $id
to a string and added a missing test for this condition.
|
@Tobion agree, btw you know the reason why in some hassers |
to support |
Thank you @dosten. |
…sten) This PR was squashed before being merged into the 2.3 branch (closes #14470). Discussion ---------- [DependencyInjection] Removed extra strtolower calls | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - `Alias` already lowercase the `$id` in the constructor. Using `ContainerBuilder::hasAlias()` and `ContainerBuilder::hasDefinition()` inside the code makes an extra strtolower call. Commits ------- 3bfbf45 [DependencyInjection] Removed extra strtolower calls
This PR was squashed before being merged into the 2.7 branch (closes #19689). Discussion ---------- [DI] Cleanup array_key_exists | Q | A | ------------- | --- | Branch? | 2.7 | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | comma-separated list of tickets fixed by the PR, if any | License | MIT | Doc PR | reference to the documentation PR, if any Investigated this a bit, and to me it looks like left-over code. `null` doesnt end up in `$this->services` by design (this was done in #8582) so it seems. The test added then for regression still passes :) I cant believe we guarantee BC for users doing `$this->services['id'] = null` (due protected), allowing them to break the design of `has`, `get` and `initialized` right now. This also happens for `$this->definitions` in `ContainerBuilder`, maybe because `Container` did it alteady.. but im not sure. Then again, there's this comment: #14470 (comment) Commits ------- 3306c70 [DI] Cleanup array_key_exists
Alias
already lowercase the$id
in the constructor. UsingContainerBuilder::hasAlias()
andContainerBuilder::hasDefinition()
inside the code makes an extra strtolower call.