File tree Expand file tree Collapse file tree 1 file changed +3
-7
lines changed Expand file tree Collapse file tree 1 file changed +3
-7
lines changed Original file line number Diff line number Diff line change @@ -104,8 +104,6 @@ public function addRule(Rule $ruleToAdd, ?Rule $sibling = null): void
104
104
$ position = \count ($ this ->rules [$ propertyName ]);
105
105
106
106
if ($ sibling !== null ) {
107
- $ siblingLineNumber = $ sibling ->getLineNumber ();
108
- $ siblingColumnNumber = $ sibling ->getColumnNumber ();
109
107
$ siblingIsInSet = false ;
110
108
$ siblingPosition = \array_search ($ sibling , $ this ->rules [$ propertyName ], true );
111
109
if ($ siblingPosition !== false ) {
@@ -115,17 +113,15 @@ public function addRule(Rule $ruleToAdd, ?Rule $sibling = null): void
115
113
// Maintain ordering within `$this->rules[$propertyName]`
116
114
// by inserting before first `Rule` with a same-or-later position than the sibling.
117
115
foreach ($ this ->rules [$ propertyName ] as $ index => $ rule ) {
118
- if (
119
- $ rule ->getLineNumber () > $ siblingLineNumber ||
120
- $ rule ->getLineNumber () === $ siblingLineNumber &&
121
- $ rule ->getColumnNumber () >= $ siblingColumnNumber
122
- ) {
116
+ if (self ::comparePositionable ($ rule , $ sibling ) >= 0 ) {
123
117
$ position = $ index ;
124
118
break ;
125
119
}
126
120
}
127
121
}
128
122
if ($ siblingIsInSet ) {
123
+ $ siblingLineNumber = $ sibling ->getLineNumber ();
124
+ $ siblingColumnNumber = $ sibling ->getColumnNumber ();
129
125
// Increment column number of all existing rules on same line, starting at sibling
130
126
foreach ($ this ->rules as $ rulesForAProperty ) {
131
127
foreach ($ rulesForAProperty as $ rule ) {
You can’t perform that action at this time.
0 commit comments