@@ -32,8 +32,8 @@ class RuleSet implements CSSElement, CSSListItem, Positionable, RuleContainer
3232 use Position;
3333
3434 /**
35- * the rules in this rule set, using the property name as the key,
36- * with potentially multiple rules per property name.
35+ * the declarations in this rule set, using the property name as the key,
36+ * with potentially multiple declarations per property name.
3737 *
3838 * @var array<string, array<int<0, max>, Declaration>>
3939 */
@@ -171,16 +171,16 @@ public function addRule(Declaration $declarationToAdd, ?Declaration $sibling = n
171171 }
172172
173173 /**
174- * Returns all rules matching the given rule name
174+ * Returns all declarations matching the given property name
175175 *
176176 * @example $ruleSet->getRules('font') // returns array(0 => $declaration, …) or array().
177177 *
178178 * @example $ruleSet->getRules('font-')
179- * //returns an array of all rules either beginning with font- or matching font.
179+ * //returns an array of all declarations either beginning with font- or matching font.
180180 *
181181 * @param string|null $searchPattern
182- * Pattern to search for. If null, returns all rules .
183- * If the pattern ends with a dash, all rules starting with the pattern are returned
182+ * Pattern to search for. If null, returns all declarations .
183+ * If the pattern ends with a dash, all declarations starting with the pattern are returned
184184 * as well as one matching the pattern with the dash excluded.
185185 *
186186 * @return array<int<0, max>, Declaration>
@@ -189,8 +189,10 @@ public function getRules(?string $searchPattern = null): array
189189 {
190190 $ result = [];
191191 foreach ($ this ->declarations as $ propertyName => $ declarations ) {
192- // Either no search rule is given or the search rule matches the found rule exactly
193- // or the search rule ends in “-” and the found rule starts with the search rule.
192+ // Either no search pattern was given
193+ // or the search pattern matches the found declaration's property name exactly
194+ // or the search pattern ends in “-”
195+ // ... and the found declaration's property name starts with the search pattern
194196 if (
195197 $ searchPattern === null || $ propertyName === $ searchPattern
196198 || (
@@ -208,9 +210,9 @@ public function getRules(?string $searchPattern = null): array
208210 }
209211
210212 /**
211- * Overrides all the rules of this set.
213+ * Overrides all the declarations of this set.
212214 *
213- * @param array<Declaration> $declarations The rules to override with.
215+ * @param array<Declaration> $declarations
214216 */
215217 public function setRules (array $ declarations ): void
216218 {
@@ -221,16 +223,17 @@ public function setRules(array $declarations): void
221223 }
222224
223225 /**
224- * Returns all rules matching the given pattern and returns them in an associative array with the rule’s name
225- * as keys. This method exists mainly for backwards-compatibility and is really only partially useful.
226+ * Returns all declarations with property names matching the given pattern and returns them in an associative array
227+ * with the property names as keys.
228+ * This method exists mainly for backwards-compatibility and is really only partially useful.
226229 *
227230 * Note: This method loses some information: Calling this (with an argument of `background-`) on a declaration block
228231 * like `{ background-color: green; background-color; rgba(0, 127, 0, 0.7); }` will only yield an associative array
229- * containing the rgba-valued rule while `getRules ()` would yield an indexed array containing both.
232+ * containing the rgba-valued declaration while `getDeclarations ()` would yield an indexed array containing both.
230233 *
231234 * @param string|null $searchPattern
232- * Pattern to search for. If null, returns all rules . If the pattern ends with a dash,
233- * all rules starting with the pattern are returned as well as one matching the pattern with the dash
235+ * Pattern to search for. If null, returns all declarations . If the pattern ends with a dash,
236+ * all declarations starting with the pattern are returned as well as one matching the pattern with the dash
234237 * excluded.
235238 *
236239 * @return array<string, Declaration>
@@ -263,20 +266,20 @@ public function removeRule(Declaration $declarationToRemove): void
263266 }
264267
265268 /**
266- * Removes rules by property name or search pattern.
269+ * Removes declarations by property name or search pattern.
267270 *
268271 * @param string $searchPattern
269272 * pattern to remove.
270273 * If the pattern ends in a dash,
271- * all rules starting with the pattern are removed as well as one matching the pattern with the dash
274+ * all declarations starting with the pattern are removed as well as one matching the pattern with the dash
272275 * excluded.
273276 */
274277 public function removeMatchingRules (string $ searchPattern ): void
275278 {
276279 foreach ($ this ->declarations as $ propertyName => $ declarations ) {
277- // Either the search rule matches the found rule exactly
278- // or the search rule ends in “-” and the found rule starts with the search rule or equals it
279- // (without the trailing dash).
280+ // Either the search pattern matches the found declaration's property name exactly
281+ // or the search pattern ends in “-” and the found declaration's property name starts with the search
282+ // pattern or equals it (without the trailing dash).
280283 if (
281284 $ propertyName === $ searchPattern
282285 || (\strrpos ($ searchPattern , '- ' ) === \strlen ($ searchPattern ) - \strlen ('- ' )
0 commit comments