array_splice possible fix
Publish PHP Package / docker (push) Successful in 6s Details

This commit is contained in:
Pavel Shevaev 2025-04-28 14:28:28 +03:00
parent 54cd3576d7
commit 058ab92420
1 changed files with 5 additions and 2 deletions

View File

@ -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;