@@ -62,24 +62,44 @@ protected function allRuleSets(array &$aResult)
6262 /**
6363 * Returns all `Value` objects found recursively in `Rule`s in the tree.
6464 *
65- * @param CSSElement|string $element
66- * the `CSSList` or `RuleSet` to start the search from (defaults to the whole document).
67- * If a string is given, it is used as rule name filter.
65+ * @param CSSElement|string|null $element
66+ * This is the `CSSList` or `RuleSet` to start the search from (defaults to the whole document).
67+ * If a string is given, it is used as a rule name filter.
68+ * Passing a string for this parameter is deprecated in version 8.9.0, and will not work from v9.0;
69+ * use the following parameter to pass a rule name filter instead.
70+ * @param string|bool|null $ruleSearchPatternOrSearchInFunctionArguments
71+ * This allows filtering rules by property name
72+ * (e.g. if "color" is passed, only `Value`s from `color` properties will be returned,
73+ * or if "font-" is provided, `Value`s from all font rules, like `font-size`, and including `font` itself,
74+ * will be returned).
75+ * If a Boolean is provided, it is treated as the `$searchInFunctionArguments` argument.
76+ * Passing a Boolean for this parameter is deprecated in version 8.9.0, and will not work from v9.0;
77+ * use the `$searchInFunctionArguments` parameter instead.
6878 * @param bool $searchInFunctionArguments whether to also return Value objects used as Function arguments.
6979 *
7080 * @return array<int, Value>
7181 *
7282 * @see RuleSet->getRules()
7383 */
74- public function getAllValues ($ element = null , $ searchInFunctionArguments = false )
75- {
76- $ searchString = null ;
84+ public function getAllValues (
85+ $ element = null ,
86+ $ ruleSearchPatternOrSearchInFunctionArguments = null ,
87+ $ searchInFunctionArguments = false
88+ ) {
89+ if (\is_bool ($ ruleSearchPatternOrSearchInFunctionArguments )) {
90+ $ searchInFunctionArguments = $ ruleSearchPatternOrSearchInFunctionArguments ;
91+ $ searchString = null ;
92+ } else {
93+ $ searchString = $ ruleSearchPatternOrSearchInFunctionArguments ;
94+ }
95+
7796 if ($ element === null ) {
7897 $ element = $ this ;
7998 } elseif (\is_string ($ element )) {
8099 $ searchString = $ element ;
81100 $ element = $ this ;
82101 }
102+
83103 $ result = [];
84104 $ this ->allValues ($ element , $ result , $ searchString , $ searchInFunctionArguments );
85105 return $ result ;
0 commit comments