Skip to content

Commit 12afb6f

Browse files
committed
fix NullableType and UnionType
1 parent 1aaf057 commit 12afb6f

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"phpstan/phpdoc-parser": "^0.5.5",
1616
"sabre/xml": "~2.2.3",
1717
"symfony/console": "~4.4.0||~5.4.0",
18-
"tomzx/php-semver-checker": "^0.15.0",
18+
"tomzx/php-semver-checker": "^0.16.0",
1919
"wikimedia/less.php": "^3.2"
2020
},
2121
"require-dev": {

src/Analyzer/ClassMethodAnalyzer.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,11 @@ private function getDocReturnDeclaration(ClassMethod $method)
459459
($parsedComment = $method->getAttribute('docCommentParsed'))
460460
&& isset($parsedComment['return'])
461461
) {
462-
$result = implode('|', $parsedComment['return']);
462+
if ($parsedComment['return'][0] instanceof NullableType) {
463+
$result = '?'.$parsedComment['return'][0]->type;
464+
} else {
465+
$result = implode('|', $parsedComment['return']);
466+
}
463467

464468
return $result;
465469
} elseif ($this->dependencyGraph !== null) {

0 commit comments

Comments
 (0)