Skip to content

Commit

Permalink
Fix up template var detection.
Browse files Browse the repository at this point in the history
  • Loading branch information
dereuromark committed Jul 25, 2022
1 parent e83623e commit 9da91f8
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/Annotator/Traits/DocBlockTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -179,11 +179,17 @@ protected function containsIterableSyntax(array $docBlockTypes): bool {
* @return string
*/
protected function renderUnionTypes(array $typeNodes): string {
return (string)preg_replace(
$string = (string)preg_replace(
['/ ([\|&]) /', '/<\(/', '/\)>/', '/\), /', '/, \(/'],
['${1}', '<', '>', ', ', ', '],
implode('|', $typeNodes),
);

if (substr($string, 0, 1) === '(' && substr($string, -1, 1) === ')') {
$string = substr($string, 1, -1);
}

return $string;
}

}

0 comments on commit 9da91f8

Please sign in to comment.