[DI] use try-finally for container
This commit is contained in:
parent
5183c881d0
commit
1ab73166a7
@ -272,17 +272,13 @@ class Container implements ResettableContainerInterface
|
||||
try {
|
||||
$service = $this->$method();
|
||||
} catch (\Exception $e) {
|
||||
unset($this->loading[$id]);
|
||||
|
||||
if (array_key_exists($id, $this->services)) {
|
||||
unset($this->services[$id]);
|
||||
}
|
||||
unset($this->services[$id]);
|
||||
|
||||
throw $e;
|
||||
} finally {
|
||||
unset($this->loading[$id]);
|
||||
}
|
||||
|
||||
unset($this->loading[$id]);
|
||||
|
||||
return $service;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user