public static function createFromArray($name, array $data = [])
    {
        $type = parent::createFromArray($name, $data);
        \assert($type instanceof self);
        $type->setPossibleTypes(\explode('|', $type->getType()));
        $type->setType('union');

        if (isset($data['properties'])) {
            $type->setProperties($data['properties']);
        }

        if (isset($data['additionalProperties'])) {
            $type->setAdditionalProperties($data['additionalProperties']);
        }

        return $type;
    }