Only allow platform packages to be overridden.
As defined by the PlatformRepository::PLATFORM_PACKAGE_REGEX pattern.pull/2990/head
parent
571363dee2
commit
ac89a5bb3b
|
@ -41,10 +41,16 @@ class PlatformRepository extends ArrayRepository
|
|||
// Add each of the override versions as options.
|
||||
// Later we might even replace the extensions instead.
|
||||
foreach( $this->overrides as $name => $prettyVersion ) {
|
||||
$version = $versionParser->normalize($prettyVersion);
|
||||
$package = new CompletePackage($name, $version, $prettyVersion);
|
||||
$package->setDescription("Overridden virtual platform package $name.");
|
||||
parent::addPackage($package);
|
||||
// Check that it's a platform package.
|
||||
if( preg_match(self::PLATFORM_PACKAGE_REGEX, $name) ) {
|
||||
$version = $versionParser->normalize($prettyVersion);
|
||||
$package = new CompletePackage($name, $version, $prettyVersion);
|
||||
$package->setDescription("Overridden virtual platform package $name.");
|
||||
parent::addPackage($package);
|
||||
}
|
||||
else {
|
||||
throw new \UnexpectedValueException('Invalid platform package "'.$name);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue