1
0
Fork 0

Merge pull request #4324 from MalteWunsch/getCanonicalPackages-with-different-versions

Improve documentation for WritableRepositoryInterface::getCanonicalPackages
pull/4345/head
Jordi Boggiano 2015-08-09 17:36:21 +01:00
commit bd23ce672a
3 changed files with 4 additions and 3 deletions

View File

@ -26,6 +26,7 @@ use Composer\Package\LinkConstraint\VersionConstraint;
*/ */
class ArrayRepository implements RepositoryInterface class ArrayRepository implements RepositoryInterface
{ {
/** @var PackageInterface[] */
protected $packages; protected $packages;
public function __construct(array $packages = array()) public function __construct(array $packages = array())

View File

@ -42,7 +42,7 @@ class WritableArrayRepository extends ArrayRepository implements WritableReposit
{ {
$packages = $this->getPackages(); $packages = $this->getPackages();
// get at most one package of each name, prefering non-aliased ones // get at most one package of each name, preferring non-aliased ones
$packagesByName = array(); $packagesByName = array();
foreach ($packages as $package) { foreach ($packages as $package) {
if (!isset($packagesByName[$package->getName()]) || $packagesByName[$package->getName()] instanceof AliasPackage) { if (!isset($packagesByName[$package->getName()]) || $packagesByName[$package->getName()] instanceof AliasPackage) {

View File

@ -41,14 +41,14 @@ interface WritableRepositoryInterface extends RepositoryInterface
public function removePackage(PackageInterface $package); public function removePackage(PackageInterface $package);
/** /**
* Get unique packages, with aliases resolved and removed * Get unique packages (at most one package of each name), with aliases resolved and removed.
* *
* @return PackageInterface[] * @return PackageInterface[]
*/ */
public function getCanonicalPackages(); public function getCanonicalPackages();
/** /**
* Forces a reload of all packages * Forces a reload of all packages.
*/ */
public function reload(); public function reload();
} }