diff --git a/src/Collector/ImplementedInterfaceCollector.php b/src/Collector/ImplementedInterfaceCollector.php index 21bfe0f0..727361c2 100644 --- a/src/Collector/ImplementedInterfaceCollector.php +++ b/src/Collector/ImplementedInterfaceCollector.php @@ -18,7 +18,7 @@ public function getNodeType(): string /** * @param Class_ $node - * @return string[]|null + * @return non-empty-array|null */ public function processNode(Node $node, Scope $scope): ?array { @@ -33,6 +33,10 @@ public function processNode(Node $node, Scope $scope): ?array $implementedInterfaceNames[] = $implement->toString(); } + if ($implementedInterfaceNames === []) { + return null; + } + return $implementedInterfaceNames; } } diff --git a/src/Collector/InterfaceOfAbstractClassCollector.php b/src/Collector/InterfaceOfAbstractClassCollector.php index 7601fc82..17c1fa76 100644 --- a/src/Collector/InterfaceOfAbstractClassCollector.php +++ b/src/Collector/InterfaceOfAbstractClassCollector.php @@ -18,7 +18,7 @@ public function getNodeType(): string /** * @param Class_ $node - * @return string[]|null + * @return non-empty-array|null */ public function processNode(Node $node, Scope $scope): ?array { @@ -32,6 +32,10 @@ public function processNode(Node $node, Scope $scope): ?array $interfaceNames[] = $implement->toString(); } + if ($interfaceNames === []) { + return null; + } + return $interfaceNames; } }