From 5ceef1afab195dee728be859b46d3745b26b6ee2 Mon Sep 17 00:00:00 2001 From: tfrommen Date: Tue, 28 Jan 2025 15:09:32 +0100 Subject: [PATCH] refactor --- src/Container/ServiceExtensions.php | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/Container/ServiceExtensions.php b/src/Container/ServiceExtensions.php index 78d1733..a1389f8 100644 --- a/src/Container/ServiceExtensions.php +++ b/src/Container/ServiceExtensions.php @@ -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 !== [])) { @@ -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 !== [])) {