protected virtual TypeSymbol BuildReturnType(Signature signature, TypeRef tref, PHPDocBlock phpdocOpt, TypeRefMask rtype)
{
if (signature.AliasReturn)
{
return DeclaringCompilation.CoreTypes.PhpAlias;
}
// PHP7 return type
if (tref != null)
{
return DeclaringCompilation.GetTypeFromTypeRef(tref);
}
//
var typeCtx = this.TypeRefContext;
//
if (phpdocOpt != null)
{
var returnTag = phpdocOpt.Returns;
if (returnTag != null && returnTag.TypeNames.Length != 0)
{
var tmask = PHPDoc.GetTypeMask(typeCtx, returnTag.TypeNamesArray, this.GetNamingContext());
if (!tmask.IsVoid && !tmask.IsAnyType)
{
return DeclaringCompilation.GetTypeFromTypeRef(typeCtx, tmask);
}
}
}
//
return DeclaringCompilation.GetTypeFromTypeRef(typeCtx, rtype);
}