Skip to content

Commit

Permalink
fix create attribute instance
Browse files Browse the repository at this point in the history
  • Loading branch information
chriskapp committed Aug 23, 2024
1 parent 0cc5c8a commit be8ef82
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Parser/Attribute/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit be8ef82

Please sign in to comment.