1
0
Fork 0
mirror of https://github.com/composer/composer synced 2025-05-10 09:02:59 +00:00

Fix phpstan issues

This commit is contained in:
Jordi Boggiano 2020-04-07 14:40:51 +02:00
parent 7b273e2e25
commit 80505e745e
No known key found for this signature in database
GPG key ID: 7BBD42C429EC80BC
10 changed files with 22 additions and 12 deletions

View file

@ -86,6 +86,7 @@ EOT
if ($candidates) {
$reqResults = array();
foreach ($candidates as $candidate) {
$candidateConstraint = null;
if ($candidate->getName() === $require) {
$candidateConstraint = new Constraint('=', $candidate->getVersion());
$candidateConstraint->setPrettyString($candidate->getPrettyVersion());
@ -98,6 +99,11 @@ EOT
}
}
// safety check for phpstan, but it should not be possible to get a candidate out of findPackagesWithReplacersAndProviders without a constraint matching $require
if (!$candidateConstraint) {
continue;
}
foreach ($links as $link) {
if (!$link->getConstraint()->matches($candidateConstraint)) {
$reqResults[] = array(