Sort models found in file system (#982)

Ensures they're always ordered / processed independent of the
environment. `ClassMapGenerator::createMap` uses symfony/finder which
itself supports sorting but this isn't used from the `ClassMapGenerator`.

Fixes https://github.com/barryvdh/laravel-ide-helper/issues/885
This commit is contained in:
Markus Podar
2020-06-28 11:21:36 +02:00
committed by GitHub
parent 9562bf59d9
commit f3d841c0a3
+6 -1
View File
@@ -276,7 +276,12 @@ class ModelsCommand extends Command
$dirs = glob($dir, GLOB_ONLYDIR);
foreach ($dirs as $dir) {
if (file_exists($dir)) {
foreach (ClassMapGenerator::createMap($dir) as $model => $path) {
$classMap = ClassMapGenerator::createMap($dir);
// Sort list so it's stable across different environments
ksort($classMap);
foreach ($classMap as $model => $path) {
$models[] = $model;
}
}