@@ -114,18 +114,18 @@ public function addRule(Rule $ruleToAdd, ?Rule $sibling = null): void
114114 $ position = \count ($ this ->rules [$ propertyName ]);
115115
116116 if ($ sibling !== null ) {
117- $ iSiblingPos = \array_search ($ sibling , $ this ->rules [$ propertyName ], true );
118- if ($ iSiblingPos !== false ) {
119- $ position = $ iSiblingPos ;
117+ $ siblingPosition = \array_search ($ sibling , $ this ->rules [$ propertyName ], true );
118+ if ($ siblingPosition !== false ) {
119+ $ position = $ siblingPosition ;
120120 $ ruleToAdd ->setPosition ($ sibling ->getLineNo (), $ sibling ->getColNo () - 1 );
121121 }
122122 }
123123 if ($ ruleToAdd ->getLineNo () === 0 && $ ruleToAdd ->getColNo () === 0 ) {
124124 //this node is added manually, give it the next best line
125125 $ rules = $ this ->getRules ();
126- $ pos = \count ($ rules );
127- if ($ pos > 0 ) {
128- $ last = $ rules [$ pos - 1 ];
126+ $ rulesCount = \count ($ rules );
127+ if ($ rulesCount > 0 ) {
128+ $ last = $ rules [$ rulesCount - 1 ];
129129 $ ruleToAdd ->setPosition ($ last ->getLineNo () + 1 , 0 );
130130 }
131131 }
@@ -176,6 +176,7 @@ public function getRules($searchPattern = null)
176176 }
177177 return $ first ->getLineNo () - $ second ->getLineNo ();
178178 });
179+
179180 return $ result ;
180181 }
181182
@@ -234,13 +235,13 @@ public function getRulesAssoc($searchPattern = null)
234235 public function removeRule ($ searchPattern ): void
235236 {
236237 if ($ searchPattern instanceof Rule) {
237- $ propertyName = $ searchPattern ->getRule ();
238- if (!isset ($ this ->rules [$ propertyName ])) {
238+ $ nameOfPropertyToRemove = $ searchPattern ->getRule ();
239+ if (!isset ($ this ->rules [$ nameOfPropertyToRemove ])) {
239240 return ;
240241 }
241- foreach ($ this ->rules [$ propertyName ] as $ key => $ rule ) {
242+ foreach ($ this ->rules [$ nameOfPropertyToRemove ] as $ key => $ rule ) {
242243 if ($ rule === $ searchPattern ) {
243- unset($ this ->rules [$ propertyName ][$ key ]);
244+ unset($ this ->rules [$ nameOfPropertyToRemove ][$ key ]);
244245 }
245246 }
246247 } else {
0 commit comments