public asExpandedTypes ( |
||
$code_base | ||
$recursion_depth | integer | This thing has a tendency to run-away on me. This tracks how bad I messed up by seeing how far the expanded types go |
return | Expands all class types to all inherited classes returning a superset of this type. |
/** * @param UnionType $target * The type we'd like to see if this type can cast * to * * @param CodeBase $code_base * The code base used to expand types * * @return bool * Test to see if this type can be cast to the * given type after expanding both union types * to include all ancestor types */ public function canCastToExpandedUnionType(UnionType $target, CodeBase $code_base) : bool { $this_expanded = $this->asExpandedTypes($code_base); $target_expanded = $target->asExpandedTypes($code_base); return $this_expanded->canCastToUnionType($target_expanded); }