diff --git a/src/CSSList/CSSBlockList.php b/src/CSSList/CSSBlockList.php index 0f8bbe36..10a7778c 100644 --- a/src/CSSList/CSSBlockList.php +++ b/src/CSSList/CSSBlockList.php @@ -57,28 +57,21 @@ protected function allDeclarationBlocks(array &$result): void /** * Returns all `RuleSet` objects recursively found in the tree, no matter how deeply nested the rule sets are. * - * @return array + * @return list */ public function getAllRuleSets(): array { - /** @var array $result */ $result = []; - $this->allRuleSets($result); - return $result; - } - /** - * @param array $result - */ - protected function allRuleSets(array &$result): void - { foreach ($this->contents as $item) { if ($item instanceof RuleSet) { $result[] = $item; } elseif ($item instanceof CSSBlockList) { - $item->allRuleSets($result); + $result = \array_merge($result, $item->getAllRuleSets()); } } + + return $result; } /**