Skip to content

Commit

Permalink
add support parse generic type in docBlock
Browse files Browse the repository at this point in the history
  • Loading branch information
JeRabix committed Apr 13, 2023
1 parent e5e1727 commit 05596d7
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/Barryvdh/Reflection/DocBlock/Tag/ParamTag.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,14 @@ public function setContent($content)
PREG_SPLIT_DELIM_CAPTURE
);

// detect generic type
if (isset($parts[0]) && isset($parts[2]) && strpos($parts[0], '<') !== false && strpos($parts[2], '>') !== false) {
$parts[0] .= ' ' . $parts[2];
unset($parts[1]);
unset($parts[2]);
$parts = array_values($parts);
}

// if the first item that is encountered is not a variable; it is a type
if (isset($parts[0])
&& (strlen($parts[0]) > 0)
Expand Down

0 comments on commit 05596d7

Please sign in to comment.