Skip to content

Commit 3fb7d71

Browse files
committed
More renaming
1 parent f60f089 commit 3fb7d71

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

src/RuleSet/RuleSet.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
abstract class RuleSet implements Renderable, Commentable
2626
{
2727
/**
28-
* the rules in this rule set, using the property name as the key
28+
* the rules in this rule set, using the property or rule name as the key
2929
*
3030
* @var array<string, Rule>
3131
*/
@@ -105,15 +105,15 @@ public function getLineNo(): int
105105

106106
public function addRule(Rule $ruleToAdd, ?Rule $sibling = null): void
107107
{
108-
$propertyName = $ruleToAdd->getRule();
109-
if (!isset($this->rules[$propertyName])) {
110-
$this->rules[$propertyName] = [];
108+
$propertyOrRuleName = $ruleToAdd->getRule();
109+
if (!isset($this->rules[$propertyOrRuleName])) {
110+
$this->rules[$propertyOrRuleName] = [];
111111
}
112112

113-
$position = \count($this->rules[$propertyName]);
113+
$position = \count($this->rules[$propertyOrRuleName]);
114114

115115
if ($sibling !== null) {
116-
$siblingPosition = \array_search($sibling, $this->rules[$propertyName], true);
116+
$siblingPosition = \array_search($sibling, $this->rules[$propertyOrRuleName], true);
117117
if ($siblingPosition !== false) {
118118
$position = $siblingPosition;
119119
$ruleToAdd->setPosition($sibling->getLineNo(), $sibling->getColNo() - 1);
@@ -129,7 +129,7 @@ public function addRule(Rule $ruleToAdd, ?Rule $sibling = null): void
129129
}
130130
}
131131

132-
\array_splice($this->rules[$propertyName], $position, 0, [$ruleToAdd]);
132+
\array_splice($this->rules[$propertyOrRuleName], $position, 0, [$ruleToAdd]);
133133
}
134134

135135
/**
@@ -155,15 +155,15 @@ public function getRules($searchPattern = null)
155155
}
156156
/** @var array<int, Rule> $result */
157157
$result = [];
158-
foreach ($this->rules as $propertyName => $rule) {
158+
foreach ($this->rules as $propertyOrRuleName => $rule) {
159159
// Either no search rule is given or the search rule matches the found rule exactly
160160
// or the search rule ends in “-” and the found rule starts with the search rule.
161161
if (
162-
!$searchPattern || $propertyName === $searchPattern
162+
!$searchPattern || $propertyOrRuleName === $searchPattern
163163
|| (
164164
\strrpos($searchPattern, '-') === \strlen($searchPattern) - \strlen('-')
165-
&& (\strpos($propertyName, $searchPattern) === 0
166-
|| $propertyName === \substr($searchPattern, 0, -1))
165+
&& (\strpos($propertyOrRuleName, $searchPattern) === 0
166+
|| $propertyOrRuleName === \substr($searchPattern, 0, -1))
167167
)
168168
) {
169169
$result = \array_merge($result, $rule);

0 commit comments

Comments
 (0)