[CLEANUP] Avoid Hungarian notation in RuleSet#1004
Conversation
|
I'm not sure about the naming at all and would appreciate a critical eye (and suggestions). |
9cf23ca to
51331a3
Compare
JakeQZ
left a comment
There was a problem hiding this comment.
I can only see one improvement on naming. W3C have changed the names of the abstract concepts over time, which has left us with some class names that no longer correspond.
51331a3 to
4a7d4cd
Compare
4a7d4cd to
9dc285e
Compare
JakeQZ
left a comment
There was a problem hiding this comment.
I may have missed some changes in previous review. I've suggested a few more naming improvements.
| /** @var array<int, Rule> $result */ | ||
| $result = []; | ||
| foreach ($this->aRules as $sName => $aRules) { | ||
| foreach ($this->rules as $ruleName => $rule) { |
There was a problem hiding this comment.
Should we use $propertyName here instead of $ruleName?
| * remove all rules with the same name. To get the old behaviour, use `removeRule($rule->getRule())`. | ||
| * | ||
| * @param Rule|string|null $mRule | ||
| * @param Rule|string|null $removalPattern |
There was a problem hiding this comment.
I think I would prefer $searchPattern again here. The rules to be removed still have to be searched for.
| * | ||
| * @param Rule|string|null $mRule | ||
| * @param Rule|string|null $removalPattern | ||
| * pattern to remove. If $mRule is null, all rules are removed. If the pattern ends in a dash, |
There was a problem hiding this comment.
This mentions the parameter by name, and would also need updating. Though could perhaps be modified to avoid being self-referential.
| $sRule = $mRule->getRule(); | ||
| if (!isset($this->aRules[$sRule])) { | ||
| if ($removalPattern instanceof Rule) { | ||
| $removalRule = $removalPattern->getRule(); |
There was a problem hiding this comment.
Maybe $propertyToRemove instead of $removalRule.
|
Updated and repushed. |
7d8c5a4 to
76753c6
Compare
JakeQZ
left a comment
There was a problem hiding this comment.
Might have been better to have this PR in more manageable chunks. But we are where we are, and we are nearly there.
I found one more variable that could be better-renamed.
29f1010 to
5fd54e3
Compare
3fb7d71 to
52846cb
Compare
|
Okay, I'll split this up. |
89d6e59 to
65c893a
Compare
baa7a5c to
a9f99ca
Compare
| $sRule = $ruleToAdd->getRule(); | ||
| if (!isset($this->rules[$sRule])) { | ||
| $this->rules[$sRule] = []; | ||
| $propertyOrRuleName = $ruleToAdd->getRule(); |
There was a problem hiding this comment.
Having looked into how this works and what it does, I now think just $propertyName would be better - see #1051 (review).
e0e8d4a to
163db73
Compare
163db73 to
d568127
Compare
|
All the split-off PRs now are merged, and this PR now is quite small and ready for a re-review. |
JakeQZ
left a comment
There was a problem hiding this comment.
Good rename to avoid a variable having two (slightly different) purposes.
Part of #756