Skip to content

Commit fd140fc

Browse files
committed
minor symfony#16691 [DI] remove useless condition around unset (Tobion)
This PR was merged into the 2.3 branch. Discussion ---------- [DI] remove useless condition around unset | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | n/a | License | MIT | Doc PR | n/a Commits ------- 478375d [DI] remove useless condition around unset
2 parents 5f93188 + 478375d commit fd140fc

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)