We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
::getAllDeclarationBlocks()
1 parent 0bfa3f3 commit e1f8bd3Copy full SHA for e1f8bd3
src/CSSList/CSSBlockList.php
@@ -23,13 +23,20 @@ abstract class CSSBlockList extends CSSList
23
/**
24
* Gets all `DeclarationBlock` objects recursively, no matter how deeply nested the selectors are.
25
*
26
- * @return array<int, DeclarationBlock>
+ * @return list<DeclarationBlock>
27
*/
28
public function getAllDeclarationBlocks(): array
29
{
30
- /** @var array<int, DeclarationBlock> $result */
31
$result = [];
32
- $this->allDeclarationBlocks($result);
+
+ foreach ($this->contents as $item) {
33
+ if ($item instanceof DeclarationBlock) {
34
+ $result[] = $item;
35
+ } elseif ($item instanceof CSSBlockList) {
36
+ $result = \array_merge($result, $item->getAllDeclarationBlocks());
37
+ }
38
39
40
return $result;
41
}
42
0 commit comments