File tree Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -33,13 +33,25 @@ public static function parse(ParserState $parserState): Document
3333 /**
3434 * Gets all `DeclarationBlock` objects recursively, no matter how deeply nested the selectors are.
3535 *
36- * @return array<int, DeclarationBlock>
36+ * @return list< DeclarationBlock>
3737 */
3838 public function getAllDeclarationBlocks (): array
3939 {
40- /** @var array<int, DeclarationBlock> $result */
40+ /** @var list< DeclarationBlock> $result */
4141 $ result = [];
42- $ this ->allDeclarationBlocks ($ result );
42+
43+ foreach ($ this ->contents as $ directSibling ) {
44+ if ($ directSibling instanceof DeclarationBlock) {
45+ $ result [] = $ directSibling ;
46+ } elseif ($ directSibling instanceof CSSBlockList) {
47+ $ grandchildren = [];
48+ $ directSibling ->allDeclarationBlocks ($ grandchildren );
49+ foreach ($ grandchildren as $ grandchild ) {
50+ $ result [] = $ grandchild ;
51+ }
52+ }
53+ }
54+
4355 return $ result ;
4456 }
4557
You can’t perform that action at this time.
0 commit comments