From 371425f3c5dc8584ecff1d7cc52f90032c2b9acd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torsten=20L=C3=BCcke?= Date: Wed, 15 Dec 2021 19:47:41 +0100 Subject: [PATCH] Bugfix: PHPStan kommt damit nicht klar --- api/tests/unit/Middleware/ErrorHandlerTest.php | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/api/tests/unit/Middleware/ErrorHandlerTest.php b/api/tests/unit/Middleware/ErrorHandlerTest.php index 1c4e9d5..a6b7253 100644 --- a/api/tests/unit/Middleware/ErrorHandlerTest.php +++ b/api/tests/unit/Middleware/ErrorHandlerTest.php @@ -46,13 +46,17 @@ class ErrorHandlerTest extends Unit ]); /** @noinspection PhpFieldAssignmentTypeMismatchInspection */ $this->request = $this->makeEmpty(ServerRequestInterface::class, [ - 'getAttribute' => function($name) { - return match ($name) { - RouteContext::ROUTE_PARSER => $this->makeEmpty(RouteParserInterface::class), - RouteContext::ROUTING_RESULTS => $this->makeEmpty(RoutingResults::class), - default => null, - }; - } + 'getAttribute' => function ($name) { + /** @noinspection PhpSwitchCanBeReplacedWithMatchExpressionInspection */ + switch ($name) { + case RouteContext::ROUTE_PARSER: + return $this->makeEmpty(RouteParserInterface::class); + case RouteContext::ROUTING_RESULTS: + return $this->makeEmpty(RoutingResults::class); + default: + return null; + } + }, ]); }