/** * @return bool * True if and only if this UnionType contains * the given type and no others. */ public function isType(Type $type) : bool { if ($this->typeCount() != 1) { return false; } return $this->type_set->contains($type); }