From be8ef82a50176e0ace6d9e9c9b3f622569738771 Mon Sep 17 00:00:00 2001 From: Christoph Kappestein Date: Fri, 23 Aug 2024 19:59:40 +0200 Subject: [PATCH] fix create attribute instance --- src/Parser/Attribute/Builder.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Parser/Attribute/Builder.php b/src/Parser/Attribute/Builder.php index 973d921..0282015 100644 --- a/src/Parser/Attribute/Builder.php +++ b/src/Parser/Attribute/Builder.php @@ -112,9 +112,9 @@ private function getArguments(string $controllerClass, string $methodName): arra $parameters = $method->getParameters(); $arguments = []; foreach ($parameters as $parameter) { - $pathAttribute = $parameter->getAttributes(Param::class)[0] ?? null; - $headerAttribute = $parameter->getAttributes(Header::class)[0] ?? null; - $queryAttribute = $parameter->getAttributes(Query::class)[0] ?? null; + $pathAttribute = ($parameter->getAttributes(Param::class)[0] ?? null)?->newInstance(); + $headerAttribute = ($parameter->getAttributes(Header::class)[0] ?? null)?->newInstance(); + $queryAttribute = ($parameter->getAttributes(Query::class)[0] ?? null)?->newInstance(); if ($pathAttribute instanceof Param && !empty($pathAttribute->name)) { $arguments[$parameter->getName()] = $pathAttribute->name;