File tree Expand file tree Collapse file tree 1 file changed +12
-6
lines changed
Expand file tree Collapse file tree 1 file changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -173,12 +173,7 @@ public function getRules(?string $searchPattern = null): array
173173 $ result = \array_merge ($ result , $ rules );
174174 }
175175 }
176- \usort ($ result , static function (Rule $ first , Rule $ second ): int {
177- if ($ first ->getLineNo () === $ second ->getLineNo ()) {
178- return $ first ->getColNo () - $ second ->getColNo ();
179- }
180- return $ first ->getLineNo () - $ second ->getLineNo ();
181- });
176+ \usort ($ result , [self ::class, 'comparePositionable ' ]);
182177
183178 return $ result ;
184179 }
@@ -299,4 +294,15 @@ protected function renderRules(OutputFormat $outputFormat): string
299294
300295 return $ formatter ->removeLastSemicolon ($ result );
301296 }
297+
298+ /**
299+ * @return int negative if `$first` is before `$second`; zero if they have the same position; positive otherwise
300+ */
301+ private static function comparePositionable (Positionable $ first , Positionable $ second ): int
302+ {
303+ if ($ first ->getLineNo () === $ second ->getLineNo ()) {
304+ return $ first ->getColNo () - $ second ->getColNo ();
305+ }
306+ return $ first ->getLineNo () - $ second ->getLineNo ();
307+ }
302308}
You can’t perform that action at this time.
0 commit comments