Entirely remove whatProvides from Composer repository
parent
090711b21c
commit
b99c03ea04
|
@ -99,7 +99,6 @@ class Pool
|
|||
if ($repo instanceof ComposerRepository && $repo->hasProviders()) {
|
||||
$this->providerRepos[] = $repo;
|
||||
$repo->setRootAliases($rootAliases);
|
||||
$repo->resetPackageIds();
|
||||
} else {
|
||||
foreach ($repo->getPackages() as $package) {
|
||||
$this->loadPackage($package, $rootAliases, $exempt);
|
||||
|
@ -222,26 +221,13 @@ class Pool
|
|||
private function computeWhatProvides($name, $constraint, $mustMatchName = false)
|
||||
{
|
||||
$candidates = array();
|
||||
/*
|
||||
foreach ($this->providerRepos as $repo) {
|
||||
foreach ($repo->whatProvides($this, $name) as $candidate) {
|
||||
$candidates[] = $candidate;
|
||||
if ($candidate->id < 1) {
|
||||
$candidate->setId($this->id++);
|
||||
$this->packages[$this->id - 2] = $candidate;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
if ($mustMatchName) {
|
||||
$candidates = array_filter($candidates, function ($candidate) use ($name) {
|
||||
return $candidate->getName() == $name;
|
||||
});
|
||||
if (isset($this->packageByExactName[$name])) {
|
||||
$candidates = array_merge($candidates, $this->packageByExactName[$name]);
|
||||
$candidates = $this->packageByExactName[$name];
|
||||
}
|
||||
} elseif (isset($this->packageByName[$name])) {
|
||||
$candidates = array_merge($candidates, $this->packageByName[$name]);
|
||||
$candidates = $this->packageByName[$name];
|
||||
}
|
||||
|
||||
$matches = $provideMatches = array();
|
||||
|
|
|
@ -135,7 +135,7 @@ class ComposerRepository extends ArrayRepository
|
|||
return $loadedPackages;
|
||||
}
|
||||
|
||||
protected function loadName($name, $acceptableCallback)
|
||||
protected function loadName($name, $acceptableCallback, $exactMatch = true)
|
||||
{
|
||||
// skip platform packages
|
||||
if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $name) || '__root__' === $name) {
|
||||
|
@ -180,25 +180,22 @@ class ComposerRepository extends ArrayRepository
|
|||
$loadedPackages = array();
|
||||
foreach ($packages['packages'] as $versions) {
|
||||
foreach ($versions as $version) {
|
||||
if ($version['name'] !== $name) {
|
||||
if ($exactMatch && $version['name'] !== $name) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!$acceptableCallback(strtolower($version['name']), VersionParser::parseStability($version['version']))) {
|
||||
if ($acceptableCallback && !$acceptableCallback(strtolower($version['name']), VersionParser::parseStability($version['version']))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// load acceptable packages in the providers
|
||||
$package = $this->createPackage($version, 'Composer\Package\Package');
|
||||
$package->setRepository($this);
|
||||
$this->addPackage($package);
|
||||
|
||||
$loadedPackages[] = $package;
|
||||
|
||||
if ($package instanceof AliasPackage) {
|
||||
$aliased = $package->getAliasOf();
|
||||
$aliased->setRepository($this);
|
||||
|
||||
$loadedPackages[] = $aliased;
|
||||
$loadedPackages[] = $package->getAliasOf();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -221,7 +218,7 @@ class ComposerRepository extends ArrayRepository
|
|||
|
||||
foreach ($this->getProviderNames() as $providerName) {
|
||||
if ($name === $providerName) {
|
||||
$packages = $this->whatProvides(new Pool('dev'), $providerName);
|
||||
$packages = $this->loadName($providerName, null, false);
|
||||
foreach ($packages as $package) {
|
||||
if ($name == $package->getName() && $version === $package->getVersion()) {
|
||||
return $package;
|
||||
|
@ -252,7 +249,7 @@ class ComposerRepository extends ArrayRepository
|
|||
|
||||
foreach ($this->getProviderNames() as $providerName) {
|
||||
if ($name === $providerName) {
|
||||
$packages = $this->whatProvides(new Pool('dev'), $providerName);
|
||||
$packages = $this->loadName($providerName, null, false);
|
||||
foreach ($packages as $package) {
|
||||
if ($name == $package->getName() && (null === $version || $version === $package->getVersion())) {
|
||||
$packages[] = $package;
|
||||
|
@ -350,11 +347,6 @@ class ComposerRepository extends ArrayRepository
|
|||
return $this->hasProviders;
|
||||
}
|
||||
|
||||
public function whatProvides(Pool $pool, $name)
|
||||
{
|
||||
throw new \RuntimeException("Runtime repository provider calculation no longer occurs");
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue