File tree 1 file changed +13
-3
lines changed
1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -23,13 +23,23 @@ abstract class CSSBlockList extends CSSList
23
23
/**
24
24
* Gets all `DeclarationBlock` objects recursively, no matter how deeply nested the selectors are.
25
25
*
26
- * @return array<int, DeclarationBlock>
26
+ * @return list< DeclarationBlock>
27
27
*/
28
28
public function getAllDeclarationBlocks (): array
29
29
{
30
- /** @var array<int, DeclarationBlock> $result */
30
+ /** @var list< DeclarationBlock> $result */
31
31
$ result = [];
32
- $ this ->allDeclarationBlocks ($ result );
32
+
33
+ foreach ($ this ->contents as $ directSibling ) {
34
+ if ($ directSibling instanceof DeclarationBlock) {
35
+ $ result [] = $ directSibling ;
36
+ } elseif ($ directSibling instanceof CSSBlockList) {
37
+ foreach ($ directSibling ->getAllDeclarationBlocks () as $ grandchild ) {
38
+ $ result [] = $ grandchild ;
39
+ }
40
+ }
41
+ }
42
+
33
43
return $ result ;
34
44
}
35
45
You can’t perform that action at this time.
0 commit comments