Pinq\Analysis\TypeSystem::getCompositeType PHP Method

getCompositeType() public method

public getCompositeType ( array $types )
$types array
    public function getCompositeType(array $types)
    {
        $types = $this->flattenComposedTypes($types);
        //Remove any redundant types: (\Iterator and \Traversable) becomes \Iterator
        /** @var $types IType[] */
        foreach ($types as $outer => $outerType) {
            foreach ($types as $inner => $innerType) {
                if ($outer !== $inner && $innerType->isParentTypeOf($outerType)) {
                    unset($types[$inner]);
                }
            }
        }
        if (count($types) === 0) {
            return $this->getNativeType(INativeType::TYPE_MIXED);
        } elseif (count($types) === 1) {
            return reset($types);
        }
        ksort($types, SORT_STRING);
        $typeId = TypeId::getComposite(array_keys($types));
        if (!isset($this->compositeTypes[$typeId])) {
            $this->compositeTypes[$typeId] = $this->buildCompositeType($typeId, $types);
        }
        return $this->compositeTypes[$typeId];
    }