Skip to content

Commit 4cbe192

Browse files
Merge branch '2.7' into 2.8
* 2.7: [DI] Resolve aliases earlier bumped Symfony version to 2.7.33 updated VERSION for 2.7.32 update CONTRIBUTORS for 2.7.32 updated CHANGELOG for 2.7.32
2 parents db8bdcf + 897c4fd commit 4cbe192

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

Container.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -256,16 +256,16 @@ public function get($id, $invalidBehavior = self::EXCEPTION_ON_INVALID_REFERENCE
256256
// this method can be called thousands of times during a request, avoid
257257
// calling strtolower() unless necessary.
258258
for ($i = 2;;) {
259-
if ('service_container' === $id) {
260-
return $this;
261-
}
262259
if (isset($this->aliases[$id])) {
263260
$id = $this->aliases[$id];
264261
}
265262
// Re-use shared service instance if it exists.
266263
if (isset($this->services[$id]) || array_key_exists($id, $this->services)) {
267264
return $this->services[$id];
268265
}
266+
if ('service_container' === $id) {
267+
return $this;
268+
}
269269

270270
if (isset($this->loading[$id])) {
271271
throw new ServiceCircularReferenceException($id, array_keys($this->loading));
@@ -335,16 +335,16 @@ public function initialized($id)
335335
{
336336
$id = strtolower($id);
337337

338+
if (isset($this->aliases[$id])) {
339+
$id = $this->aliases[$id];
340+
}
341+
338342
if ('service_container' === $id) {
339343
// BC: 'service_container' was a synthetic service previously.
340344
// @todo Change to false in next major release.
341345
return true;
342346
}
343347

344-
if (isset($this->aliases[$id])) {
345-
$id = $this->aliases[$id];
346-
}
347-
348348
return isset($this->services[$id]) || array_key_exists($id, $this->services);
349349
}
350350

Dumper/PhpDumper.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1502,6 +1502,10 @@ public function addExpressionLanguageProvider(ExpressionFunctionProviderInterfac
15021502
*/
15031503
private function getServiceCall($id, Reference $reference = null)
15041504
{
1505+
while ($this->container->hasAlias($id)) {
1506+
$id = (string) $this->container->getAlias($id);
1507+
}
1508+
15051509
if ('service_container' === $id) {
15061510
return '$this';
15071511
}
@@ -1510,10 +1514,6 @@ private function getServiceCall($id, Reference $reference = null)
15101514
return sprintf('$this->get(\'%s\', ContainerInterface::NULL_ON_INVALID_REFERENCE)', $id);
15111515
}
15121516

1513-
if ($this->container->hasAlias($id)) {
1514-
$id = (string) $this->container->getAlias($id);
1515-
}
1516-
15171517
return sprintf('$this->get(\'%s\')', $id);
15181518
}
15191519

0 commit comments

Comments
 (0)