Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
tfrommen committed Jan 28, 2025
1 parent aa4c629 commit 5ceef1a
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions src/Container/ServiceExtensions.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,7 @@ protected function resolveByType(
}

// 2nd group of extensions: targeting parent classes
$parents = class_parents($service, false);
if ($parents === false) {
$parents = [];
}
$parents = class_parents($service, false) ?: [];
foreach ($parents as $parentName) {
$byParent = $this->extensions[self::typeId($parentName)] ?? null;
if (($byParent !== null) && ($byParent !== [])) {
Expand All @@ -130,10 +127,7 @@ protected function resolveByType(
}

// 3rd group of extensions: targeting implemented interfaces
$interfaces = class_implements($service, false);
if ($interfaces === false) {
$interfaces = [];
}
$interfaces = class_implements($service, false) ?: [];
foreach ($interfaces as $interfaceName) {
$byInterface = $this->extensions[self::typeId($interfaceName)] ?? null;
if (($byInterface !== null) && ($byInterface !== [])) {
Expand Down

0 comments on commit 5ceef1a

Please sign in to comment.