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