Revert "minor #19689 [DI] Cleanup array_key_exists (ro0NL)"

This reverts commit c89f80a9cd, reversing
changes made to 386e5e78b4.
This commit is contained in:
Nicolas Grekas 2016-09-04 19:06:49 +02:00
parent 053d67bcab
commit ac742dfc48
2 changed files with 6 additions and 5 deletions

View File

@ -223,6 +223,7 @@ class Container implements IntrospectableContainerInterface
if ('service_container' === $id if ('service_container' === $id
|| isset($this->aliases[$id]) || isset($this->aliases[$id])
|| isset($this->services[$id]) || isset($this->services[$id])
|| array_key_exists($id, $this->services)
) { ) {
return true; return true;
} }
@ -265,7 +266,7 @@ class Container implements IntrospectableContainerInterface
$id = $this->aliases[$id]; $id = $this->aliases[$id];
} }
// Re-use shared service instance if it exists. // Re-use shared service instance if it exists.
if (isset($this->services[$id])) { if (isset($this->services[$id]) || array_key_exists($id, $this->services)) {
return $this->services[$id]; return $this->services[$id];
} }
@ -347,7 +348,7 @@ class Container implements IntrospectableContainerInterface
$id = $this->aliases[$id]; $id = $this->aliases[$id];
} }
return isset($this->services[$id]); return isset($this->services[$id]) || array_key_exists($id, $this->services);
} }
/** /**

View File

@ -436,7 +436,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
return $service; return $service;
} }
if (!isset($this->definitions[$id]) && isset($this->aliasDefinitions[$id])) { if (!array_key_exists($id, $this->definitions) && isset($this->aliasDefinitions[$id])) {
return $this->get($this->aliasDefinitions[$id]); return $this->get($this->aliasDefinitions[$id]);
} }
@ -784,7 +784,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
*/ */
public function hasDefinition($id) public function hasDefinition($id)
{ {
return isset($this->definitions[strtolower($id)]); return array_key_exists(strtolower($id), $this->definitions);
} }
/** /**
@ -800,7 +800,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
{ {
$id = strtolower($id); $id = strtolower($id);
if (!isset($this->definitions[$id])) { if (!array_key_exists($id, $this->definitions)) {
throw new ServiceNotFoundException($id); throw new ServiceNotFoundException($id);
} }