Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 478375d

Browse files
committed
[DI] remove useless condition around unset
1 parent 5f93188 commit 478375d

File tree

2 files changed

+2
-7
lines changed

2 files changed

+2
-7
lines changed

src/Symfony/Component/DependencyInjection/Container.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -312,10 +312,7 @@ public function get($id, $invalidBehavior = self::EXCEPTION_ON_INVALID_REFERENCE
312312
$service = $this->$method();
313313
} catch (\Exception $e) {
314314
unset($this->loading[$id]);
315-
316-
if (array_key_exists($id, $this->services)) {
317-
unset($this->services[$id]);
318-
}
315+
unset($this->services[$id]);
319316

320317
if ($e instanceof InactiveScopeException && self::EXCEPTION_ON_INVALID_REFERENCE !== $invalidBehavior) {
321318
return;

src/Symfony/Component/DependencyInjection/Definition.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -409,9 +409,7 @@ public function hasTag($name)
409409
*/
410410
public function clearTag($name)
411411
{
412-
if (isset($this->tags[$name])) {
413-
unset($this->tags[$name]);
414-
}
412+
unset($this->tags[$name]);
415413

416414
return $this;
417415
}

0 commit comments

Comments
 (0)