1
0
Fork 0

Make package name validation a hard failure, fixes #7875

pull/8684/head
Jordi Boggiano 2020-03-10 16:57:34 +01:00
parent c033644f8b
commit 5c4ef1eb96
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
1 changed files with 7 additions and 11 deletions

View File

@ -72,10 +72,8 @@ class RootPackageLoader extends ArrayLoader
{ {
if (!isset($config['name'])) { if (!isset($config['name'])) {
$config['name'] = '__root__'; $config['name'] = '__root__';
} elseif ($this->io) { } elseif ($err = ValidatingArrayLoader::hasPackageNamingError($config['name'])) {
if ($err = ValidatingArrayLoader::hasPackageNamingError($config['name'])) { throw new \RuntimeException('Your package name '.$err);
$this->io->writeError('<warning>Deprecation warning: Your package name '.$err.' Make sure you fix this as Composer 2.0 will error.</warning>');
}
} }
$autoVersioned = false; $autoVersioned = false;
if (!isset($config['version'])) { if (!isset($config['version'])) {
@ -142,13 +140,11 @@ class RootPackageLoader extends ArrayLoader
} }
} }
if ($this->io) {
foreach (array_keys(BasePackage::$supportedLinkTypes) as $linkType) { foreach (array_keys(BasePackage::$supportedLinkTypes) as $linkType) {
if (isset($config[$linkType])) { if (isset($config[$linkType])) {
foreach ($config[$linkType] as $linkName => $constraint) { foreach ($config[$linkType] as $linkName => $constraint) {
if ($err = ValidatingArrayLoader::hasPackageNamingError($linkName, true)) { if ($err = ValidatingArrayLoader::hasPackageNamingError($linkName, true)) {
$this->io->writeError('<warning>Deprecation warning: '.$linkType.'.'.$err.' Make sure you fix this as Composer 2.0 will error.</warning>'); throw new \RuntimeException($linkType.'.'.$err);
}
} }
} }
} }