Phan\Language\UnionType::addUnionType PHP Method

addUnionType() public method

Add the given types to this type
public addUnionType ( UnionType $union_type ) : null
$union_type UnionType
return null
    public function addUnionType(UnionType $union_type)
    {
        $this->type_set->addAll($union_type->getTypeSet());
    }

Usage Example

Example #1
0
 public function visitConditional(Node $node) : UnionType
 {
     $union_type = new UnionType();
     // Add the type for the 'true' side
     $union_type->addUnionType(UnionType::fromNode($this->context, $this->code_base, $node->children['trueExpr'] ?? $node->children['true'] ?? ''));
     // Add the type for the 'false' side
     $union_type->addUnionType(UnionType::fromNode($this->context, $this->code_base, $node->children['falseExpr'] ?? $node->children['false'] ?? ''));
     return $union_type;
 }
All Usage Examples Of Phan\Language\UnionType::addUnionType