diff --git a/CHANGELOG.md b/CHANGELOG.md index 976d4bbdd..270ac5c98 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -137,7 +137,7 @@ ### 1.0.0-alpha6 (2012-10-23) * Schema: Added ability to pass additional options to repositories (i.e. ssh keys/client certificates to secure private repos) - * Schema: Added a new `~` operator that should be prefered over `>=`, see http://getcomposer.org/doc/01-basic-usage.md#package-versions + * Schema: Added a new `~` operator that should be preferred over `>=`, see http://getcomposer.org/doc/01-basic-usage.md#package-versions * Schema: Version constraints `getId(); } - // select prefered package according to policy rules - if (!$matchedPackage && $matches && $prefered = $policy->selectPreferedPackages($pool, array(), $matches)) { - $matchedPackage = $pool->literalToPackage($prefered[0]); + // select preferred package according to policy rules + if (!$matchedPackage && $matches && $preferred = $policy->selectPreferredPackages($pool, array(), $matches)) { + $matchedPackage = $pool->literalToPackage($preferred[0]); } return array($matchedPackage, $versions); diff --git a/src/Composer/DependencyResolver/DefaultPolicy.php b/src/Composer/DependencyResolver/DefaultPolicy.php index 5ae6b2c31..2ebe95454 100644 --- a/src/Composer/DependencyResolver/DefaultPolicy.php +++ b/src/Composer/DependencyResolver/DefaultPolicy.php @@ -62,7 +62,7 @@ class DefaultPolicy implements PolicyInterface return $pool->getPriority($package->getRepository()); } - public function selectPreferedPackages(Pool $pool, array $installedMap, array $literals, $requiredPackage = null) + public function selectPreferredPackages(Pool $pool, array $installedMap, array $literals, $requiredPackage = null) { $packages = $this->groupLiteralsByNamePreferInstalled($pool, $installedMap, $literals); diff --git a/src/Composer/DependencyResolver/PolicyInterface.php b/src/Composer/DependencyResolver/PolicyInterface.php index e7aaaa724..433478920 100644 --- a/src/Composer/DependencyResolver/PolicyInterface.php +++ b/src/Composer/DependencyResolver/PolicyInterface.php @@ -21,5 +21,5 @@ interface PolicyInterface { public function versionCompare(PackageInterface $a, PackageInterface $b, $operator); public function findUpdatePackages(Pool $pool, array $installedMap, PackageInterface $package); - public function selectPreferedPackages(Pool $pool, array $installedMap, array $literals); + public function selectPreferredPackages(Pool $pool, array $installedMap, array $literals); } diff --git a/src/Composer/DependencyResolver/Solver.php b/src/Composer/DependencyResolver/Solver.php index 77a945f20..6975df2cd 100644 --- a/src/Composer/DependencyResolver/Solver.php +++ b/src/Composer/DependencyResolver/Solver.php @@ -329,7 +329,7 @@ class Solver private function selectAndInstall($level, array $decisionQueue, $disableRules, Rule $rule) { // choose best package to install from decisionQueue - $literals = $this->policy->selectPreferedPackages($this->pool, $this->installedMap, $decisionQueue, $rule->getRequiredPackage()); + $literals = $this->policy->selectPreferredPackages($this->pool, $this->installedMap, $decisionQueue, $rule->getRequiredPackage()); $selectedLiteral = array_shift($literals); diff --git a/src/Composer/Installer.php b/src/Composer/Installer.php index 89ecd0643..7333d0d10 100644 --- a/src/Composer/Installer.php +++ b/src/Composer/Installer.php @@ -832,8 +832,8 @@ class Installer $matches[$index] = $match->getId(); } - // select prefered package according to policy rules - if ($matches && $matches = $policy->selectPreferedPackages($pool, array(), $matches)) { + // select preferred package according to policy rules + if ($matches && $matches = $policy->selectPreferredPackages($pool, array(), $matches)) { $newPackage = $pool->literalToPackage($matches[0]); if ($task === 'force-links' && $newPackage) { @@ -1281,7 +1281,7 @@ class Installer } /** - * Should packages be prefered in a stable version when updating? + * Should packages be preferred in a stable version when updating? * * @param boolean $preferStable * @return Installer @@ -1294,7 +1294,7 @@ class Installer } /** - * Should packages be prefered in a lowest version when updating? + * Should packages be preferred in a lowest version when updating? * * @param boolean $preferLowest * @return Installer diff --git a/tests/Composer/Test/DependencyResolver/DefaultPolicyTest.php b/tests/Composer/Test/DependencyResolver/DefaultPolicyTest.php index f06ba4437..993cbffe8 100644 --- a/tests/Composer/Test/DependencyResolver/DefaultPolicyTest.php +++ b/tests/Composer/Test/DependencyResolver/DefaultPolicyTest.php @@ -46,7 +46,7 @@ class DefaultPolicyTest extends TestCase $literals = array($packageA->getId()); $expected = array($packageA->getId()); - $selected = $this->policy->selectPreferedPackages($this->pool, array(), $literals); + $selected = $this->policy->selectPreferredPackages($this->pool, array(), $literals); $this->assertEquals($expected, $selected); } @@ -60,7 +60,7 @@ class DefaultPolicyTest extends TestCase $literals = array($packageA1->getId(), $packageA2->getId()); $expected = array($packageA2->getId()); - $selected = $this->policy->selectPreferedPackages($this->pool, array(), $literals); + $selected = $this->policy->selectPreferredPackages($this->pool, array(), $literals); $this->assertEquals($expected, $selected); } @@ -74,7 +74,7 @@ class DefaultPolicyTest extends TestCase $literals = array($packageA1->getId(), $packageA2->getId()); $expected = array($packageA2->getId()); - $selected = $this->policy->selectPreferedPackages($this->pool, array(), $literals); + $selected = $this->policy->selectPreferredPackages($this->pool, array(), $literals); $this->assertEquals($expected, $selected); } @@ -89,7 +89,7 @@ class DefaultPolicyTest extends TestCase $expected = array($packageA1->getId()); $policy = new DefaultPolicy(true); - $selected = $policy->selectPreferedPackages($this->pool, array(), $literals); + $selected = $policy->selectPreferredPackages($this->pool, array(), $literals); $this->assertEquals($expected, $selected); } @@ -103,7 +103,7 @@ class DefaultPolicyTest extends TestCase $literals = array($packageA1->getId(), $packageA2->getId()); $expected = array($packageA2->getId()); - $selected = $this->policy->selectPreferedPackages($this->pool, array(), $literals); + $selected = $this->policy->selectPreferredPackages($this->pool, array(), $literals); $this->assertEquals($expected, $selected); } @@ -118,7 +118,7 @@ class DefaultPolicyTest extends TestCase $literals = array($packageA->getId(), $packageAInstalled->getId()); $expected = array($packageA->getId()); - $selected = $this->policy->selectPreferedPackages($this->pool, $this->mapFromRepo($this->repoInstalled), $literals); + $selected = $this->policy->selectPreferredPackages($this->pool, $this->mapFromRepo($this->repoInstalled), $literals); $this->assertEquals($expected, $selected); } @@ -137,7 +137,7 @@ class DefaultPolicyTest extends TestCase $literals = array($packageA->getId(), $packageAImportant->getId()); $expected = array($packageAImportant->getId()); - $selected = $this->policy->selectPreferedPackages($this->pool, array(), $literals); + $selected = $this->policy->selectPreferredPackages($this->pool, array(), $literals); $this->assertEquals($expected, $selected); } @@ -166,7 +166,7 @@ class DefaultPolicyTest extends TestCase $expected = array($packageAAliasImportant->getId()); - $selected = $this->policy->selectPreferedPackages($this->pool, array(), $literals); + $selected = $this->policy->selectPreferredPackages($this->pool, array(), $literals); $this->assertEquals($expected, $selected); } @@ -184,7 +184,7 @@ class DefaultPolicyTest extends TestCase $literals = array($packageA->getId(), $packageB->getId()); $expected = $literals; - $selected = $this->policy->selectPreferedPackages($this->pool, array(), $literals); + $selected = $this->policy->selectPreferredPackages($this->pool, array(), $literals); $this->assertEquals($expected, $selected); } @@ -201,7 +201,7 @@ class DefaultPolicyTest extends TestCase $literals = array($packageA->getId(), $packageB->getId()); $expected = $literals; - $selected = $this->policy->selectPreferedPackages($this->pool, array(), $literals); + $selected = $this->policy->selectPreferredPackages($this->pool, array(), $literals); $this->assertEquals($expected, $selected); } @@ -220,7 +220,7 @@ class DefaultPolicyTest extends TestCase $literals = array($packageA->getId(), $packageB->getId()); $expected = $literals; - $selected = $this->policy->selectPreferedPackages($this->pool, array(), $literals, 'vendor-a/package'); + $selected = $this->policy->selectPreferredPackages($this->pool, array(), $literals, 'vendor-a/package'); $this->assertEquals($expected, $selected); // test with reversed order in repo @@ -234,7 +234,7 @@ class DefaultPolicyTest extends TestCase $literals = array($packageA->getId(), $packageB->getId()); $expected = $literals; - $selected = $this->policy->selectPreferedPackages($this->pool, array(), $literals, 'vendor-a/package'); + $selected = $this->policy->selectPreferredPackages($this->pool, array(), $literals, 'vendor-a/package'); $this->assertEquals($expected, $selected); } @@ -259,7 +259,7 @@ class DefaultPolicyTest extends TestCase $literals = array($packageA1->getId(), $packageA2->getId()); $expected = array($packageA1->getId()); - $selected = $policy->selectPreferedPackages($this->pool, array(), $literals); + $selected = $policy->selectPreferredPackages($this->pool, array(), $literals); $this->assertEquals($expected, $selected); }