diff --git a/src/Composer/Command/ShowCommand.php b/src/Composer/Command/ShowCommand.php
index 6a23602e0..e7b054d05 100644
--- a/src/Composer/Command/ShowCommand.php
+++ b/src/Composer/Command/ShowCommand.php
@@ -17,6 +17,7 @@ use Composer\DependencyResolver\DefaultPolicy;
use Composer\Json\JsonFile;
use Composer\Package\BasePackage;
use Composer\Package\CompletePackageInterface;
+use Composer\Package\Link;
use Composer\Package\PackageInterface;
use Composer\Package\Version\VersionParser;
use Composer\Package\Version\VersionSelector;
@@ -613,8 +614,8 @@ EOT
$io = $this->getIO();
$this->printMeta($package, $versions, $installedRepo, $latestPackage ?: null);
- $this->printLinks($package, 'requires');
- $this->printLinks($package, 'devRequires', 'requires (dev)');
+ $this->printLinks($package, Link::TYPE_REQUIRE);
+ $this->printLinks($package, Link::TYPE_DEV_REQUIRE, 'requires (dev)');
if ($package->getSuggests()) {
$io->write("\nsuggests");
@@ -623,9 +624,9 @@ EOT
}
}
- $this->printLinks($package, 'provides');
- $this->printLinks($package, 'conflicts');
- $this->printLinks($package, 'replaces');
+ $this->printLinks($package, Link::TYPE_PROVIDE);
+ $this->printLinks($package, Link::TYPE_CONFLICT);
+ $this->printLinks($package, Link::TYPE_REPLACE);
}
/**
@@ -911,7 +912,7 @@ EOT
private function appendLinks($json, CompletePackageInterface $package)
{
- foreach (array('requires', 'devRequires', 'provides', 'conflicts', 'replaces') as $linkType) {
+ foreach (Link::$TYPES as $linkType) {
$json = $this->appendLink($json, $package, $linkType);
}
diff --git a/src/Composer/Package/AliasPackage.php b/src/Composer/Package/AliasPackage.php
index a3bc117f0..3eb9cf7f3 100644
--- a/src/Composer/Package/AliasPackage.php
+++ b/src/Composer/Package/AliasPackage.php
@@ -57,7 +57,7 @@ class AliasPackage extends BasePackage implements CompletePackageInterface
$this->stability = VersionParser::parseStability($version);
$this->dev = $this->stability === 'dev';
- foreach (array('requires', 'devRequires', 'conflicts', 'provides', 'replaces') as $type) {
+ foreach (Link::$TYPES as $type) {
$links = $aliasOf->{'get' . ucfirst($type)}();
$this->$type = $this->replaceSelfVersionDependencies($links, $type);
}
@@ -180,7 +180,7 @@ class AliasPackage extends BasePackage implements CompletePackageInterface
$prettyVersion = $this->aliasOf->getPrettyVersion();
}
- if (\in_array($linkType, array('conflicts', 'provides', 'replaces'), true)) {
+ if (\in_array($linkType, array(Link::TYPE_CONFLICT, Link::TYPE_PROVIDE, Link::TYPE_REPLACE), true)) {
$newLinks = array();
foreach ($links as $link) {
// link is self.version, but must be replacing also the replaced version
@@ -193,7 +193,7 @@ class AliasPackage extends BasePackage implements CompletePackageInterface
} else {
foreach ($links as $index => $link) {
if ('self.version' === $link->getPrettyConstraint()) {
- if ($linkType === 'requires') {
+ if ($linkType === Link::TYPE_REQUIRE) {
$this->hasSelfVersionRequires = true;
}
$links[$index] = new Link($link->getSource(), $link->getTarget(), $constraint = new Constraint('=', $this->version), $linkType, $prettyVersion);
diff --git a/src/Composer/Package/BasePackage.php b/src/Composer/Package/BasePackage.php
index 09190f9e7..ecfa7a537 100644
--- a/src/Composer/Package/BasePackage.php
+++ b/src/Composer/Package/BasePackage.php
@@ -22,12 +22,15 @@ use Composer\Repository\PlatformRepository;
*/
abstract class BasePackage implements PackageInterface
{
+ /**
+ * @phpstan-var array
+ */
public static $supportedLinkTypes = array(
- 'require' => array('description' => 'requires', 'method' => 'requires'),
- 'conflict' => array('description' => 'conflicts', 'method' => 'conflicts'),
- 'provide' => array('description' => 'provides', 'method' => 'provides'),
- 'replace' => array('description' => 'replaces', 'method' => 'replaces'),
- 'require-dev' => array('description' => 'requires (for development)', 'method' => 'devRequires'),
+ 'require' => array('description' => 'requires', 'method' => Link::TYPE_REQUIRE),
+ 'conflict' => array('description' => 'conflicts', 'method' => Link::TYPE_CONFLICT),
+ 'provide' => array('description' => 'provides', 'method' => Link::TYPE_PROVIDE),
+ 'replace' => array('description' => 'replaces', 'method' => Link::TYPE_REPLACE),
+ 'require-dev' => array('description' => 'requires (for development)', 'method' => Link::TYPE_DEV_REQUIRE),
);
const STABILITY_STABLE = 0;
diff --git a/src/Composer/Package/Link.php b/src/Composer/Package/Link.php
index 4af6a5a6a..11a8ecfdc 100644
--- a/src/Composer/Package/Link.php
+++ b/src/Composer/Package/Link.php
@@ -21,6 +21,26 @@ use Composer\Semver\Constraint\ConstraintInterface;
*/
class Link
{
+ const TYPE_REQUIRE = 'requires';
+ const TYPE_DEV_REQUIRE = 'devRequires';
+ const TYPE_PROVIDE = 'provides';
+ const TYPE_CONFLICT = 'conflicts';
+ const TYPE_REPLACE = 'replaces';
+
+ /**
+ * Will be converted into a constant once the min PHP version allows this
+ *
+ * @private
+ * @var string[]
+ */
+ public static $TYPES = array(
+ self::TYPE_REQUIRE,
+ self::TYPE_DEV_REQUIRE,
+ self::TYPE_PROVIDE,
+ self::TYPE_CONFLICT,
+ self::TYPE_REPLACE,
+ );
+
/**
* @var string
*/
@@ -38,6 +58,7 @@ class Link
/**
* @var string
+ * @phpstan-var self::TYPE_* $description
*/
protected $description;
@@ -49,14 +70,20 @@ class Link
/**
* Creates a new package link.
*
- * @param string $source
- * @param string $target
- * @param ConstraintInterface $constraint Constraint applying to the target of this link
- * @param string $description Used to create a descriptive string representation
- * @param string|null $prettyConstraint
+ * @param string $source
+ * @param string $target
+ * @param ConstraintInterface $constraint Constraint applying to the target of this link
+ * @param string $description Used to create a descriptive string representation
+ * @phpstan-param self::TYPE_* $description
+ * @param string|null $prettyConstraint
*/
- public function __construct($source, $target, ConstraintInterface $constraint, $description = 'relates to', $prettyConstraint = null)
- {
+ public function __construct(
+ $source,
+ $target,
+ ConstraintInterface $constraint,
+ $description = 'relates to',
+ $prettyConstraint = null
+ ) {
$this->source = strtolower($source);
$this->target = strtolower($target);
$this->constraint = $constraint;
diff --git a/src/Composer/Package/Loader/ArrayLoader.php b/src/Composer/Package/Loader/ArrayLoader.php
index 7f137bf46..94e5bda73 100644
--- a/src/Composer/Package/Loader/ArrayLoader.php
+++ b/src/Composer/Package/Loader/ArrayLoader.php
@@ -296,10 +296,11 @@ class ArrayLoader implements LoaderInterface
}
/**
- * @param string $source source package name
- * @param string $sourceVersion source package version (pretty version ideally)
- * @param string $description link description (e.g. requires, replaces, ..)
- * @param array $links array of package name => constraint mappings
+ * @param string $source source package name
+ * @param string $sourceVersion source package version (pretty version ideally)
+ * @param string $description link description (e.g. requires, replaces, ..)
+ * @phpstan-param Link::TYPE_* $description
+ * @param array $links array of package name => constraint mappings
* @return Link[]
*/
public function parseLinks($source, $sourceVersion, $description, $links)
diff --git a/src/Composer/Package/Locker.php b/src/Composer/Package/Locker.php
index 6009082cd..5a4c7d64f 100644
--- a/src/Composer/Package/Locker.php
+++ b/src/Composer/Package/Locker.php
@@ -213,7 +213,7 @@ class Locker
$requirements = $this->loader->parseLinks(
'__root__',
'1.0.0',
- 'requires',
+ Link::TYPE_REQUIRE,
isset($lockData['platform']) ? $lockData['platform'] : array()
);
}
@@ -222,7 +222,7 @@ class Locker
$devRequirements = $this->loader->parseLinks(
'__root__',
'1.0.0',
- 'requires',
+ Link::TYPE_REQUIRE,
isset($lockData['platform-dev']) ? $lockData['platform-dev'] : array()
);
diff --git a/src/Composer/Package/RootAliasPackage.php b/src/Composer/Package/RootAliasPackage.php
index 862cb21a5..231cd34de 100644
--- a/src/Composer/Package/RootAliasPackage.php
+++ b/src/Composer/Package/RootAliasPackage.php
@@ -75,7 +75,7 @@ class RootAliasPackage extends AliasPackage implements RootPackageInterface
*/
public function setRequires(array $require)
{
- $this->requires = $this->replaceSelfVersionDependencies($require, 'requires');
+ $this->requires = $this->replaceSelfVersionDependencies($require, Link::TYPE_REQUIRE);
$this->aliasOf->setRequires($require);
}
@@ -85,7 +85,7 @@ class RootAliasPackage extends AliasPackage implements RootPackageInterface
*/
public function setDevRequires(array $devRequire)
{
- $this->devRequires = $this->replaceSelfVersionDependencies($devRequire, 'devRequires');
+ $this->devRequires = $this->replaceSelfVersionDependencies($devRequire, Link::TYPE_DEV_REQUIRE);
$this->aliasOf->setDevRequires($devRequire);
}
@@ -95,7 +95,7 @@ class RootAliasPackage extends AliasPackage implements RootPackageInterface
*/
public function setConflicts(array $conflicts)
{
- $this->conflicts = $this->replaceSelfVersionDependencies($conflicts, 'conflicts');
+ $this->conflicts = $this->replaceSelfVersionDependencies($conflicts, Link::TYPE_CONFLICT);
$this->aliasOf->setConflicts($conflicts);
}
@@ -104,7 +104,7 @@ class RootAliasPackage extends AliasPackage implements RootPackageInterface
*/
public function setProvides(array $provides)
{
- $this->provides = $this->replaceSelfVersionDependencies($provides, 'provides');
+ $this->provides = $this->replaceSelfVersionDependencies($provides, Link::TYPE_PROVIDE);
$this->aliasOf->setProvides($provides);
}
@@ -113,7 +113,7 @@ class RootAliasPackage extends AliasPackage implements RootPackageInterface
*/
public function setReplaces(array $replaces)
{
- $this->replaces = $this->replaceSelfVersionDependencies($replaces, 'replaces');
+ $this->replaces = $this->replaceSelfVersionDependencies($replaces, Link::TYPE_REPLACE);
$this->aliasOf->setReplaces($replaces);
}
diff --git a/src/Composer/Repository/InstalledRepository.php b/src/Composer/Repository/InstalledRepository.php
index 6329710de..157867553 100644
--- a/src/Composer/Repository/InstalledRepository.php
+++ b/src/Composer/Repository/InstalledRepository.php
@@ -176,7 +176,7 @@ class InstalledRepository extends CompositeRepository
$platformPkg = $this->findPackage($link->getTarget(), '*');
$description = $platformPkg ? 'but '.$platformPkg->getPrettyVersion().' is installed' : 'but it is missing';
- $results[] = array($package, new Link($package->getName(), $link->getTarget(), null, 'requires', $link->getPrettyConstraint().' '.$description), false);
+ $results[] = array($package, new Link($package->getName(), $link->getTarget(), null, Link::TYPE_REQUIRE, $link->getPrettyConstraint().' '.$description), false);
continue;
}
diff --git a/src/Composer/Repository/PlatformRepository.php b/src/Composer/Repository/PlatformRepository.php
index d80a278b9..e5c6785e1 100644
--- a/src/Composer/Repository/PlatformRepository.php
+++ b/src/Composer/Repository/PlatformRepository.php
@@ -548,7 +548,9 @@ class PlatformRepository extends ArrayRepository
$ext->setDescription('The '.$name.' PHP extension'.$extraDescription);
if ($name === 'uuid') {
- $ext->setReplaces(array(new Link('ext-uuid', 'lib-uuid', new Constraint('=', $version))));
+ $ext->setReplaces(array(
+ new Link('ext-uuid', 'lib-uuid', new Constraint('=', $version), Link::TYPE_REPLACE, $ext->getPrettyVersion())
+ ));
}
$this->addPackage($ext);
@@ -585,8 +587,8 @@ class PlatformRepository extends ArrayRepository
$lib = new CompletePackage('lib-'.$name, $version, $prettyVersion);
$lib->setDescription($description);
- $links = function ($alias) use ($name, $version) {
- return new Link('lib-'.$name, 'lib-'.$alias, new Constraint('=', $version));
+ $links = function ($alias) use ($name, $version, $lib) {
+ return new Link('lib-'.$name, 'lib-'.$alias, new Constraint('=', $version), Link::TYPE_REPLACE, $lib->getPrettyVersion());
};
$lib->setReplaces(array_map($links, $replaces));
$lib->setProvides(array_map($links, $provides));
diff --git a/tests/Composer/Test/Autoload/AutoloadGeneratorTest.php b/tests/Composer/Test/Autoload/AutoloadGeneratorTest.php
index ad38b3c8f..585d38b59 100644
--- a/tests/Composer/Test/Autoload/AutoloadGeneratorTest.php
+++ b/tests/Composer/Test/Autoload/AutoloadGeneratorTest.php
@@ -438,7 +438,7 @@ class AutoloadGeneratorTest extends TestCase
$b->setAutoload(array('psr-4' => array('B\\' => 'src/')));
$b->setReplaces(
- array(new Link('b/b', 'b/c', new Constraint('==', '1.0'), 'replaces'))
+ array(new Link('b/b', 'b/c', new Constraint('==', '1.0'), Link::TYPE_REPLACE))
);
$this->repository->expects($this->once())
diff --git a/tests/Composer/Test/DependencyResolver/DefaultPolicyTest.php b/tests/Composer/Test/DependencyResolver/DefaultPolicyTest.php
index 8a0e5a15a..0341dba81 100644
--- a/tests/Composer/Test/DependencyResolver/DefaultPolicyTest.php
+++ b/tests/Composer/Test/DependencyResolver/DefaultPolicyTest.php
@@ -192,8 +192,8 @@ class DefaultPolicyTest extends TestCase
$this->repo->addPackage($packageA = $this->getPackage('A', '1.0'));
$this->repo->addPackage($packageB = $this->getPackage('B', '2.0'));
- $packageA->setProvides(array(new Link('A', 'X', new Constraint('==', '1.0'), 'provides')));
- $packageB->setProvides(array(new Link('B', 'X', new Constraint('==', '1.0'), 'provides')));
+ $packageA->setProvides(array(new Link('A', 'X', new Constraint('==', '1.0'), Link::TYPE_PROVIDE)));
+ $packageB->setProvides(array(new Link('B', 'X', new Constraint('==', '1.0'), Link::TYPE_PROVIDE)));
$this->repositorySet->addRepository($this->repo);
@@ -212,7 +212,7 @@ class DefaultPolicyTest extends TestCase
$this->repo->addPackage($packageA = $this->getPackage('A', '1.0'));
$this->repo->addPackage($packageB = $this->getPackage('B', '2.0'));
- $packageB->setReplaces(array(new Link('B', 'A', new Constraint('==', '1.0'), 'replaces')));
+ $packageB->setReplaces(array(new Link('B', 'A', new Constraint('==', '1.0'), Link::TYPE_REPLACE)));
$this->repositorySet->addRepository($this->repo);
@@ -232,8 +232,8 @@ class DefaultPolicyTest extends TestCase
$this->repo->addPackage($packageB = $this->getPackage('vendor-b/replacer', '1.0'));
$this->repo->addPackage($packageA = $this->getPackage('vendor-a/replacer', '1.0'));
- $packageA->setReplaces(array(new Link('vendor-a/replacer', 'vendor-a/package', new Constraint('==', '1.0'), 'replaces')));
- $packageB->setReplaces(array(new Link('vendor-b/replacer', 'vendor-a/package', new Constraint('==', '1.0'), 'replaces')));
+ $packageA->setReplaces(array(new Link('vendor-a/replacer', 'vendor-a/package', new Constraint('==', '1.0'), Link::TYPE_REPLACE)));
+ $packageB->setReplaces(array(new Link('vendor-b/replacer', 'vendor-a/package', new Constraint('==', '1.0'), Link::TYPE_REPLACE)));
$this->repositorySet->addRepository($this->repo);
diff --git a/tests/Composer/Test/DependencyResolver/SolverTest.php b/tests/Composer/Test/DependencyResolver/SolverTest.php
index 6ed4c6bbd..9845c62da 100644
--- a/tests/Composer/Test/DependencyResolver/SolverTest.php
+++ b/tests/Composer/Test/DependencyResolver/SolverTest.php
@@ -112,7 +112,7 @@ class SolverTest extends TestCase
$this->repo->addPackage($packageB = $this->getPackage('B', '1.0'));
$this->repo->addPackage($newPackageB = $this->getPackage('B', '1.1'));
- $packageA->setRequires(array('b' => new Link('A', 'B', $this->getVersionConstraint('<', '1.1'), 'requires')));
+ $packageA->setRequires(array('b' => new Link('A', 'B', $this->getVersionConstraint('<', '1.1'), Link::TYPE_REQUIRE)));
$this->reposComplete();
@@ -137,7 +137,7 @@ class SolverTest extends TestCase
$this->getVersionConstraint('<=', '1.3'),
$this->getVersionConstraint('<>', '1.3'),
$this->getVersionConstraint('!=', '1.2'),
- )), 'requires'),
+ )), Link::TYPE_REQUIRE),
));
$this->reposComplete();
@@ -157,11 +157,11 @@ class SolverTest extends TestCase
$this->repo->addPackage($packageC = $this->getPackage('C', '1.0'));
$packageB->setRequires(array(
- 'a' => new Link('B', 'A', $this->getVersionConstraint('>=', '1.0'), 'requires'),
- 'c' => new Link('B', 'C', $this->getVersionConstraint('>=', '1.0'), 'requires'),
+ 'a' => new Link('B', 'A', $this->getVersionConstraint('>=', '1.0'), Link::TYPE_REQUIRE),
+ 'c' => new Link('B', 'C', $this->getVersionConstraint('>=', '1.0'), Link::TYPE_REQUIRE),
));
$packageC->setRequires(array(
- 'a' => new Link('C', 'A', $this->getVersionConstraint('>=', '1.0'), 'requires'),
+ 'a' => new Link('C', 'A', $this->getVersionConstraint('>=', '1.0'), Link::TYPE_REQUIRE),
));
$this->reposComplete();
@@ -205,7 +205,7 @@ class SolverTest extends TestCase
$this->repo->addPackage($newPackageB = $this->getPackage('B', '1.1'));
$this->reposComplete();
- $packageA->setRequires(array('b' => new Link('A', 'B', $this->getVersionConstraint('>=', '1.0.0.0'), 'requires')));
+ $packageA->setRequires(array('b' => new Link('A', 'B', $this->getVersionConstraint('>=', '1.0.0.0'), Link::TYPE_REQUIRE)));
$this->request->fixPackage($packageA);
$this->request->requireName('B', $this->getVersionConstraint('=', '1.1.0.0'));
@@ -235,8 +235,8 @@ class SolverTest extends TestCase
$this->repo->addPackage($newPackageA = $this->getPackage('A', '1.1'));
$this->repo->addPackage($newPackageB = $this->getPackage('B', '1.1'));
- $packageA->setRequires(array('b' => new Link('A', 'B', new MatchAllConstraint(), 'requires')));
- $newPackageA->setRequires(array('b' => new Link('A', 'B', new MatchAllConstraint(), 'requires')));
+ $packageA->setRequires(array('b' => new Link('A', 'B', new MatchAllConstraint(), Link::TYPE_REQUIRE)));
+ $newPackageA->setRequires(array('b' => new Link('A', 'B', new MatchAllConstraint(), Link::TYPE_REQUIRE)));
$this->reposComplete();
@@ -341,7 +341,7 @@ class SolverTest extends TestCase
$this->repo->addPackage($newPackageB = $this->getPackage('B', '1.1'));
$this->repo->addPackage($packageC = $this->getPackage('C', '1.1'));
$this->repo->addPackage($this->getPackage('D', '1.0'));
- $packageA->setRequires(array('b' => new Link('A', 'B', $this->getVersionConstraint('<', '1.1'), 'requires')));
+ $packageA->setRequires(array('b' => new Link('A', 'B', $this->getVersionConstraint('<', '1.1'), Link::TYPE_REQUIRE)));
$this->reposComplete();
@@ -362,8 +362,8 @@ class SolverTest extends TestCase
$this->repo->addPackage($middlePackageB = $this->getPackage('B', '1.0'));
$this->repo->addPackage($newPackageB = $this->getPackage('B', '1.1'));
$this->repo->addPackage($oldPackageB = $this->getPackage('B', '0.9'));
- $packageA->setRequires(array('b' => new Link('A', 'B', $this->getVersionConstraint('<', '1.1'), 'requires')));
- $packageA->setConflicts(array('b' => new Link('A', 'B', $this->getVersionConstraint('<', '1.0'), 'conflicts')));
+ $packageA->setRequires(array('b' => new Link('A', 'B', $this->getVersionConstraint('<', '1.1'), Link::TYPE_REQUIRE)));
+ $packageA->setConflicts(array('b' => new Link('A', 'B', $this->getVersionConstraint('<', '1.0'), Link::TYPE_CONFLICT)));
$this->reposComplete();
@@ -409,8 +409,8 @@ class SolverTest extends TestCase
{
$this->repo->addPackage($packageA = $this->getPackage('A', '1.0'));
$this->repo->addPackage($packageQ = $this->getPackage('Q', '1.0'));
- $packageA->setRequires(array('b' => new Link('A', 'B', $this->getVersionConstraint('>=', '1.0'), 'requires')));
- $packageQ->setProvides(array('b' => new Link('Q', 'B', $this->getVersionConstraint('=', '1.0'), 'provides')));
+ $packageA->setRequires(array('b' => new Link('A', 'B', $this->getVersionConstraint('>=', '1.0'), Link::TYPE_REQUIRE)));
+ $packageQ->setProvides(array('b' => new Link('Q', 'B', $this->getVersionConstraint('=', '1.0'), Link::TYPE_PROVIDE)));
$this->reposComplete();
@@ -427,8 +427,8 @@ class SolverTest extends TestCase
$this->repo->addPackage($packageA = $this->getPackage('A', '1.0'));
$this->repo->addPackage($packageQ = $this->getPackage('Q', '1.0'));
$this->repo->addPackage($packageB = $this->getPackage('B', '1.0'));
- $packageA->setRequires(array('b' => new Link('A', 'B', $this->getVersionConstraint('>=', '1.0'), 'requires')));
- $packageQ->setReplaces(array('b' => new Link('Q', 'B', $this->getVersionConstraint('>=', '1.0'), 'replaces')));
+ $packageA->setRequires(array('b' => new Link('A', 'B', $this->getVersionConstraint('>=', '1.0'), Link::TYPE_REQUIRE)));
+ $packageQ->setReplaces(array('b' => new Link('Q', 'B', $this->getVersionConstraint('>=', '1.0'), Link::TYPE_REPLACE)));
$this->reposComplete();
@@ -444,8 +444,8 @@ class SolverTest extends TestCase
{
$this->repo->addPackage($packageA = $this->getPackage('A', '1.0'));
$this->repo->addPackage($packageQ = $this->getPackage('Q', '1.0'));
- $packageA->setRequires(array('b' => new Link('A', 'B', $this->getVersionConstraint('>=', '1.0'), 'requires')));
- $packageQ->setReplaces(array('b' => new Link('Q', 'B', $this->getVersionConstraint('>=', '1.0'), 'replaces')));
+ $packageA->setRequires(array('b' => new Link('A', 'B', $this->getVersionConstraint('>=', '1.0'), Link::TYPE_REQUIRE)));
+ $packageQ->setReplaces(array('b' => new Link('Q', 'B', $this->getVersionConstraint('>=', '1.0'), Link::TYPE_REPLACE)));
$this->reposComplete();
@@ -461,8 +461,8 @@ class SolverTest extends TestCase
$this->repo->addPackage($packageA = $this->getPackage('A', '1.0'));
$this->repo->addPackage($packageQ = $this->getPackage('Q', '1.0'));
$this->repo->addPackage($packageB = $this->getPackage('B', '1.0'));
- $packageA->setRequires(array('b' => new Link('A', 'B', $this->getVersionConstraint('>=', '1.0'), 'requires')));
- $packageQ->setReplaces(array('b' => new Link('Q', 'B', $this->getVersionConstraint('>=', '1.0'), 'replaces')));
+ $packageA->setRequires(array('b' => new Link('A', 'B', $this->getVersionConstraint('>=', '1.0'), Link::TYPE_REQUIRE)));
+ $packageQ->setReplaces(array('b' => new Link('Q', 'B', $this->getVersionConstraint('>=', '1.0'), Link::TYPE_REPLACE)));
$this->reposComplete();
@@ -479,27 +479,27 @@ class SolverTest extends TestCase
{
$this->repo->addPackage($packageX = $this->getPackage('X', '1.0'));
$packageX->setRequires(array(
- 'a' => new Link('X', 'A', $this->getVersionConstraint('>=', '2.0.0.0'), 'requires'),
- 'b' => new Link('X', 'B', $this->getVersionConstraint('>=', '2.0.0.0'), 'requires'),
+ 'a' => new Link('X', 'A', $this->getVersionConstraint('>=', '2.0.0.0'), Link::TYPE_REQUIRE),
+ 'b' => new Link('X', 'B', $this->getVersionConstraint('>=', '2.0.0.0'), Link::TYPE_REQUIRE),
));
$this->repo->addPackage($packageA = $this->getPackage('A', '2.0.0'));
$this->repo->addPackage($newPackageA = $this->getPackage('A', '2.1.0'));
$this->repo->addPackage($newPackageB = $this->getPackage('B', '2.1.0'));
- $packageA->setRequires(array('b' => new Link('A', 'B', $this->getVersionConstraint('>=', '2.0.0.0'), 'requires')));
+ $packageA->setRequires(array('b' => new Link('A', 'B', $this->getVersionConstraint('>=', '2.0.0.0'), Link::TYPE_REQUIRE)));
// new package A depends on version of package B that does not exist
// => new package A is not installable
- $newPackageA->setRequires(array('b' => new Link('A', 'B', $this->getVersionConstraint('>=', '2.2.0.0'), 'requires')));
+ $newPackageA->setRequires(array('b' => new Link('A', 'B', $this->getVersionConstraint('>=', '2.2.0.0'), Link::TYPE_REQUIRE)));
// add a package S replacing both A and B, so that S and B or S and A cannot be simultaneously installed
// but an alternative option for A and B both exists
// this creates a more difficult so solve conflict
$this->repo->addPackage($packageS = $this->getPackage('S', '2.0.0'));
$packageS->setReplaces(array(
- 'a' => new Link('S', 'A', $this->getVersionConstraint('>=', '2.0.0.0'), 'replaces'),
- 'b' => new Link('S', 'B', $this->getVersionConstraint('>=', '2.0.0.0'), 'replaces'),
+ 'a' => new Link('S', 'A', $this->getVersionConstraint('>=', '2.0.0.0'), Link::TYPE_REPLACE),
+ 'b' => new Link('S', 'B', $this->getVersionConstraint('>=', '2.0.0.0'), Link::TYPE_REPLACE),
));
$this->reposComplete();
@@ -518,8 +518,8 @@ class SolverTest extends TestCase
$this->repo->addPackage($packageA = $this->getPackage('A', '1.0'));
$this->repo->addPackage($packageB1 = $this->getPackage('B', '0.9'));
$this->repo->addPackage($packageB2 = $this->getPackage('B', '1.1'));
- $packageA->setRequires(array('b' => new Link('A', 'B', $this->getVersionConstraint('>=', '1.0'), 'requires')));
- $packageB2->setRequires(array('a' => new Link('B', 'A', $this->getVersionConstraint('>=', '1.0'), 'requires')));
+ $packageA->setRequires(array('b' => new Link('A', 'B', $this->getVersionConstraint('>=', '1.0'), Link::TYPE_REQUIRE)));
+ $packageB2->setRequires(array('a' => new Link('B', 'A', $this->getVersionConstraint('>=', '1.0'), Link::TYPE_REQUIRE)));
$this->reposComplete();
@@ -537,13 +537,13 @@ class SolverTest extends TestCase
$this->repo->addPackage($packageB = $this->getPackage('B', '1.0'));
$this->repo->addPackage($packageC = $this->getPackage('C', '1.0'));
$this->repo->addPackage($packageD = $this->getPackage('D', '1.0'));
- $packageA->setRequires(array('b' => new Link('A', 'B', $this->getVersionConstraint('>=', '1.0'), 'requires')));
- $packageB->setRequires(array('virtual' => new Link('B', 'Virtual', $this->getVersionConstraint('>=', '1.0'), 'requires')));
- $packageC->setProvides(array('virtual' => new Link('C', 'Virtual', $this->getVersionConstraint('==', '1.0'), 'provides')));
- $packageD->setProvides(array('virtual' => new Link('D', 'Virtual', $this->getVersionConstraint('==', '1.0'), 'provides')));
+ $packageA->setRequires(array('b' => new Link('A', 'B', $this->getVersionConstraint('>=', '1.0'), Link::TYPE_REQUIRE)));
+ $packageB->setRequires(array('virtual' => new Link('B', 'Virtual', $this->getVersionConstraint('>=', '1.0'), Link::TYPE_REQUIRE)));
+ $packageC->setProvides(array('virtual' => new Link('C', 'Virtual', $this->getVersionConstraint('==', '1.0'), Link::TYPE_PROVIDE)));
+ $packageD->setProvides(array('virtual' => new Link('D', 'Virtual', $this->getVersionConstraint('==', '1.0'), Link::TYPE_PROVIDE)));
- $packageC->setRequires(array('a' => new Link('C', 'A', $this->getVersionConstraint('==', '1.0'), 'requires')));
- $packageD->setRequires(array('a' => new Link('D', 'A', $this->getVersionConstraint('==', '1.0'), 'requires')));
+ $packageC->setRequires(array('a' => new Link('C', 'A', $this->getVersionConstraint('==', '1.0'), Link::TYPE_REQUIRE)));
+ $packageD->setRequires(array('a' => new Link('D', 'A', $this->getVersionConstraint('==', '1.0'), Link::TYPE_REQUIRE)));
$this->reposComplete();
@@ -569,18 +569,18 @@ class SolverTest extends TestCase
$this->repo->addPackage($packageD2 = $this->getPackage('D', '1.1'));
$packageA->setRequires(array(
- 'b' => new Link('A', 'B', $this->getVersionConstraint('>=', '1.0'), 'requires'),
- 'c' => new Link('A', 'C', $this->getVersionConstraint('>=', '1.0'), 'requires'),
+ 'b' => new Link('A', 'B', $this->getVersionConstraint('>=', '1.0'), Link::TYPE_REQUIRE),
+ 'c' => new Link('A', 'C', $this->getVersionConstraint('>=', '1.0'), Link::TYPE_REQUIRE),
));
$packageD->setReplaces(array(
- 'b' => new Link('D', 'B', $this->getVersionConstraint('>=', '1.0'), 'replaces'),
- 'c' => new Link('D', 'C', $this->getVersionConstraint('>=', '1.0'), 'replaces'),
+ 'b' => new Link('D', 'B', $this->getVersionConstraint('>=', '1.0'), Link::TYPE_REPLACE),
+ 'c' => new Link('D', 'C', $this->getVersionConstraint('>=', '1.0'), Link::TYPE_REPLACE),
));
$packageD2->setReplaces(array(
- 'b' => new Link('D', 'B', $this->getVersionConstraint('>=', '1.0'), 'replaces'),
- 'c' => new Link('D', 'C', $this->getVersionConstraint('>=', '1.0'), 'replaces'),
+ 'b' => new Link('D', 'B', $this->getVersionConstraint('>=', '1.0'), Link::TYPE_REPLACE),
+ 'c' => new Link('D', 'C', $this->getVersionConstraint('>=', '1.0'), Link::TYPE_REPLACE),
));
$this->reposComplete();
@@ -605,19 +605,19 @@ class SolverTest extends TestCase
$this->repo->addPackage($packageD = $this->getPackage('D', '2.0.9'));
$packageC->setRequires(array(
- 'a' => new Link('C', 'A', $this->getVersionConstraint('>=', '2.0'), 'requires'),
- 'd' => new Link('C', 'D', $this->getVersionConstraint('>=', '2.0'), 'requires'),
+ 'a' => new Link('C', 'A', $this->getVersionConstraint('>=', '2.0'), Link::TYPE_REQUIRE),
+ 'd' => new Link('C', 'D', $this->getVersionConstraint('>=', '2.0'), Link::TYPE_REQUIRE),
));
$packageD->setRequires(array(
- 'a' => new Link('D', 'A', $this->getVersionConstraint('>=', '2.1'), 'requires'),
- 'b' => new Link('D', 'B', $this->getVersionConstraint('>=', '2.0-dev'), 'requires'),
+ 'a' => new Link('D', 'A', $this->getVersionConstraint('>=', '2.1'), Link::TYPE_REQUIRE),
+ 'b' => new Link('D', 'B', $this->getVersionConstraint('>=', '2.0-dev'), Link::TYPE_REQUIRE),
));
- $packageB1->setRequires(array('a' => new Link('B', 'A', $this->getVersionConstraint('==', '2.1.0.0-dev'), 'requires')));
- $packageB2->setRequires(array('a' => new Link('B', 'A', $this->getVersionConstraint('==', '2.1.0.0-dev'), 'requires')));
+ $packageB1->setRequires(array('a' => new Link('B', 'A', $this->getVersionConstraint('==', '2.1.0.0-dev'), Link::TYPE_REQUIRE)));
+ $packageB2->setRequires(array('a' => new Link('B', 'A', $this->getVersionConstraint('==', '2.1.0.0-dev'), Link::TYPE_REQUIRE)));
- $packageB2->setReplaces(array('d' => new Link('B', 'D', $this->getVersionConstraint('==', '2.0.9.0'), 'replaces')));
+ $packageB2->setReplaces(array('d' => new Link('B', 'D', $this->getVersionConstraint('==', '2.0.9.0'), Link::TYPE_REPLACE)));
$this->reposComplete();
@@ -634,7 +634,7 @@ class SolverTest extends TestCase
$this->repo->addPackage($packageA = $this->getPackage('A', '1.0'));
$this->repo->addPackage($packageB = $this->getPackage('B', '1.0'));
$packageA->setConflicts(array(
- 'b' => new Link('A', 'B', $this->getVersionConstraint('>=', '1.0'), 'conflicts'),
+ 'b' => new Link('A', 'B', $this->getVersionConstraint('>=', '1.0'), Link::TYPE_CONFLICT),
));
$this->reposComplete();
@@ -668,7 +668,7 @@ class SolverTest extends TestCase
$this->repo->addPackage($packageB = $this->getPackage('B', '1.0'));
$packageA->setRequires(array(
- 'b' => new Link('A', 'B', $this->getVersionConstraint('>=', '2.0'), 'requires'),
+ 'b' => new Link('A', 'B', $this->getVersionConstraint('>=', '2.0'), Link::TYPE_REQUIRE),
));
$this->reposComplete();
@@ -701,16 +701,16 @@ class SolverTest extends TestCase
$this->repo->addPackage($packageD = $this->getPackage('D', '1.0'));
$packageA->setRequires(array(
- 'b' => new Link('A', 'B', $this->getVersionConstraint('>=', '1.0'), 'requires'),
+ 'b' => new Link('A', 'B', $this->getVersionConstraint('>=', '1.0'), Link::TYPE_REQUIRE),
));
$packageB->setRequires(array(
- 'c' => new Link('B', 'C', $this->getVersionConstraint('>=', '1.0'), 'requires'),
+ 'c' => new Link('B', 'C', $this->getVersionConstraint('>=', '1.0'), Link::TYPE_REQUIRE),
));
$packageC->setRequires(array(
- 'd' => new Link('C', 'D', $this->getVersionConstraint('>=', '1.0'), 'requires'),
+ 'd' => new Link('C', 'D', $this->getVersionConstraint('>=', '1.0'), Link::TYPE_REQUIRE),
));
$packageD->setRequires(array(
- 'b' => new Link('D', 'B', $this->getVersionConstraint('<', '1.0'), 'requires'),
+ 'b' => new Link('D', 'B', $this->getVersionConstraint('<', '1.0'), Link::TYPE_REQUIRE),
));
$this->reposComplete();
@@ -749,11 +749,11 @@ class SolverTest extends TestCase
$this->repo->addPackage($packageTwigBridge = $this->getPackage('symfony/twig-bridge', '2.0'));
$packageTwigBridge->setRequires(array(
- 'twig/twig' => new Link('symfony/twig-bridge', 'twig/twig', $this->getVersionConstraint('<', '2.0'), 'requires'),
+ 'twig/twig' => new Link('symfony/twig-bridge', 'twig/twig', $this->getVersionConstraint('<', '2.0'), Link::TYPE_REQUIRE),
));
$packageSymfony->setReplaces(array(
- 'symfony/twig-bridge' => new Link('symfony/symfony', 'symfony/twig-bridge', $this->getVersionConstraint('==', '2.0'), 'replaces'),
+ 'symfony/twig-bridge' => new Link('symfony/symfony', 'symfony/twig-bridge', $this->getVersionConstraint('==', '2.0'), Link::TYPE_REPLACE),
));
$this->reposComplete();
@@ -774,10 +774,10 @@ class SolverTest extends TestCase
$this->repo->addPackage($packageA2 = $this->getPackage('A', '2.0'));
$packageA2->setRequires(array(
- 'b' => new Link('A', 'B', $this->getVersionConstraint('==', '2.0'), 'requires', '== 2.0'),
+ 'b' => new Link('A', 'B', $this->getVersionConstraint('==', '2.0'), Link::TYPE_REQUIRE, '== 2.0'),
));
$packageB->setRequires(array(
- 'a' => new Link('B', 'A', $this->getVersionConstraint('>=', '2.0'), 'requires'),
+ 'a' => new Link('B', 'A', $this->getVersionConstraint('>=', '2.0'), Link::TYPE_REQUIRE),
));
$this->repo->addPackage($packageA2Alias = $this->getAliasPackage($packageA2, '1.1'));
@@ -799,7 +799,7 @@ class SolverTest extends TestCase
$this->repo->addPackage($packageB = $this->getPackage('B', '1.0'));
$packageB->setRequires(array(
- 'a' => new Link('B', 'A', $this->getVersionConstraint('<', '2.0'), 'requires'),
+ 'a' => new Link('B', 'A', $this->getVersionConstraint('<', '2.0'), Link::TYPE_REQUIRE),
));
$this->repo->addPackage($packageAAlias = $this->getAliasPackage($packageA, '1.1'));
@@ -840,29 +840,29 @@ class SolverTest extends TestCase
$this->repo->addPackage($packageG3 = $this->getPackage('G', '3.0'));
$packageA->setRequires(array(
- 'b' => new Link('A', 'B', $this->getVersionConstraint('==', '1.0'), 'requires'),
- 'c' => new Link('A', 'C', $this->getVersionConstraint('>=', '1.0'), 'requires'),
- 'd' => new Link('A', 'D', $this->getVersionConstraint('==', '1.0'), 'requires'),
+ 'b' => new Link('A', 'B', $this->getVersionConstraint('==', '1.0'), Link::TYPE_REQUIRE),
+ 'c' => new Link('A', 'C', $this->getVersionConstraint('>=', '1.0'), Link::TYPE_REQUIRE),
+ 'd' => new Link('A', 'D', $this->getVersionConstraint('==', '1.0'), Link::TYPE_REQUIRE),
));
$packageB->setRequires(array(
- 'e' => new Link('B', 'E', $this->getVersionConstraint('==', '1.0'), 'requires'),
+ 'e' => new Link('B', 'E', $this->getVersionConstraint('==', '1.0'), Link::TYPE_REQUIRE),
));
$packageC1->setRequires(array(
- 'f' => new Link('C', 'F', $this->getVersionConstraint('==', '1.0'), 'requires'),
+ 'f' => new Link('C', 'F', $this->getVersionConstraint('==', '1.0'), Link::TYPE_REQUIRE),
));
$packageC2->setRequires(array(
- 'f' => new Link('C', 'F', $this->getVersionConstraint('==', '1.0'), 'requires'),
- 'g' => new Link('C', 'G', $this->getVersionConstraint('>=', '1.0'), 'requires'),
+ 'f' => new Link('C', 'F', $this->getVersionConstraint('==', '1.0'), Link::TYPE_REQUIRE),
+ 'g' => new Link('C', 'G', $this->getVersionConstraint('>=', '1.0'), Link::TYPE_REQUIRE),
));
$packageD->setRequires(array(
- 'f' => new Link('D', 'F', $this->getVersionConstraint('>=', '1.0'), 'requires'),
+ 'f' => new Link('D', 'F', $this->getVersionConstraint('>=', '1.0'), Link::TYPE_REQUIRE),
));
$packageE->setRequires(array(
- 'g' => new Link('E', 'G', $this->getVersionConstraint('<=', '2.0'), 'requires'),
+ 'g' => new Link('E', 'G', $this->getVersionConstraint('<=', '2.0'), Link::TYPE_REQUIRE),
));
$this->reposComplete();
diff --git a/tests/Composer/Test/DependencyResolver/TransactionTest.php b/tests/Composer/Test/DependencyResolver/TransactionTest.php
index b5d209041..809977402 100644
--- a/tests/Composer/Test/DependencyResolver/TransactionTest.php
+++ b/tests/Composer/Test/DependencyResolver/TransactionTest.php
@@ -45,10 +45,10 @@ class TransactionTest extends TestCase
);
$packageD->setRequires(array(
- 'f/f' => new Link('d/d', 'f/f', $this->getVersionConstraint('>', '0.2'), 'requires'),
- 'g/provider' => new Link('d/d', 'g/provider', $this->getVersionConstraint('>', '0.2'), 'requires'),
+ 'f/f' => new Link('d/d', 'f/f', $this->getVersionConstraint('>', '0.2'), Link::TYPE_REQUIRE),
+ 'g/provider' => new Link('d/d', 'g/provider', $this->getVersionConstraint('>', '0.2'), Link::TYPE_REQUIRE),
));
- $packageG->setProvides(array('g/provider' => new Link('g/g', 'g/provider', $this->getVersionConstraint('==', '1.0.0'), 'provides')));
+ $packageG->setProvides(array('g/provider' => new Link('g/g', 'g/provider', $this->getVersionConstraint('==', '1.0.0'), Link::TYPE_PROVIDE)));
$expectedOperations = array(
array('job' => 'uninstall', 'package' => $packageC),
diff --git a/tests/Composer/Test/InstallerTest.php b/tests/Composer/Test/InstallerTest.php
index 0be8af711..a3cf8cea0 100644
--- a/tests/Composer/Test/InstallerTest.php
+++ b/tests/Composer/Test/InstallerTest.php
@@ -145,11 +145,11 @@ class InstallerTest extends TestCase
$a = $this->getPackage('A', '1.0.0', 'Composer\Package\RootPackage');
$a->setRequires(array(
- 'b' => new Link('A', 'B', $v = $this->getVersionConstraint('=', '1.0.0'), 'requires', $v->getPrettyString()),
+ 'b' => new Link('A', 'B', $v = $this->getVersionConstraint('=', '1.0.0'), Link::TYPE_REQUIRE, $v->getPrettyString()),
));
$b = $this->getPackage('B', '1.0.0');
$b->setRequires(array(
- 'a' => new Link('B', 'A', $v = $this->getVersionConstraint('=', '1.0.0'), 'requires', $v->getPrettyString()),
+ 'a' => new Link('B', 'A', $v = $this->getVersionConstraint('=', '1.0.0'), Link::TYPE_REQUIRE, $v->getPrettyString()),
));
$cases[] = array(
@@ -165,11 +165,11 @@ class InstallerTest extends TestCase
$a = $this->getPackage('A', '1.0.0', 'Composer\Package\RootPackage');
$a->setRequires(array(
- 'b' => new Link('A', 'B', $v = $this->getVersionConstraint('=', '1.0.0'), 'requires', $v->getPrettyString()),
+ 'b' => new Link('A', 'B', $v = $this->getVersionConstraint('=', '1.0.0'), Link::TYPE_REQUIRE, $v->getPrettyString()),
));
$b = $this->getPackage('B', '1.0.0');
$b->setRequires(array(
- 'a' => new Link('B', 'A', $v = $this->getVersionConstraint('=', '1.0.0'), 'requires', $v->getPrettyString()),
+ 'a' => new Link('B', 'A', $v = $this->getVersionConstraint('=', '1.0.0'), Link::TYPE_REQUIRE, $v->getPrettyString()),
));
$cases[] = array(
diff --git a/tests/Composer/Test/Package/Dumper/ArrayDumperTest.php b/tests/Composer/Test/Package/Dumper/ArrayDumperTest.php
index ca7d60902..dbcdf848f 100644
--- a/tests/Composer/Test/Package/Dumper/ArrayDumperTest.php
+++ b/tests/Composer/Test/Package/Dumper/ArrayDumperTest.php
@@ -172,7 +172,7 @@ class ArrayDumperTest extends TestCase
),
array(
'require',
- array(new Link('foo', 'foo/bar', new Constraint('=', '1.0.0.0'), 'requires', '1.0.0')),
+ array(new Link('foo', 'foo/bar', new Constraint('=', '1.0.0.0'), Link::TYPE_REQUIRE, '1.0.0')),
'requires',
array('foo/bar' => '1.0.0'),
),
@@ -197,13 +197,13 @@ class ArrayDumperTest extends TestCase
),
array(
'require',
- array(new Link('foo', 'foo/bar', new Constraint('=', '1.0.0.0'), 'requires', '1.0.0'), new Link('bar', 'bar/baz', new Constraint('=', '1.0.0.0'), 'requires', '1.0.0')),
+ array(new Link('foo', 'foo/bar', new Constraint('=', '1.0.0.0'), Link::TYPE_REQUIRE, '1.0.0'), new Link('bar', 'bar/baz', new Constraint('=', '1.0.0.0'), Link::TYPE_REQUIRE, '1.0.0')),
'requires',
array('bar/baz' => '1.0.0', 'foo/bar' => '1.0.0'),
),
array(
'require-dev',
- array(new Link('foo', 'foo/bar', new Constraint('=', '1.0.0.0'), 'requires', '1.0.0'), new Link('bar', 'bar/baz', new Constraint('=', '1.0.0.0'), 'requires', '1.0.0')),
+ array(new Link('foo', 'foo/bar', new Constraint('=', '1.0.0.0'), Link::TYPE_REQUIRE, '1.0.0'), new Link('bar', 'bar/baz', new Constraint('=', '1.0.0.0'), Link::TYPE_REQUIRE, '1.0.0')),
'devRequires',
array('bar/baz' => '1.0.0', 'foo/bar' => '1.0.0'),
),
@@ -215,19 +215,19 @@ class ArrayDumperTest extends TestCase
),
array(
'provide',
- array(new Link('foo', 'foo/bar', new Constraint('=', '1.0.0.0'), 'requires', '1.0.0'), new Link('bar', 'bar/baz', new Constraint('=', '1.0.0.0'), 'requires', '1.0.0')),
+ array(new Link('foo', 'foo/bar', new Constraint('=', '1.0.0.0'), Link::TYPE_REQUIRE, '1.0.0'), new Link('bar', 'bar/baz', new Constraint('=', '1.0.0.0'), Link::TYPE_REQUIRE, '1.0.0')),
'provides',
array('bar/baz' => '1.0.0', 'foo/bar' => '1.0.0'),
),
array(
'replace',
- array(new Link('foo', 'foo/bar', new Constraint('=', '1.0.0.0'), 'requires', '1.0.0'), new Link('bar', 'bar/baz', new Constraint('=', '1.0.0.0'), 'requires', '1.0.0')),
+ array(new Link('foo', 'foo/bar', new Constraint('=', '1.0.0.0'), Link::TYPE_REQUIRE, '1.0.0'), new Link('bar', 'bar/baz', new Constraint('=', '1.0.0.0'), Link::TYPE_REQUIRE, '1.0.0')),
'replaces',
array('bar/baz' => '1.0.0', 'foo/bar' => '1.0.0'),
),
array(
'conflict',
- array(new Link('foo', 'foo/bar', new Constraint('=', '1.0.0.0'), 'requires', '1.0.0'), new Link('bar', 'bar/baz', new Constraint('=', '1.0.0.0'), 'requires', '1.0.0')),
+ array(new Link('foo', 'foo/bar', new Constraint('=', '1.0.0.0'), Link::TYPE_REQUIRE, '1.0.0'), new Link('bar', 'bar/baz', new Constraint('=', '1.0.0.0'), Link::TYPE_REQUIRE, '1.0.0')),
'conflicts',
array('bar/baz' => '1.0.0', 'foo/bar' => '1.0.0'),
),
diff --git a/tests/Composer/Test/Package/Version/VersionSelectorTest.php b/tests/Composer/Test/Package/Version/VersionSelectorTest.php
index 14d00b438..66b380e7e 100644
--- a/tests/Composer/Test/Package/Version/VersionSelectorTest.php
+++ b/tests/Composer/Test/Package/Version/VersionSelectorTest.php
@@ -57,9 +57,9 @@ class VersionSelectorTest extends TestCase
$parser = new VersionParser;
$package1 = $this->createPackage('1.0.0');
- $package1->setRequires(array('php' => new Link($packageName, 'php', $parser->parseConstraints('>=5.4'), 'requires', '>=5.4')));
+ $package1->setRequires(array('php' => new Link($packageName, 'php', $parser->parseConstraints('>=5.4'), Link::TYPE_REQUIRE, '>=5.4')));
$package2 = $this->createPackage('2.0.0');
- $package2->setRequires(array('php' => new Link($packageName, 'php', $parser->parseConstraints('>=5.6'), 'requires', '>=5.6')));
+ $package2->setRequires(array('php' => new Link($packageName, 'php', $parser->parseConstraints('>=5.6'), Link::TYPE_REQUIRE, '>=5.6')));
$packages = array($package1, $package2);
$repositorySet->expects($this->any())
@@ -83,9 +83,9 @@ class VersionSelectorTest extends TestCase
$parser = new VersionParser;
$package1 = $this->createPackage('1.0.0');
- $package1->setRequires(array('ext-zip' => new Link($packageName, 'ext-zip', $parser->parseConstraints('^5.2'), 'requires', '^5.2')));
+ $package1->setRequires(array('ext-zip' => new Link($packageName, 'ext-zip', $parser->parseConstraints('^5.2'), Link::TYPE_REQUIRE, '^5.2')));
$package2 = $this->createPackage('2.0.0');
- $package2->setRequires(array('ext-zip' => new Link($packageName, 'ext-zip', $parser->parseConstraints('^5.4'), 'requires', '^5.4')));
+ $package2->setRequires(array('ext-zip' => new Link($packageName, 'ext-zip', $parser->parseConstraints('^5.4'), Link::TYPE_REQUIRE, '^5.4')));
$packages = array($package1, $package2);
$repositorySet->expects($this->any())
@@ -109,9 +109,9 @@ class VersionSelectorTest extends TestCase
$parser = new VersionParser;
$package1 = $this->createPackage('1.0.0');
- $package1->setRequires(array('composer-runtime-api' => new Link($packageName, 'composer-runtime-api', $parser->parseConstraints('^1.0'), 'requires', '^1.0')));
+ $package1->setRequires(array('composer-runtime-api' => new Link($packageName, 'composer-runtime-api', $parser->parseConstraints('^1.0'), Link::TYPE_REQUIRE, '^1.0')));
$package2 = $this->createPackage('1.1.0');
- $package2->setRequires(array('composer-runtime-api' => new Link($packageName, 'composer-runtime-api', $parser->parseConstraints('^2.0'), 'requires', '^2.0')));
+ $package2->setRequires(array('composer-runtime-api' => new Link($packageName, 'composer-runtime-api', $parser->parseConstraints('^2.0'), Link::TYPE_REQUIRE, '^2.0')));
$packages = array($package1, $package2);
$repositorySet->expects($this->any())