make RectorsFinder return consistent order by shorter names

This commit is contained in:
Tomas Votruba 2019-06-02 10:45:37 +03:00
parent 4e6d1610ca
commit 4049b579c4
2 changed files with 3901 additions and 3893 deletions

File diff suppressed because it is too large Load Diff

View File

@ -3,6 +3,7 @@
namespace Rector\ContributorTools\Finder;
use Nette\Loaders\RobotLoader;
use Nette\Utils\Strings;
use Rector\Contract\Rector\RectorInterface;
use Rector\Error\ExceptionCorrector;
use Rector\Exception\ShouldNotHappenException;
@ -69,6 +70,13 @@ final class RectorsFinder
$rectors[] = $rector;
}
usort($rectors, function (RectorInterface $firstRector, RectorInterface $secondRector): int {
$firstRectorShortClass = Strings::after(get_class($firstRector), '\\', -1);
$secondRectorShortClass = Strings::after(get_class($secondRector), '\\', -1);
return $firstRectorShortClass <=> $secondRectorShortClass;
});
return $rectors;
}
}