1
0
Fork 0

Throw when repo consistency is in question

pull/9925/head
Jordi Boggiano 2021-05-26 14:01:04 +02:00
parent 0dce0f80f1
commit c8de960018
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
1 changed files with 7 additions and 0 deletions

View File

@ -889,6 +889,13 @@ EOT
// Check for similar names/typos
$similar = $this->findSimilar($name);
if ($similar) {
if (in_array($name, $similar, true)) {
throw new \InvalidArgumentException(sprintf(
"Could not find package %s. It was however found via repository search, which indicates a consistency issue with the repository.",
$name
));
}
throw new \InvalidArgumentException(sprintf(
"Could not find package %s.\n\nDid you mean " . (count($similar) > 1 ? 'one of these' : 'this') . "?\n %s",
$name,