Skip to content

Commit

Permalink
array parser fix
Browse files Browse the repository at this point in the history
  • Loading branch information
dturopoli committed Apr 28, 2024
1 parent 3d927ae commit a173d1d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
3 changes: 3 additions & 0 deletions src/Model/Doc/Request/RequestDoc.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ class RequestDoc
/** @var mixed[] */
private array $requestBody = [];

/**
* @return ComponentSchemaDoc[]
*/
public function getComponentSchemaDocs(): array
{
return $this->componentSchemaDocs;
Expand Down
14 changes: 4 additions & 10 deletions src/Service/DocBlockParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ public function parseDocBlock(string $docBlock, ?string $parameterName = null):
$parsedDocBlock = $this->phpDocParser->parse($tokens);

foreach ($parsedDocBlock->children as $docBlockItem) {
$docBlockParamName = $parameterName;

if ($docBlockItem->value instanceof ParamTagValueNode) {
$docBlockParamName = ltrim($docBlockItem->value->parameterName, '$');
}
Expand All @@ -48,17 +50,9 @@ public function parseDocBlock(string $docBlock, ?string $parameterName = null):
$docBlockParamName = ltrim($docBlockItem->value->variableName, '$');
}

if (
(
!isset($docBlockParamName)
|| $docBlockParamName === ''
)
&& $parameterName !== null
) {
$docBlockParamName = $parameterName;
if (isset($docBlockParamName) && $docBlockParamName !== '') {
$docBlockData[$docBlockParamName] = $docBlockItem;
}

$docBlockData[$docBlockParamName] = $docBlockItem;
}

return $docBlockData;
Expand Down

0 comments on commit a173d1d

Please sign in to comment.