Skip to content

Commit

Permalink
增加一些空判断
Browse files Browse the repository at this point in the history
  • Loading branch information
Yurunsoft committed Nov 1, 2023
1 parent f6d2a2e commit ddbee5a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Visitor/AttributeRewriteVisitor.php
Original file line number Diff line number Diff line change
Expand Up @@ -352,12 +352,12 @@ protected function refactorCommentsProperty(array $comments, array $props): ?str
{
$methodComments[] = '* ' . $meta['comment'];
}
if (empty($prop->type))
if (empty($prop->type) && isset($meta['type']))
{
// 使用文档注解类型
$methodComments[] = "* @var {$meta['type']}";
}
elseif (str_contains($propRawType = $this->generator->getPrinter()->prettyPrint([$prop->type]), 'callable') || str_contains($meta['type'], 'callable'))
elseif (($prop->type && str_contains($propRawType = $this->generator->getPrinter()->prettyPrint([$prop->type]), 'callable')) || str_contains($meta['type'] ?? '', 'callable'))
{
// callable 不能作为属性类型
$propRawType = $propRawType ?: $meta['type'];
Expand Down

0 comments on commit ddbee5a

Please sign in to comment.