Skip to content

Commit 4a7e38c

Browse files
committed
Changes suggested in code review
1 parent 83ec454 commit 4a7e38c

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

src/CSSList/CSSBlockList.php

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,13 @@ abstract class CSSBlockList extends CSSList
2727
*/
2828
public function getAllDeclarationBlocks(): array
2929
{
30-
/** @var list<DeclarationBlock> $result */
3130
$result = [];
3231

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-
}
32+
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());
4037
}
4138
}
4239

0 commit comments

Comments
 (0)