Skip to content

Commit

Permalink
[ci-review] Rector Rectify
Browse files Browse the repository at this point in the history
  • Loading branch information
rector-bot committed Jan 29, 2021
1 parent 28f6993 commit 379cf74
Showing 1 changed file with 19 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,24 +77,10 @@ private function resolveStringParameters(array $parameterReflections): array
return $stringParameters;
}

private function resolveIdentifierTypeNode(
IdentifierTypeNode $identifierTypeNode,
TemplateTypeMap $templateTypeMap,
TypeNode $fallbackTypeNode
private function resolveReturnTagTypeNode(
ReturnTagValueNode $returnTagValueNode,
TemplateTypeMap $templateTypeMap
): TypeNode {
$typeName = $identifierTypeNode->name;
$genericType = $templateTypeMap->getType($typeName);

if ($genericType instanceof Type) {
$returnTagType = $genericType;
return $this->staticTypeMapper->mapPHPStanTypeToPHPStanPhpDocTypeNode($returnTagType);
}

return $fallbackTypeNode;
}

private function resolveReturnTagTypeNode(ReturnTagValueNode $returnTagValueNode, TemplateTypeMap $templateTypeMap)
{
$returnTagTypeNode = $returnTagValueNode->type;

if ($returnTagValueNode->type instanceof UnionTypeNode) {
Expand Down Expand Up @@ -127,4 +113,20 @@ private function resolveReturnTagTypeNode(ReturnTagValueNode $returnTagValueNode
}
return $returnTagTypeNode;
}

private function resolveIdentifierTypeNode(
IdentifierTypeNode $identifierTypeNode,
TemplateTypeMap $templateTypeMap,
TypeNode $fallbackTypeNode
): TypeNode {
$typeName = $identifierTypeNode->name;
$genericType = $templateTypeMap->getType($typeName);

if ($genericType instanceof Type) {
$returnTagType = $genericType;
return $this->staticTypeMapper->mapPHPStanTypeToPHPStanPhpDocTypeNode($returnTagType);
}

return $fallbackTypeNode;
}
}

0 comments on commit 379cf74

Please sign in to comment.