From 20e410f3a2d0abc7447fa83f5d00aa350bfbe518 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Wed, 16 Mar 2022 10:05:07 +0100 Subject: [PATCH] Fix inconsistent parameter names in inheritance trees --- src/Composer/Downloader/FileDownloader.php | 4 ++-- src/Composer/Package/RootAliasPackage.php | 12 ++++++------ src/Composer/Repository/ArrayRepository.php | 6 +++--- src/Composer/Repository/CompositeRepository.php | 4 ++-- src/Composer/Repository/FilterRepository.php | 10 +++++----- 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/Composer/Downloader/FileDownloader.php b/src/Composer/Downloader/FileDownloader.php index 9b5783a16..e6e50a609 100644 --- a/src/Composer/Downloader/FileDownloader.php +++ b/src/Composer/Downloader/FileDownloader.php @@ -476,7 +476,7 @@ class FileDownloader implements DownloaderInterface, ChangeReportInterface * @inheritDoc * @throws \RuntimeException */ - public function getLocalChanges(PackageInterface $package, string $targetDir): ?string + public function getLocalChanges(PackageInterface $package, string $path): ?string { $prevIO = $this->io; @@ -485,7 +485,7 @@ class FileDownloader implements DownloaderInterface, ChangeReportInterface $e = null; $output = ''; - $targetDir = Filesystem::trimTrailingSlash($targetDir); + $targetDir = Filesystem::trimTrailingSlash($path); try { if (is_dir($targetDir.'_compare')) { $this->filesystem->removeDirectory($targetDir.'_compare'); diff --git a/src/Composer/Package/RootAliasPackage.php b/src/Composer/Package/RootAliasPackage.php index eaa71fd11..07b1f38e0 100644 --- a/src/Composer/Package/RootAliasPackage.php +++ b/src/Composer/Package/RootAliasPackage.php @@ -91,21 +91,21 @@ class RootAliasPackage extends CompleteAliasPackage implements RootPackageInterf /** * @inheritDoc */ - public function setRequires(array $require): void + public function setRequires(array $requires): void { - $this->requires = $this->replaceSelfVersionDependencies($require, Link::TYPE_REQUIRE); + $this->requires = $this->replaceSelfVersionDependencies($requires, Link::TYPE_REQUIRE); - $this->aliasOf->setRequires($require); + $this->aliasOf->setRequires($requires); } /** * @inheritDoc */ - public function setDevRequires(array $devRequire): void + public function setDevRequires(array $devRequires): void { - $this->devRequires = $this->replaceSelfVersionDependencies($devRequire, Link::TYPE_DEV_REQUIRE); + $this->devRequires = $this->replaceSelfVersionDependencies($devRequires, Link::TYPE_DEV_REQUIRE); - $this->aliasOf->setDevRequires($devRequire); + $this->aliasOf->setDevRequires($devRequires); } /** diff --git a/src/Composer/Repository/ArrayRepository.php b/src/Composer/Repository/ArrayRepository.php index 0f8e101bd..92de7a614 100644 --- a/src/Composer/Repository/ArrayRepository.php +++ b/src/Composer/Repository/ArrayRepository.php @@ -57,16 +57,16 @@ class ArrayRepository implements RepositoryInterface /** * @inheritDoc */ - public function loadPackages(array $packageMap, array $acceptableStabilities, array $stabilityFlags, array $alreadyLoaded = array()) + public function loadPackages(array $packageNameMap, array $acceptableStabilities, array $stabilityFlags, array $alreadyLoaded = array()) { $packages = $this->getPackages(); $result = array(); $namesFound = array(); foreach ($packages as $package) { - if (array_key_exists($package->getName(), $packageMap)) { + if (array_key_exists($package->getName(), $packageNameMap)) { if ( - (!$packageMap[$package->getName()] || $packageMap[$package->getName()]->matches(new Constraint('==', $package->getVersion()))) + (!$packageNameMap[$package->getName()] || $packageNameMap[$package->getName()]->matches(new Constraint('==', $package->getVersion()))) && StabilityFilter::isPackageAcceptable($acceptableStabilities, $stabilityFlags, $package->getNames(), $package->getStability()) && !isset($alreadyLoaded[$package->getName()][$package->getVersion()]) ) { diff --git a/src/Composer/Repository/CompositeRepository.php b/src/Composer/Repository/CompositeRepository.php index d10815c35..b9a247f0b 100644 --- a/src/Composer/Repository/CompositeRepository.php +++ b/src/Composer/Repository/CompositeRepository.php @@ -105,13 +105,13 @@ class CompositeRepository implements RepositoryInterface /** * @inheritDoc */ - public function loadPackages(array $packageMap, array $acceptableStabilities, array $stabilityFlags, array $alreadyLoaded = array()): array + public function loadPackages(array $packageNameMap, array $acceptableStabilities, array $stabilityFlags, array $alreadyLoaded = array()): array { $packages = array(); $namesFound = array(); foreach ($this->repositories as $repository) { /* @var $repository RepositoryInterface */ - $result = $repository->loadPackages($packageMap, $acceptableStabilities, $stabilityFlags, $alreadyLoaded); + $result = $repository->loadPackages($packageNameMap, $acceptableStabilities, $stabilityFlags, $alreadyLoaded); $packages[] = $result['packages']; $namesFound[] = $result['namesFound']; } diff --git a/src/Composer/Repository/FilterRepository.php b/src/Composer/Repository/FilterRepository.php index 5072e1696..54d63075c 100644 --- a/src/Composer/Repository/FilterRepository.php +++ b/src/Composer/Repository/FilterRepository.php @@ -112,19 +112,19 @@ class FilterRepository implements RepositoryInterface /** * @inheritDoc */ - public function loadPackages(array $packageMap, array $acceptableStabilities, array $stabilityFlags, array $alreadyLoaded = array()): array + public function loadPackages(array $packageNameMap, array $acceptableStabilities, array $stabilityFlags, array $alreadyLoaded = array()): array { - foreach ($packageMap as $name => $constraint) { + foreach ($packageNameMap as $name => $constraint) { if (!$this->isAllowed($name)) { - unset($packageMap[$name]); + unset($packageNameMap[$name]); } } - if (!$packageMap) { + if (!$packageNameMap) { return array('namesFound' => array(), 'packages' => array()); } - $result = $this->repo->loadPackages($packageMap, $acceptableStabilities, $stabilityFlags, $alreadyLoaded); + $result = $this->repo->loadPackages($packageNameMap, $acceptableStabilities, $stabilityFlags, $alreadyLoaded); if (!$this->canonical) { $result['namesFound'] = array(); }