Skip to content

Commit 89788ef

Browse files
committed
Convert switch cases to match expression
1 parent a728bf5 commit 89788ef

File tree

1 file changed

+6
-13
lines changed

1 file changed

+6
-13
lines changed

Console/Descriptor/Descriptor.php

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -44,19 +44,12 @@ public function describe(OutputInterface $output, ?object $object, array $option
4444
{
4545
$this->output = $output instanceof OutputStyle ? $output : new SymfonyStyle(new ArrayInput([]), $output);
4646

47-
switch (true) {
48-
case null === $object:
49-
$this->describeDefaults($options);
50-
break;
51-
case $object instanceof ResolvedFormTypeInterface:
52-
$this->describeResolvedFormType($object, $options);
53-
break;
54-
case $object instanceof OptionsResolver:
55-
$this->describeOption($object, $options);
56-
break;
57-
default:
58-
throw new \InvalidArgumentException(sprintf('Object of type "%s" is not describable.', get_debug_type($object)));
59-
}
47+
match (true) {
48+
null === $object => $this->describeDefaults($options),
49+
$object instanceof ResolvedFormTypeInterface => $this->describeResolvedFormType($object, $options),
50+
$object instanceof OptionsResolver => $this->describeOption($object, $options),
51+
default => throw new \InvalidArgumentException(sprintf('Object of type "%s" is not describable.', get_debug_type($object))),
52+
};
6053
}
6154

6255
abstract protected function describeDefaults(array $options);

0 commit comments

Comments
 (0)