Skip to content

Commit

Permalink
FileSystem returns files and directories sorted by name (#23387)
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesggordon authored and taylorotwell committed Mar 5, 2018
1 parent 7e8c844 commit c34164f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Illuminate/Filesystem/Filesystem.php
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ public function glob($pattern, $flags = 0)
public function files($directory, $hidden = false)
{
return iterator_to_array(
Finder::create()->files()->ignoreDotFiles(! $hidden)->in($directory)->depth(0),
Finder::create()->files()->ignoreDotFiles(! $hidden)->in($directory)->depth(0)->sortByName(),
false
);
}
Expand All @@ -402,7 +402,7 @@ public function files($directory, $hidden = false)
public function allFiles($directory, $hidden = false)
{
return iterator_to_array(
Finder::create()->files()->ignoreDotFiles(! $hidden)->in($directory),
Finder::create()->files()->ignoreDotFiles(! $hidden)->in($directory)->sortByName(),
false
);
}
Expand All @@ -417,7 +417,7 @@ public function directories($directory)
{
$directories = [];

foreach (Finder::create()->in($directory)->directories()->depth(0) as $dir) {
foreach (Finder::create()->in($directory)->directories()->depth(0)->sortByName() as $dir) {
$directories[] = $dir->getPathname();
}

Expand Down

0 comments on commit c34164f

Please sign in to comment.