File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Expand file tree Collapse file tree 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
2323 /**
2424 * Gets all `DeclarationBlock` objects recursively, no matter how deeply nested the selectors are.
2525 *
26- * @return array<int, DeclarationBlock>
26+ * @return list< DeclarationBlock>
2727 */
2828 public function getAllDeclarationBlocks (): array
2929 {
30- /** @var array<int, DeclarationBlock> $result */
30+ /** @var list< DeclarationBlock> $result */
3131 $ 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+
3343 return $ result ;
3444 }
3545
You can’t perform that action at this time.
0 commit comments