8000 [DI] use try-finally for container · symfony/symfony@1ab7316 · GitHub
[go: up one dir, main page]

Skip to content

Commit 1ab7316

Browse files
committed
[DI] use try-finally for container
1 parent 5183c88 commit 1ab7316

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

src/Symfony/Component/DependencyInjection/Container.php

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -272,17 +272,13 @@ public function get($id, $invalidBehavior = self::EXCEPTION_ON_INVALID_REFERENCE
272272
try {
273273
$service = $this->$method();
274274
} catch (\Exception $e) {
275-
unset($this->loading[$id]);
276-
277-
if (array_key_exists($id, $this->services)) {
278-
unset($this->services[$id]);
279-
}
275+
unset($this->services[$id]);
280276

281277
throw $e;
278+
} finally {
279+
unset($this->loading[$id]);
282280
}
283281

284-
unset($this->loading[$id]);
285-
286282
return $service;
287283
}
288284
}

0 commit comments

Comments
 (0)
0