Fix implementation of filterPackages
parent
fd5c5ff6bc
commit
c97b7a9be5
|
@ -185,17 +185,25 @@ class ComposerRepository extends ArrayRepository implements ConfigurableReposito
|
||||||
|
|
||||||
private function filterPackages(array $packages, $constraint = null, $returnFirstMatch = false)
|
private function filterPackages(array $packages, $constraint = null, $returnFirstMatch = false)
|
||||||
{
|
{
|
||||||
$packages = array();
|
if (null === $constraint) {
|
||||||
|
if ($returnFirstMatch) {
|
||||||
|
return reset($packages);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $packages;
|
||||||
|
}
|
||||||
|
|
||||||
|
$filteredPackages = array();
|
||||||
|
|
||||||
foreach ($packages as $package) {
|
foreach ($packages as $package) {
|
||||||
|
|
||||||
$pkgConstraint = new Constraint('==', $package->getVersion());
|
$pkgConstraint = new Constraint('==', $package->getVersion());
|
||||||
if (null === $constraint || $constraint->matches($pkgConstraint)) {
|
|
||||||
|
if ($constraint->matches($pkgConstraint)) {
|
||||||
if ($returnFirstMatch) {
|
if ($returnFirstMatch) {
|
||||||
return $package;
|
return $package;
|
||||||
}
|
}
|
||||||
|
|
||||||
$packages[] = $package;
|
$filteredPackages[] = $package;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -203,7 +211,7 @@ class ComposerRepository extends ArrayRepository implements ConfigurableReposito
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $packages;
|
return $filteredPackages;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getPackages()
|
public function getPackages()
|
||||||
|
|
Loading…
Reference in New Issue