- Standard Type:
/** @var User */for$usershould returnUser. - Union Type:
/** @var string|int */for$idshould return aUnionTypeofstringandint. - Named Tag:
/** @var Logger $log */for variable$logshould returnLogger. - Name Mismatch:
/** @var Admin $adm */for variable$guestshould returnmixed. (The tag is for a different variable, so it must be ignored). - Multiple Tags: If a DocBlock has
/** @var int $id */and/** @var string $name */, and we are inspecting$name, the function should returnstring. - Fallback: If no DocBlock exists or no matching tag is found, return
mixedusingTypeFactory.createType("mixed").
/** @var int| $id */should returnintinstead ofUnionType.- if a
DocBlockhas/** @var int $id */and/** @var string */, for variable$admit should returnstring. - UnionTypes are always declared without any whitespaces between
type1andtype2:/** @var int | string $id */would be invalid, since it contains a space betweenintand|.