protected function decodeArrayOrVariadicConstructorParamValue(
        ReflectionParameter $constructorParam,
        $constructorParamValue,
        EncodingContext $context
    ) {
        if (!is_array($constructorParamValue)) {
            throw new EncodingException('Value must be an array');
        }

        if (count($constructorParamValue) === 0) {
            return [];
        }

        if ($constructorParam->isVariadic() && $constructorParam->hasType()) {
            $type = $constructorParam->getType() . '[]';

            return $this->encoders->getEncoderForType($type)
                ->decode($constructorParamValue, $type, $context);
        }

        if (is_object($constructorParamValue[0])) {
            $type = get_class($constructorParamValue[0]) . '[]';

            return $this->encoders->getEncoderForType($type)
                ->decode($constructorParamValue, $type, $context);
        }

        $type = gettype($constructorParamValue[0]) . '[]';

        return $this->encoders->getEncoderForType($type)
            ->decode($constructorParamValue, $type, $context);
    }