array_splice possible fix
Publish PHP Package / docker (push) Successful in 6s
Details
Publish PHP Package / docker (push) Successful in 6s
Details
This commit is contained in:
parent
54cd3576d7
commit
058ab92420
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue