protected function resolveJsonFile(PackageInterface $package, $jsonPath)
    {
        $collectedPatches = new PatchCollection();
        if (!is_string($jsonPath) || $jsonPath === '') {
            $this->handleException(Exception\InvalidPackageConfigurationValue($package(), 'extra.patches-file', $jsonPath, 'The extra.patches-file configuration must be a non empty string.'));
        } else {
            $packageDirectory = $this->installationManager->getInstallPath($package);
            $fullJsonPath = $this->pathResolver->resolve($jsonPath, $packageDirectory);
            $jsonReader = new JsonFile($fullJsonPath, null, $this->io);
            $data = $jsonReader->read();
            if (!is_array($data)) {
                $this->handleException(Exception\InvalidPackageConfigurationValue($package, 'extra.patches-file', $jsonPath, "The JSON file at \"{$jsonPath}\" must contain an array."));
            } elseif (!isset($data['patches'])) {
                $this->handleException(Exception\InvalidPackageConfigurationValue($package, 'extra.patches-file', $jsonPath, "The JSON file at \"{$jsonPath}\" must contain an array with a \"patches\" key."));
            } else {
                $collectedPatches->merge($this->resolveExplicitList($package, $data['patches']));
            }
        }

        return $collectedPatches;
    }