for ($i = 0, $length = count($instructions); $i < $length; $i++) {
$instruction = $instructions[$i];
if (!PackageValidationManager::getInstance()->validatePackageInstallationPluginInstruction($this->archive, $instruction['pip'], $instruction['value'])) {
+ $defaultFilename = PackageValidationManager::getInstance()->getDefaultFilenameForPackageInstallationPlugin($instruction['pip']);
+
throw new PackageValidationException(PackageValidationException::MISSING_INSTRUCTION_FILE, [
'pip' => $instruction['pip'],
'type' => $type,
- 'value' => $instruction['value']
+ 'value' => $instruction['value'] ?: $defaultFilename
]);
}
}
return true;
}
+
+ /**
+ * Returns the default filename for the given pip name. If no default filename
+ * exists `null` is returned.
+ *
+ * @param string $pip
+ * @return string|null
+ * @since 3.1
+ */
+ public function getDefaultFilenameForPackageInstallationPlugin($pip) {
+ if (isset($this->packageInstallationPlugins[$pip])) {
+ return call_user_func([$this->packageInstallationPlugins[$pip], 'getDefaultFilename']);
+ }
+
+ return null;
+ }
}