Skip to content

Commit 454f436

Browse files
committed
Add handling for native property types
1 parent da911b8 commit 454f436

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

src/Parser/NodeVisitor.php

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -475,6 +475,32 @@ protected function getPropertyReflectionFromParserProperty(PropertyNode $node, P
475475
$property->setShortDesc($comment->getShortDesc());
476476
$property->setLongDesc($comment->getLongDesc());
477477
$property->setSee($this->resolveSee($comment->getTag('see')));
478+
479+
$type = $node->type;
480+
481+
if ($type instanceof IntersectionType) {
482+
$property->setIntersectionType(true);
483+
484+
$typeArr = [];
485+
foreach ($type->types as $type) {
486+
$typeStr = $this->typeToString($type);
487+
$typeArr[] = [$typeStr, false];
488+
}
489+
490+
$property->setHint($this->resolveHint($typeArr));
491+
} else {
492+
$typeStr = $this->typeToString($type);
493+
494+
if (null !== $typeStr) {
495+
$typeArr = [[$typeStr, false]];
496+
497+
if ($type instanceof NullableType) {
498+
$typeArr[] = ['null', false];
499+
}
500+
$property->setHint($this->resolveHint($typeArr));
501+
}
502+
}
503+
478504
if ($errors = $comment->getErrors()) {
479505
$property->setErrors($errors);
480506
} else {

0 commit comments

Comments
 (0)