File tree 1 file changed +15
-3
lines changed
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
33
33
/**
34
34
* Gets all `DeclarationBlock` objects recursively, no matter how deeply nested the selectors are.
35
35
*
36
- * @return array<int, DeclarationBlock>
36
+ * @return list< DeclarationBlock>
37
37
*/
38
38
public function getAllDeclarationBlocks (): array
39
39
{
40
- /** @var array<int, DeclarationBlock> $result */
40
+ /** @var list< DeclarationBlock> $result */
41
41
$ 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
+
43
55
return $ result ;
44
56
}
45
57
You can’t perform that action at this time.
0 commit comments