diff --git a/src/CSSList/CSSBlockList.php b/src/CSSList/CSSBlockList.php index 0f2817c3..cae6d9f0 100644 --- a/src/CSSList/CSSBlockList.php +++ b/src/CSSList/CSSBlockList.php @@ -23,13 +23,20 @@ abstract class CSSBlockList extends CSSList /** * Gets all `DeclarationBlock` objects recursively, no matter how deeply nested the selectors are. * - * @return array + * @return list */ public function getAllDeclarationBlocks(): array { - /** @var array $result */ $result = []; - $this->allDeclarationBlocks($result); + + foreach ($this->contents as $item) { + if ($item instanceof DeclarationBlock) { + $result[] = $item; + } elseif ($item instanceof CSSBlockList) { + $result = \array_merge($result, $item->getAllDeclarationBlocks()); + } + } + return $result; }