Skip to content

Commit 54ca442

Browse files
authored
[CLEANUP] Refactor CSSBlockList::getAllRuleSets() (#1050)
Also remove the now-unused method `allRuleSets()`. Part of #994.
1 parent a037425 commit 54ca442

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

src/CSSList/CSSBlockList.php

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -57,28 +57,21 @@ protected function allDeclarationBlocks(array &$result): void
5757
/**
5858
* Returns all `RuleSet` objects recursively found in the tree, no matter how deeply nested the rule sets are.
5959
*
60-
* @return array<int, RuleSet>
60+
* @return list<RuleSet>
6161
*/
6262
public function getAllRuleSets(): array
6363
{
64-
/** @var array<int, RuleSet> $result */
6564
$result = [];
66-
$this->allRuleSets($result);
67-
return $result;
68-
}
6965

70-
/**
71-
* @param array<int, RuleSet> $result
72-
*/
73-
protected function allRuleSets(array &$result): void
74-
{
7566
foreach ($this->contents as $item) {
7667
if ($item instanceof RuleSet) {
7768
$result[] = $item;
7869
} elseif ($item instanceof CSSBlockList) {
79-
$item->allRuleSets($result);
70+
$result = \array_merge($result, $item->getAllRuleSets());
8071
}
8172
}
73+
74+
return $result;
8275
}
8376

8477
/**

0 commit comments

Comments
 (0)