You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
minor #14470 [DependencyInjection] Removed extra strtolower calls (dosten)
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
Copy file name to clipboardExpand all lines: Tests/ContainerBuilderTest.php
+7Lines changed: 7 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -189,6 +189,13 @@ public function testAliases()
189
189
$this->assertTrue($builder->has('bar'), '->setAlias() defines a new service');
190
190
$this->assertTrue($builder->get('bar') === $builder->get('foo'), '->setAlias() creates a service that is an alias to another one');
191
191
192
+
try {
193
+
$builder->setAlias('foobar', 'foobar');
194
+
$this->fail('->setAlias() throws an InvalidArgumentException if the alias references itself');
195
+
} catch (\InvalidArgumentException$e) {
196
+
$this->assertEquals('An alias can not reference itself, got a circular reference on "foobar".', $e->getMessage(), '->setAlias() throws an InvalidArgumentException if the alias references itself');
197
+
}
198
+
192
199
try {
193
200
$builder->getAlias('foobar');
194
201
$this->fail('->getAlias() throws an InvalidArgumentException if the alias does not exist');
0 commit comments