-
-
Notifications
You must be signed in to change notification settings - Fork 373
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Directories are not shown in strict alphabetical order #941
Comments
Would this help? diff --git a/src/Report/Html/Renderer/Directory.php b/src/Report/Html/Renderer/Directory.php
index 1d7334b3..850f0a53 100644
--- a/src/Report/Html/Renderer/Directory.php
+++ b/src/Report/Html/Renderer/Directory.php
@@ -15,6 +15,7 @@
use SebastianBergmann\CodeCoverage\FileCouldNotBeWrittenException;
use SebastianBergmann\CodeCoverage\Node\AbstractNode as Node;
use SebastianBergmann\CodeCoverage\Node\Directory as DirectoryNode;
+use SebastianBergmann\CodeCoverage\Node\File as FileNode;
use SebastianBergmann\Template\Exception;
use SebastianBergmann\Template\Template;
@@ -32,11 +33,29 @@ public function render(DirectoryNode $node, string $file): void
$items = $this->renderItem($node, true);
- foreach ($node->directories() as $item) {
+ $directories = $node->directories();
+
+ usort(
+ $directories,
+ static function (DirectoryNode $a, DirectoryNode $b) {
+ return $a->name() <=> $b->name();
+ }
+ );
+
+ foreach ($directories as $item) {
$items .= $this->renderItem($item);
}
- foreach ($node->files() as $item) {
+ $files = $node->files();
+
+ usort(
+ $files,
+ static function (FileNode $a, FileNode $b) {
+ return $a->name() <=> $b->name();
+ }
+ );
+
+ foreach ($files as $item) {
$items .= $this->renderItem($item);
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Dirctories should be shown in alphabetical order. In the screenshot,
EntityRepository
comes beforeEntity
but it should be after.The text was updated successfully, but these errors were encountered: