1
0
Fork 0

Add warning if constraint appears too narrow, refs #10943

pull/10985/head
Jordi Boggiano 2022-07-17 10:29:56 +02:00
parent 93eb19e756
commit 740af2bdb1
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
1 changed files with 4 additions and 0 deletions

View File

@ -530,6 +530,10 @@ EOT
$io = $this->getIO(); $io = $this->getIO();
foreach ($requires as $requirement) { foreach ($requires as $requirement) {
if (isset($requirement['version']) && Preg::isMatch('{^\d+(\.\d+)?$}', $requirement['version'])) {
$io->writeError('<warning>The "'.$requirement['version'].'" constraint for "'.$requirement['name'].'" appears too strict and will likely not match what you want. See https://getcomposer.org/constraints');
}
if (!isset($requirement['version'])) { if (!isset($requirement['version'])) {
// determine the best version automatically // determine the best version automatically
list($name, $version) = $this->findBestVersionAndNameForPackage($input, $requirement['name'], $platformRepo, $preferredStability, null, null, $fixed); list($name, $version) = $this->findBestVersionAndNameForPackage($input, $requirement['name'], $platformRepo, $preferredStability, null, null, $fixed);