Skip to content

Commit d4d5756

Browse files
committed
Leverage the match expression
1 parent 926c673 commit d4d5756

File tree

1 file changed

+8
-17
lines changed

1 file changed

+8
-17
lines changed

SymfonyRuntime.php

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -174,24 +174,15 @@ public function getRunner(?object $application): RunnerInterface
174174

175175
protected function getArgument(\ReflectionParameter $parameter, ?string $type): mixed
176176
{
177-
switch ($type) {
178-
case Request::class:
179-
return Request::createFromGlobals();
177+
return match ($type) {
178+
Request::class => Request::createFromGlobals(),
179+
InputInterface::class => $this->getInput(),
180+
OutputInterface::class => $this->output ??= new ConsoleOutput(),
181+
Application::class => $this->console ??= new Application(),
182+
Command::class => $this->command ??= new Command(),
183+
default => parent::getArgument($parameter, $type),
184+
};
180185

181-
case InputInterface::class:
182-
return $this->getInput();
183-
184-
case OutputInterface::class:
185-
return $this->output ??= new ConsoleOutput();
186-
187-
case Application::class:
188-
return $this->console ??= new Application();
189-
190-
case Command::class:
191-
return $this->command ??= new Command();
192-
}
193-
194-
return parent::getArgument($parameter, $type);
195186
}
196187

197188
protected static function register(GenericRuntime $runtime): GenericRuntime

0 commit comments

Comments
 (0)