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
104104 $ position = \count ($ this ->rules [$ propertyName ]);
105105
106106 if ($ sibling !== null ) {
107- $ siblingLineNumber = $ sibling ->getLineNumber ();
108- $ siblingColumnNumber = $ sibling ->getColumnNumber ();
109107 $ siblingIsInSet = false ;
110108 $ siblingPosition = \array_search ($ sibling , $ this ->rules [$ propertyName ], true );
111109 if ($ siblingPosition !== false ) {
@@ -115,18 +113,16 @@ public function addRule(Rule $ruleToAdd, ?Rule $sibling = null): void
115113 // Maintain ordering within `$this->rules[$propertyName]`
116114 // by inserting before first `Rule` with a same-or-later position than the sibling.
117115 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 ) {
123117 $ position = $ index ;
124118 break ;
125119 }
126120 }
127121 }
128122 if ($ siblingIsInSet ) {
129123 // Increment column number of all existing rules on same line, starting at sibling
124+ $ siblingLineNumber = $ sibling ->getLineNumber ();
125+ $ siblingColumnNumber = $ sibling ->getColumnNumber ();
130126 foreach ($ this ->rules as $ rulesForAProperty ) {
131127 foreach ($ rulesForAProperty as $ rule ) {
132128 if (
You can’t perform that action at this time.
0 commit comments