10000 [DI] Dont share service when no id provided · symfony/symfony@948dc96 · GitHub
[go: up one dir, main page]

Skip to content

Commit 948dc96

Browse files
[DI] Dont share service when no id provided
1 parent e9f2512 commit 948dc96

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/Symfony/Component/DependencyInjection/ContainerBuilder.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ public function get($id, $invalidBehavior = ContainerInterface::EXCEPTION_ON_INV
430430
}
431431

432432
if (!array_key_exists($id, $this->definitions) && isset($this->aliasDefinitions[$id])) {
433-
return $this->get($this->aliasDefinitions[$id], $invalidBehavior);
433+
return $this->get((string) $this->aliasDefinitions[$id], $invalidBehavior);
434434
}
435435

436436
try {
@@ -1099,15 +1099,15 @@ private function callMethod($service, $call)
10991099
/**
11001100
* Shares a given service in the container.
11011101
*
1102-
* @param Definition $definition
1103-
* @param mixed $service
1104-
* @param string $id
1102+
* @param Definition $definition
1103+
* @param mixed $service
1104+
* @param string|null $id
11051105
*
11061106
* @throws InactiveScopeException
11071107
*/
11081108
private function shareService(Definition $definition, $service, $id)
11091109
{
1110-
if (self::SCOPE_PROTOTYPE !== $scope = $definition->getScope()) {
1110+
if (null !== $id && self::SCOPE_PROTOTYPE !== $scope = $definition->getScope()) {
11111111
if (self::SCOPE_CONTAINER !== $scope && !isset($this->scopedServices[$scope])) {
11121112
throw new InactiveScopeException($id, $scope);
11131113
}

0 commit comments

Comments
 (0)
0