mirror of
https://github.com/nextcloud/server.git
synced 2026-04-20 22:00:39 -04:00
fix(occ): Fix compatibility with PHP<8.2
iterator_to_array cannot take an array parameter prior to 8.2 Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
This commit is contained in:
parent
db16a32ac3
commit
bb94da69a6
1 changed files with 4 additions and 2 deletions
|
|
@ -40,10 +40,12 @@ class Base extends Command implements CompletionAwareInterface {
|
|||
protected function writeArrayInOutputFormat(InputInterface $input, OutputInterface $output, iterable $items, string $prefix = ' - '): void {
|
||||
switch ($input->getOption('output')) {
|
||||
case self::OUTPUT_FORMAT_JSON:
|
||||
$output->writeln(json_encode(iterator_to_array($items)));
|
||||
$items = (is_array($items) ? $items : iterator_to_array($items));
|
||||
$output->writeln(json_encode($items));
|
||||
break;
|
||||
case self::OUTPUT_FORMAT_JSON_PRETTY:
|
||||
$output->writeln(json_encode(iterator_to_array($items), JSON_PRETTY_PRINT));
|
||||
$items = (is_array($items) ? $items : iterator_to_array($items));
|
||||
$output->writeln(json_encode($items, JSON_PRETTY_PRINT));
|
||||
break;
|
||||
default:
|
||||
foreach ($items as $key => $item) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue