Skip to content

Commit df29c37

Browse files
committed
Convert switch cases to match expression
1 parent dedf704 commit df29c37

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

Command/DebugCommand.php

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -101,16 +101,11 @@ protected function execute(InputInterface $input, OutputInterface $output): int
101101
throw new InvalidArgumentException(sprintf('Argument "name" not supported, it requires the Twig loader "%s".', FilesystemLoader::class));
102102
}
103103

104-
switch ($input->getOption('format')) {
105-
case 'text':
106-
$name ? $this->displayPathsText($io, $name) : $this->displayGeneralText($io, $filter);
107-
break;
108-
case 'json':
109-
$name ? $this->displayPathsJson($io, $name) : $this->displayGeneralJson($io, $filter);
110-
break;
111-
default:
112-
throw new InvalidArgumentException(sprintf('The format "%s" is not supported.', $input->getOption('format')));
113-
}
104+
match ($input->getOption('format')) {
105+
'text' => $name ? $this->displayPathsText($io, $name) : $this->displayGeneralText($io, $filter),
106+
'json' => $name ? $this->displayPathsJson($io, $name) : $this->displayGeneralJson($io, $filter),
107+
default => throw new InvalidArgumentException(sprintf('The format "%s" is not supported.', $input->getOption('format'))),
108+
};
114109

115110
return 0;
116111
}

0 commit comments

Comments
 (0)