diff --git a/internal.inc.php b/internal.inc.php index fb56fa1..c1b8e01 100644 --- a/internal.inc.php +++ b/internal.inc.php @@ -291,8 +291,10 @@ function _extract_lines_from_file(string $file_path) : array function _show_bench(array $tasks, int $limit = 5) { - $times = array(); + if(!$tasks) + return; + $times = array(); foreach($tasks as $name => $task) { if($task->hasRun()) @@ -300,7 +302,8 @@ function _show_bench(array $tasks, int $limit = 5) } uasort($times, fn($a, $b) => $b <=> $a); - array_splice($times, $limit); + if(count($times) > $limit) + array_splice($times, $limit); if(!$times) return;