replace all occurences in code and comments
parent
1ccfc8eb96
commit
a1427d7fd6
|
@ -36,7 +36,7 @@ use Composer\Json\JsonFile;
|
|||
use Composer\Config\JsonConfigSource;
|
||||
use Composer\Util\Filesystem;
|
||||
use Composer\Util\RemoteFilesystem;
|
||||
use Composer\Package\Version\VersionParser;
|
||||
use Composer\Semver\VersionParser;
|
||||
|
||||
/**
|
||||
* Install a package as new project into new directory.
|
||||
|
|
|
@ -19,7 +19,7 @@ use Composer\Package\BasePackage;
|
|||
use Composer\Package\Version\VersionSelector;
|
||||
use Composer\Repository\CompositeRepository;
|
||||
use Composer\Repository\PlatformRepository;
|
||||
use Composer\Package\Version\VersionParser;
|
||||
use Composer\Semver\VersionParser;
|
||||
use Composer\Util\ProcessExecutor;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
|
|
|
@ -20,7 +20,7 @@ use Composer\Factory;
|
|||
use Composer\Installer;
|
||||
use Composer\Json\JsonFile;
|
||||
use Composer\Json\JsonManipulator;
|
||||
use Composer\Package\Version\VersionParser;
|
||||
use Composer\Semver\VersionParser;
|
||||
use Composer\Plugin\CommandEvent;
|
||||
use Composer\Plugin\PluginEvents;
|
||||
use Composer\Repository\CompositeRepository;
|
||||
|
|
|
@ -16,7 +16,7 @@ use Composer\DependencyResolver\Pool;
|
|||
use Composer\DependencyResolver\DefaultPolicy;
|
||||
use Composer\Factory;
|
||||
use Composer\Package\CompletePackageInterface;
|
||||
use Composer\Package\Version\VersionParser;
|
||||
use Composer\Semver\VersionParser;
|
||||
use Composer\Plugin\CommandEvent;
|
||||
use Composer\Plugin\PluginEvents;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace Composer\DependencyResolver;
|
|||
use Composer\Package\PackageInterface;
|
||||
use Composer\Package\AliasPackage;
|
||||
use Composer\Package\BasePackage;
|
||||
use Composer\Package\LinkConstraint\VersionConstraint;
|
||||
use Composer\Semver\Constraint\Constraint;
|
||||
|
||||
/**
|
||||
* @author Nils Adermann <naderman@naderman.de>
|
||||
|
@ -38,8 +38,8 @@ class DefaultPolicy implements PolicyInterface
|
|||
return BasePackage::$stabilities[$stabA] < BasePackage::$stabilities[$stabB];
|
||||
}
|
||||
|
||||
$constraint = new VersionConstraint($operator, $b->getVersion());
|
||||
$version = new VersionConstraint('==', $a->getVersion());
|
||||
$constraint = new Constraint($operator, $b->getVersion());
|
||||
$version = new Constraint('==', $a->getVersion());
|
||||
|
||||
return $constraint->matchSpecific($version, true);
|
||||
}
|
||||
|
@ -194,7 +194,7 @@ class DefaultPolicy implements PolicyInterface
|
|||
foreach ($source->getReplaces() as $link) {
|
||||
if ($link->getTarget() === $target->getName()
|
||||
// && (null === $link->getConstraint() ||
|
||||
// $link->getConstraint()->matches(new VersionConstraint('==', $target->getVersion())))) {
|
||||
// $link->getConstraint()->matches(new Constraint('==', $target->getVersion())))) {
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -14,10 +14,10 @@ namespace Composer\DependencyResolver;
|
|||
|
||||
use Composer\Package\BasePackage;
|
||||
use Composer\Package\AliasPackage;
|
||||
use Composer\Package\Version\VersionParser;
|
||||
use Composer\Package\LinkConstraint\LinkConstraintInterface;
|
||||
use Composer\Package\LinkConstraint\VersionConstraint;
|
||||
use Composer\Package\LinkConstraint\EmptyConstraint;
|
||||
use Composer\Semver\VersionParser;
|
||||
use Composer\Semver\Constraint\ConstraintInterface;
|
||||
use Composer\Semver\Constraint\Constraint;
|
||||
use Composer\Semver\Constraint\EmptyConstraint;
|
||||
use Composer\Repository\RepositoryInterface;
|
||||
use Composer\Repository\CompositeRepository;
|
||||
use Composer\Repository\ComposerRepository;
|
||||
|
@ -171,14 +171,14 @@ class Pool implements \Countable
|
|||
/**
|
||||
* Searches all packages providing the given package name and match the constraint
|
||||
*
|
||||
* @param string $name The package name to be searched for
|
||||
* @param LinkConstraintInterface $constraint A constraint that all returned
|
||||
* packages must match or null to return all
|
||||
* @param bool $mustMatchName Whether the name of returned packages
|
||||
* must match the given name
|
||||
* @return PackageInterface[] A set of packages
|
||||
* @param string $name The package name to be searched for
|
||||
* @param ConstraintInterface $constraint A constraint that all returned
|
||||
* packages must match or null to return all
|
||||
* @param bool $mustMatchName Whether the name of returned packages
|
||||
* must match the given name
|
||||
* @return PackageInterface[] A set of packages
|
||||
*/
|
||||
public function whatProvides($name, LinkConstraintInterface $constraint = null, $mustMatchName = false)
|
||||
public function whatProvides($name, ConstraintInterface $constraint = null, $mustMatchName = false)
|
||||
{
|
||||
$key = ((int) $mustMatchName).$constraint;
|
||||
if (isset($this->providerCache[$name][$key])) {
|
||||
|
@ -317,12 +317,12 @@ class Pool implements \Countable
|
|||
* Checks if the package matches the given constraint directly or through
|
||||
* provided or replaced packages
|
||||
*
|
||||
* @param array|PackageInterface $candidate
|
||||
* @param string $name Name of the package to be matched
|
||||
* @param LinkConstraintInterface $constraint The constraint to verify
|
||||
* @return int One of the MATCH* constants of this class or 0 if there is no match
|
||||
* @param array|PackageInterface $candidate
|
||||
* @param string $name Name of the package to be matched
|
||||
* @param ConstraintInterface $constraint The constraint to verify
|
||||
* @return int One of the MATCH* constants of this class or 0 if there is no match
|
||||
*/
|
||||
private function match($candidate, $name, LinkConstraintInterface $constraint = null)
|
||||
private function match($candidate, $name, ConstraintInterface $constraint = null)
|
||||
{
|
||||
$candidateName = $candidate->getName();
|
||||
$candidateVersion = $candidate->getVersion();
|
||||
|
@ -336,7 +336,7 @@ class Pool implements \Countable
|
|||
}
|
||||
|
||||
if ($candidateName === $name) {
|
||||
$pkgConstraint = new VersionConstraint('==', $candidateVersion);
|
||||
$pkgConstraint = new Constraint('==', $candidateVersion);
|
||||
|
||||
if ($constraint === null || $constraint->matches($pkgConstraint)) {
|
||||
return $requireFilter->matches($pkgConstraint) ? self::MATCH : self::MATCH_FILTERED;
|
||||
|
|
|
@ -222,7 +222,7 @@ class Problem
|
|||
/**
|
||||
* Turns a constraint into text usable in a sentence describing a job
|
||||
*
|
||||
* @param \Composer\Package\LinkConstraint\LinkConstraintInterface $constraint
|
||||
* @param \Composer\Semver\Constraint\ConstraintInterface $constraint
|
||||
* @return string
|
||||
*/
|
||||
protected function constraintToText($constraint)
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
namespace Composer\DependencyResolver;
|
||||
|
||||
use Composer\Package\LinkConstraint\LinkConstraintInterface;
|
||||
use Composer\Semver\Constraint\ConstraintInterface;
|
||||
|
||||
/**
|
||||
* @author Nils Adermann <naderman@naderman.de>
|
||||
|
@ -26,17 +26,17 @@ class Request
|
|||
$this->jobs = array();
|
||||
}
|
||||
|
||||
public function install($packageName, LinkConstraintInterface $constraint = null)
|
||||
public function install($packageName, ConstraintInterface $constraint = null)
|
||||
{
|
||||
$this->addJob($packageName, 'install', $constraint);
|
||||
}
|
||||
|
||||
public function update($packageName, LinkConstraintInterface $constraint = null)
|
||||
public function update($packageName, ConstraintInterface $constraint = null)
|
||||
{
|
||||
$this->addJob($packageName, 'update', $constraint);
|
||||
}
|
||||
|
||||
public function remove($packageName, LinkConstraintInterface $constraint = null)
|
||||
public function remove($packageName, ConstraintInterface $constraint = null)
|
||||
{
|
||||
$this->addJob($packageName, 'remove', $constraint);
|
||||
}
|
||||
|
@ -46,12 +46,12 @@ class Request
|
|||
*
|
||||
* These jobs will not be tempered with by the solver
|
||||
*/
|
||||
public function fix($packageName, LinkConstraintInterface $constraint = null)
|
||||
public function fix($packageName, ConstraintInterface $constraint = null)
|
||||
{
|
||||
$this->addJob($packageName, 'install', $constraint, true);
|
||||
}
|
||||
|
||||
protected function addJob($packageName, $cmd, LinkConstraintInterface $constraint = null, $fixed = false)
|
||||
protected function addJob($packageName, $cmd, ConstraintInterface $constraint = null, $fixed = false)
|
||||
{
|
||||
$packageName = strtolower($packageName);
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ use Composer\Util\RemoteFilesystem;
|
|||
use Symfony\Component\Console\Formatter\OutputFormatterStyle;
|
||||
use Composer\EventDispatcher\EventDispatcher;
|
||||
use Composer\Autoload\AutoloadGenerator;
|
||||
use Composer\Package\Version\VersionParser;
|
||||
use Composer\Semver\VersionParser;
|
||||
|
||||
/**
|
||||
* Creates a configured instance of composer.
|
||||
|
|
|
@ -34,7 +34,7 @@ use Composer\Json\JsonFile;
|
|||
use Composer\Package\AliasPackage;
|
||||
use Composer\Package\CompletePackage;
|
||||
use Composer\Package\Link;
|
||||
use Composer\Package\LinkConstraint\VersionConstraint;
|
||||
use Composer\Semver\Constraint\Constraint;
|
||||
use Composer\Package\Locker;
|
||||
use Composer\Package\PackageInterface;
|
||||
use Composer\Package\RootPackageInterface;
|
||||
|
@ -428,7 +428,7 @@ class Installer
|
|||
&& $this->installationManager->isPackageInstalled($localRepo, $package)
|
||||
) {
|
||||
$removedUnstablePackages[$package->getName()] = true;
|
||||
$request->remove($package->getName(), new VersionConstraint('=', $package->getVersion()));
|
||||
$request->remove($package->getName(), new Constraint('=', $package->getVersion()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -467,7 +467,7 @@ class Installer
|
|||
foreach ($currentPackages as $curPackage) {
|
||||
if ($curPackage->getName() === $candidate) {
|
||||
if (!$this->isUpdateable($curPackage) && !isset($removedUnstablePackages[$curPackage->getName()])) {
|
||||
$constraint = new VersionConstraint('=', $curPackage->getVersion());
|
||||
$constraint = new Constraint('=', $curPackage->getVersion());
|
||||
$request->install($curPackage->getName(), $constraint);
|
||||
}
|
||||
break;
|
||||
|
@ -487,7 +487,7 @@ class Installer
|
|||
if (isset($aliases[$package->getName()][$version])) {
|
||||
$version = $aliases[$package->getName()][$version]['alias_normalized'];
|
||||
}
|
||||
$constraint = new VersionConstraint('=', $version);
|
||||
$constraint = new Constraint('=', $version);
|
||||
$constraint->setPrettyString($package->getPrettyVersion());
|
||||
$request->install($package->getName(), $constraint);
|
||||
}
|
||||
|
@ -712,7 +712,7 @@ class Installer
|
|||
|
||||
$requires = array();
|
||||
foreach ($lockedRepository->getPackages() as $package) {
|
||||
$constraint = new VersionConstraint('=', $package->getVersion());
|
||||
$constraint = new Constraint('=', $package->getVersion());
|
||||
$constraint->setPrettyString($package->getPrettyVersion());
|
||||
$requires[$package->getName()] = $constraint;
|
||||
}
|
||||
|
@ -774,7 +774,7 @@ class Installer
|
|||
{
|
||||
$request = new Request();
|
||||
|
||||
$constraint = new VersionConstraint('=', $rootPackage->getVersion());
|
||||
$constraint = new Constraint('=', $rootPackage->getVersion());
|
||||
$constraint->setPrettyString($rootPackage->getPrettyVersion());
|
||||
$request->install($rootPackage->getName(), $constraint);
|
||||
|
||||
|
@ -788,7 +788,7 @@ class Installer
|
|||
// to prevent the solver trying to remove or update those
|
||||
$provided = $rootPackage->getProvides();
|
||||
foreach ($fixedPackages as $package) {
|
||||
$constraint = new VersionConstraint('=', $package->getVersion());
|
||||
$constraint = new Constraint('=', $package->getVersion());
|
||||
$constraint->setPrettyString($package->getPrettyVersion());
|
||||
|
||||
// skip platform packages that are provided by the root package
|
||||
|
@ -893,7 +893,7 @@ class Installer
|
|||
}
|
||||
|
||||
// find similar packages (name/version) in all repositories
|
||||
$matches = $pool->whatProvides($package->getName(), new VersionConstraint('=', $package->getVersion()));
|
||||
$matches = $pool->whatProvides($package->getName(), new Constraint('=', $package->getVersion()));
|
||||
foreach ($matches as $index => $match) {
|
||||
// skip local packages
|
||||
if (!in_array($match->getRepository(), $repositories, true)) {
|
||||
|
@ -1003,7 +1003,7 @@ class Installer
|
|||
|
||||
foreach ($localRepo->getCanonicalPackages() as $package) {
|
||||
// find similar packages (name/version) in all repositories
|
||||
$matches = $pool->whatProvides($package->getName(), new VersionConstraint('=', $package->getVersion()));
|
||||
$matches = $pool->whatProvides($package->getName(), new Constraint('=', $package->getVersion()));
|
||||
foreach ($matches as $index => $match) {
|
||||
// skip local packages
|
||||
if (!in_array($match->getRepository(), $repositories, true)) {
|
||||
|
|
|
@ -12,8 +12,8 @@
|
|||
|
||||
namespace Composer\Package;
|
||||
|
||||
use Composer\Package\LinkConstraint\VersionConstraint;
|
||||
use Composer\Package\Version\VersionParser;
|
||||
use Composer\Semver\Constraint\Constraint;
|
||||
use Composer\Semver\VersionParser;
|
||||
|
||||
/**
|
||||
* @author Jordi Boggiano <j.boggiano@seld.be>
|
||||
|
@ -174,14 +174,14 @@ class AliasPackage extends BasePackage implements CompletePackageInterface
|
|||
foreach ($links as $link) {
|
||||
// link is self.version, but must be replacing also the replaced version
|
||||
if ('self.version' === $link->getPrettyConstraint()) {
|
||||
$newLinks[] = new Link($link->getSource(), $link->getTarget(), new VersionConstraint('=', $this->version), $linkType, $this->prettyVersion);
|
||||
$newLinks[] = new Link($link->getSource(), $link->getTarget(), new Constraint('=', $this->version), $linkType, $this->prettyVersion);
|
||||
}
|
||||
}
|
||||
$links = array_merge($links, $newLinks);
|
||||
} else {
|
||||
foreach ($links as $index => $link) {
|
||||
if ('self.version' === $link->getPrettyConstraint()) {
|
||||
$links[$index] = new Link($link->getSource(), $link->getTarget(), new VersionConstraint('=', $this->version), $linkType, $this->prettyVersion);
|
||||
$links[$index] = new Link($link->getSource(), $link->getTarget(), new Constraint('=', $this->version), $linkType, $this->prettyVersion);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
namespace Composer\Package;
|
||||
|
||||
use Composer\Package\LinkConstraint\LinkConstraintInterface;
|
||||
use Composer\Semver\Constraint\ConstraintInterface;
|
||||
|
||||
/**
|
||||
* Represents a link between two packages, represented by their names
|
||||
|
@ -32,7 +32,7 @@ class Link
|
|||
protected $target;
|
||||
|
||||
/**
|
||||
* @var LinkConstraintInterface|null
|
||||
* @var ConstraintInterface|null
|
||||
*/
|
||||
protected $constraint;
|
||||
|
||||
|
@ -49,13 +49,13 @@ class Link
|
|||
/**
|
||||
* Creates a new package link.
|
||||
*
|
||||
* @param string $source
|
||||
* @param string $target
|
||||
* @param LinkConstraintInterface|null $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|null $constraint Constraint applying to the target of this link
|
||||
* @param string $description Used to create a descriptive string representation
|
||||
* @param string|null $prettyConstraint
|
||||
*/
|
||||
public function __construct($source, $target, LinkConstraintInterface $constraint = null, $description = 'relates to', $prettyConstraint = null)
|
||||
public function __construct($source, $target, ConstraintInterface $constraint = null, $description = 'relates to', $prettyConstraint = null)
|
||||
{
|
||||
$this->source = strtolower($source);
|
||||
$this->target = strtolower($target);
|
||||
|
@ -81,7 +81,7 @@ class Link
|
|||
}
|
||||
|
||||
/**
|
||||
* @return LinkConstraintInterface|null
|
||||
* @return ConstraintInterface|null
|
||||
*/
|
||||
public function getConstraint()
|
||||
{
|
||||
|
|
|
@ -17,7 +17,7 @@ use Composer\Package\AliasPackage;
|
|||
use Composer\Package\Link;
|
||||
use Composer\Package\RootAliasPackage;
|
||||
use Composer\Package\RootPackageInterface;
|
||||
use Composer\Package\Version\VersionParser;
|
||||
use Composer\Semver\VersionParser;
|
||||
|
||||
/**
|
||||
* @author Konstantin Kudryashiv <ever.zet@gmail.com>
|
||||
|
|
|
@ -17,7 +17,7 @@ use Composer\Package\AliasPackage;
|
|||
use Composer\Config;
|
||||
use Composer\Factory;
|
||||
use Composer\Package\Version\VersionGuesser;
|
||||
use Composer\Package\Version\VersionParser;
|
||||
use Composer\Semver\VersionParser;
|
||||
use Composer\Repository\RepositoryManager;
|
||||
use Composer\Util\ProcessExecutor;
|
||||
|
||||
|
|
|
@ -14,8 +14,8 @@ namespace Composer\Package\Loader;
|
|||
|
||||
use Composer\Package;
|
||||
use Composer\Package\BasePackage;
|
||||
use Composer\Package\LinkConstraint\VersionConstraint;
|
||||
use Composer\Package\Version\VersionParser;
|
||||
use Composer\Semver\Constraint\Constraint;
|
||||
use Composer\Semver\VersionParser;
|
||||
use Composer\Repository\PlatformRepository;
|
||||
|
||||
/**
|
||||
|
@ -149,7 +149,7 @@ class ValidatingArrayLoader implements LoaderInterface
|
|||
}
|
||||
}
|
||||
|
||||
$unboundConstraint = new VersionConstraint('=', $this->versionParser->normalize('dev-master'));
|
||||
$unboundConstraint = new Constraint('=', $this->versionParser->normalize('dev-master'));
|
||||
|
||||
foreach (array_keys(BasePackage::$supportedLinkTypes) as $linkType) {
|
||||
if ($this->validateArray($linkType) && isset($this->config[$linkType])) {
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
namespace Composer\Package;
|
||||
|
||||
use Composer\Package\Version\VersionParser;
|
||||
use Composer\Semver\VersionParser;
|
||||
use Composer\Util\ComposerMirror;
|
||||
|
||||
/**
|
||||
|
|
|
@ -15,6 +15,7 @@ namespace Composer\Package\Version;
|
|||
use Composer\Config;
|
||||
use Composer\Repository\Vcs\HgDriver;
|
||||
use Composer\IO\NullIO;
|
||||
use Composer\Semver\VersionParser;
|
||||
use Composer\Util\Git as GitUtil;
|
||||
use Composer\Util\ProcessExecutor;
|
||||
use Composer\Util\Svn as SvnUtil;
|
||||
|
|
|
@ -16,6 +16,7 @@ use Composer\DependencyResolver\Pool;
|
|||
use Composer\Package\PackageInterface;
|
||||
use Composer\Package\Loader\ArrayLoader;
|
||||
use Composer\Package\Dumper\ArrayDumper;
|
||||
use Composer\Semver\VersionParser;
|
||||
|
||||
/**
|
||||
* Selects the best possible version for a package
|
||||
|
|
|
@ -16,12 +16,12 @@ use Composer\Composer;
|
|||
use Composer\EventDispatcher\EventSubscriberInterface;
|
||||
use Composer\IO\IOInterface;
|
||||
use Composer\Package\Package;
|
||||
use Composer\Package\Version\VersionParser;
|
||||
use Composer\Semver\VersionParser;
|
||||
use Composer\Repository\RepositoryInterface;
|
||||
use Composer\Package\AliasPackage;
|
||||
use Composer\Package\PackageInterface;
|
||||
use Composer\Package\Link;
|
||||
use Composer\Package\LinkConstraint\VersionConstraint;
|
||||
use Composer\Semver\Constraint\Constraint;
|
||||
use Composer\DependencyResolver\Pool;
|
||||
|
||||
/**
|
||||
|
@ -131,7 +131,7 @@ class PluginManager
|
|||
}
|
||||
|
||||
$currentPluginApiVersion = $this->getPluginApiVersion();
|
||||
$currentPluginApiConstraint = new VersionConstraint('==', $this->versionParser->normalize($currentPluginApiVersion));
|
||||
$currentPluginApiConstraint = new Constraint('==', $this->versionParser->normalize($currentPluginApiVersion));
|
||||
|
||||
if (!$requiresComposer->matches($currentPluginApiConstraint)) {
|
||||
$this->io->writeError('<warning>The "' . $package->getName() . '" plugin was skipped because it requires a Plugin API version ("' . $requiresComposer->getPrettyString() . '") that does not match your Composer installation ("' . $currentPluginApiVersion . '"). You may need to run composer update with the "--no-plugins" option.</warning>');
|
||||
|
|
|
@ -15,9 +15,9 @@ namespace Composer\Repository;
|
|||
use Composer\Package\AliasPackage;
|
||||
use Composer\Package\PackageInterface;
|
||||
use Composer\Package\CompletePackageInterface;
|
||||
use Composer\Package\Version\VersionParser;
|
||||
use Composer\Package\LinkConstraint\LinkConstraintInterface;
|
||||
use Composer\Package\LinkConstraint\VersionConstraint;
|
||||
use Composer\Semver\VersionParser;
|
||||
use Composer\Semver\Constraint\ConstraintInterface;
|
||||
use Composer\Semver\Constraint\Constraint;
|
||||
|
||||
/**
|
||||
* A repository implementation that simply stores packages in an array
|
||||
|
@ -43,14 +43,14 @@ class ArrayRepository implements RepositoryInterface
|
|||
{
|
||||
$name = strtolower($name);
|
||||
|
||||
if (!$constraint instanceof LinkConstraintInterface) {
|
||||
if (!$constraint instanceof ConstraintInterface) {
|
||||
$versionParser = new VersionParser();
|
||||
$constraint = $versionParser->parseConstraints($constraint);
|
||||
}
|
||||
|
||||
foreach ($this->getPackages() as $package) {
|
||||
if ($name === $package->getName()) {
|
||||
$pkgConstraint = new VersionConstraint('==', $package->getVersion());
|
||||
$pkgConstraint = new Constraint('==', $package->getVersion());
|
||||
if ($constraint->matches($pkgConstraint)) {
|
||||
return $package;
|
||||
}
|
||||
|
@ -67,14 +67,14 @@ class ArrayRepository implements RepositoryInterface
|
|||
$name = strtolower($name);
|
||||
$packages = array();
|
||||
|
||||
if (null !== $constraint && !$constraint instanceof LinkConstraintInterface) {
|
||||
if (null !== $constraint && !$constraint instanceof ConstraintInterface) {
|
||||
$versionParser = new VersionParser();
|
||||
$constraint = $versionParser->parseConstraints($constraint);
|
||||
}
|
||||
|
||||
foreach ($this->getPackages() as $package) {
|
||||
if ($name === $package->getName()) {
|
||||
$pkgConstraint = new VersionConstraint('==', $package->getVersion());
|
||||
$pkgConstraint = new Constraint('==', $package->getVersion());
|
||||
if (null === $constraint || $constraint->matches($pkgConstraint)) {
|
||||
$packages[] = $package;
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace Composer\Repository;
|
|||
use Composer\Package\Loader\ArrayLoader;
|
||||
use Composer\Package\PackageInterface;
|
||||
use Composer\Package\AliasPackage;
|
||||
use Composer\Package\Version\VersionParser;
|
||||
use Composer\Semver\VersionParser;
|
||||
use Composer\DependencyResolver\Pool;
|
||||
use Composer\Json\JsonFile;
|
||||
use Composer\Cache;
|
||||
|
@ -25,8 +25,8 @@ use Composer\Util\RemoteFilesystem;
|
|||
use Composer\Plugin\PluginEvents;
|
||||
use Composer\Plugin\PreFileDownloadEvent;
|
||||
use Composer\EventDispatcher\EventDispatcher;
|
||||
use Composer\Package\LinkConstraint\LinkConstraintInterface;
|
||||
use Composer\Package\LinkConstraint\VersionConstraint;
|
||||
use Composer\Semver\Constraint\ConstraintInterface;
|
||||
use Composer\Semver\Constraint\Constraint;
|
||||
|
||||
/**
|
||||
* @author Jordi Boggiano <j.boggiano@seld.be>
|
||||
|
@ -107,7 +107,7 @@ class ComposerRepository extends ArrayRepository
|
|||
}
|
||||
|
||||
$name = strtolower($name);
|
||||
if (!$constraint instanceof LinkConstraintInterface) {
|
||||
if (!$constraint instanceof ConstraintInterface) {
|
||||
$versionParser = new VersionParser();
|
||||
$constraint = $versionParser->parseConstraints($constraint);
|
||||
}
|
||||
|
@ -117,7 +117,7 @@ class ComposerRepository extends ArrayRepository
|
|||
$packages = $this->whatProvides(new Pool('dev'), $providerName);
|
||||
foreach ($packages as $package) {
|
||||
if ($name === $package->getName()) {
|
||||
$pkgConstraint = new VersionConstraint('==', $package->getVersion());
|
||||
$pkgConstraint = new Constraint('==', $package->getVersion());
|
||||
if ($constraint->matches($pkgConstraint)) {
|
||||
return $package;
|
||||
}
|
||||
|
@ -138,7 +138,7 @@ class ComposerRepository extends ArrayRepository
|
|||
// normalize name
|
||||
$name = strtolower($name);
|
||||
|
||||
if (null !== $constraint && !$constraint instanceof LinkConstraintInterface) {
|
||||
if (null !== $constraint && !$constraint instanceof ConstraintInterface) {
|
||||
$versionParser = new VersionParser();
|
||||
$constraint = $versionParser->parseConstraints($constraint);
|
||||
}
|
||||
|
@ -150,7 +150,7 @@ class ComposerRepository extends ArrayRepository
|
|||
$candidates = $this->whatProvides(new Pool('dev'), $providerName);
|
||||
foreach ($candidates as $package) {
|
||||
if ($name === $package->getName()) {
|
||||
$pkgConstraint = new VersionConstraint('==', $package->getVersion());
|
||||
$pkgConstraint = new Constraint('==', $package->getVersion());
|
||||
if (null === $constraint || $constraint->matches($pkgConstraint)) {
|
||||
$packages[] = $package;
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ use Composer\Json\JsonFile;
|
|||
use Composer\Package\Loader\ArrayLoader;
|
||||
use Composer\Package\Loader\LoaderInterface;
|
||||
use Composer\Package\Version\VersionGuesser;
|
||||
use Composer\Package\Version\VersionParser;
|
||||
use Composer\Semver\VersionParser;
|
||||
use Composer\Util\ProcessExecutor;
|
||||
|
||||
/**
|
||||
|
|
|
@ -13,13 +13,13 @@
|
|||
namespace Composer\Repository;
|
||||
|
||||
use Composer\IO\IOInterface;
|
||||
use Composer\Package\Version\VersionParser;
|
||||
use Composer\Semver\VersionParser;
|
||||
use Composer\Repository\Pear\ChannelReader;
|
||||
use Composer\Package\CompletePackage;
|
||||
use Composer\Repository\Pear\ChannelInfo;
|
||||
use Composer\EventDispatcher\EventDispatcher;
|
||||
use Composer\Package\Link;
|
||||
use Composer\Package\LinkConstraint\VersionConstraint;
|
||||
use Composer\Semver\Constraint\Constraint;
|
||||
use Composer\Util\RemoteFilesystem;
|
||||
use Composer\Config;
|
||||
|
||||
|
@ -120,7 +120,7 @@ class PearRepository extends ArrayRepository
|
|||
// cause we've know only repository channel alias
|
||||
if ($channelInfo->getName() == $packageDefinition->getChannelName()) {
|
||||
$composerPackageAlias = $this->buildComposerPackageName($channelInfo->getAlias(), $packageDefinition->getPackageName());
|
||||
$aliasConstraint = new VersionConstraint('==', $normalizedVersion);
|
||||
$aliasConstraint = new Constraint('==', $normalizedVersion);
|
||||
$replaces[] = new Link($composerPackageName, $composerPackageAlias, $aliasConstraint, 'replaces', (string) $aliasConstraint);
|
||||
}
|
||||
|
||||
|
@ -129,7 +129,7 @@ class PearRepository extends ArrayRepository
|
|||
&& ($this->vendorAlias != 'pear-'.$channelInfo->getAlias() || $channelInfo->getName() != $packageDefinition->getChannelName())
|
||||
) {
|
||||
$composerPackageAlias = "{$this->vendorAlias}/{$packageDefinition->getPackageName()}";
|
||||
$aliasConstraint = new VersionConstraint('==', $normalizedVersion);
|
||||
$aliasConstraint = new Constraint('==', $normalizedVersion);
|
||||
$replaces[] = new Link($composerPackageName, $composerPackageAlias, $aliasConstraint, 'replaces', (string) $aliasConstraint);
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace Composer\Repository;
|
|||
use Composer\Config;
|
||||
use Composer\Package\PackageInterface;
|
||||
use Composer\Package\CompletePackage;
|
||||
use Composer\Package\Version\VersionParser;
|
||||
use Composer\Semver\VersionParser;
|
||||
use Composer\Plugin\PluginInterface;
|
||||
|
||||
/**
|
||||
|
|
|
@ -38,8 +38,8 @@ interface RepositoryInterface extends \Countable
|
|||
/**
|
||||
* Searches for the first match of a package by name and version.
|
||||
*
|
||||
* @param string $name package name
|
||||
* @param string|\Composer\Package\LinkConstraint\LinkConstraintInterface $constraint package version or version constraint to match against
|
||||
* @param string $name package name
|
||||
* @param string|\Composer\Semver\Constraint\ConstraintInterface $constraint package version or version constraint to match against
|
||||
*
|
||||
* @return PackageInterface|null
|
||||
*/
|
||||
|
@ -48,8 +48,8 @@ interface RepositoryInterface extends \Countable
|
|||
/**
|
||||
* Searches for all packages matching a name and optionally a version.
|
||||
*
|
||||
* @param string $name package name
|
||||
* @param string|\Composer\Package\LinkConstraint\LinkConstraintInterface $constraint package version or version constraint to match against
|
||||
* @param string $name package name
|
||||
* @param string|\Composer\Semver\Constraint\ConstraintInterface $constraint package version or version constraint to match against
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
|
|
|
@ -43,8 +43,8 @@ class RepositoryManager
|
|||
/**
|
||||
* Searches for a package by it's name and version in managed repositories.
|
||||
*
|
||||
* @param string $name package name
|
||||
* @param string|\Composer\Package\LinkConstraint\LinkConstraintInterface $constraint package version or version constraint to match against
|
||||
* @param string $name package name
|
||||
* @param string|\Composer\Semver\Constraint\ConstraintInterface $constraint package version or version constraint to match against
|
||||
*
|
||||
* @return PackageInterface|null
|
||||
*/
|
||||
|
@ -60,8 +60,8 @@ class RepositoryManager
|
|||
/**
|
||||
* Searches for all packages matching a name and optionally a version in managed repositories.
|
||||
*
|
||||
* @param string $name package name
|
||||
* @param string|\Composer\Package\LinkConstraint\LinkConstraintInterface $constraint package version or version constraint to match against
|
||||
* @param string $name package name
|
||||
* @param string|\Composer\Semver\Constraint\ConstraintInterface $constraint package version or version constraint to match against
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace Composer\Repository;
|
|||
|
||||
use Composer\Downloader\TransportException;
|
||||
use Composer\Repository\Vcs\VcsDriverInterface;
|
||||
use Composer\Package\Version\VersionParser;
|
||||
use Composer\Semver\VersionParser;
|
||||
use Composer\Package\Loader\ArrayLoader;
|
||||
use Composer\Package\Loader\ValidatingArrayLoader;
|
||||
use Composer\Package\Loader\InvalidPackageException;
|
||||
|
|
|
@ -18,7 +18,7 @@ use Composer\DependencyResolver\DefaultPolicy;
|
|||
use Composer\DependencyResolver\Pool;
|
||||
use Composer\Package\Link;
|
||||
use Composer\Package\AliasPackage;
|
||||
use Composer\Package\LinkConstraint\VersionConstraint;
|
||||
use Composer\Semver\Constraint\Constraint;
|
||||
use Composer\TestCase;
|
||||
|
||||
class DefaultPolicyTest extends TestCase
|
||||
|
@ -158,7 +158,7 @@ class DefaultPolicyTest extends TestCase
|
|||
$this->pool->addRepository($this->repoImportant);
|
||||
$this->pool->addRepository($this->repo);
|
||||
|
||||
$packages = $this->pool->whatProvides('a', new VersionConstraint('=', '2.1.9999999.9999999-dev'));
|
||||
$packages = $this->pool->whatProvides('a', new Constraint('=', '2.1.9999999.9999999-dev'));
|
||||
$literals = array();
|
||||
foreach ($packages as $package) {
|
||||
$literals[] = $package->getId();
|
||||
|
@ -176,8 +176,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 VersionConstraint('==', '1.0'), 'provides')));
|
||||
$packageB->setProvides(array(new Link('B', 'X', new VersionConstraint('==', '1.0'), 'provides')));
|
||||
$packageA->setProvides(array(new Link('A', 'X', new Constraint('==', '1.0'), 'provides')));
|
||||
$packageB->setProvides(array(new Link('B', 'X', new Constraint('==', '1.0'), 'provides')));
|
||||
|
||||
$this->pool->addRepository($this->repo);
|
||||
|
||||
|
@ -194,7 +194,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 VersionConstraint('==', '1.0'), 'replaces')));
|
||||
$packageB->setReplaces(array(new Link('B', 'A', new Constraint('==', '1.0'), 'replaces')));
|
||||
|
||||
$this->pool->addRepository($this->repo);
|
||||
|
||||
|
@ -212,8 +212,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 VersionConstraint('==', '1.0'), 'replaces')));
|
||||
$packageB->setReplaces(array(new Link('vendor-b/replacer', 'vendor-a/package', new VersionConstraint('==', '1.0'), 'replaces')));
|
||||
$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')));
|
||||
|
||||
$this->pool->addRepository($this->repo);
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ use Composer\DependencyResolver\Solver;
|
|||
use Composer\DependencyResolver\SolverProblemsException;
|
||||
use Composer\Package\Link;
|
||||
use Composer\TestCase;
|
||||
use Composer\Package\LinkConstraint\MultiConstraint;
|
||||
use Composer\Semver\Constraint\MultiConstraint;
|
||||
|
||||
class SolverTest extends TestCase
|
||||
{
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
namespace Composer\Test\Package;
|
||||
|
||||
use Composer\Package\Package;
|
||||
use Composer\Package\Version\VersionParser;
|
||||
use Composer\Semver\VersionParser;
|
||||
use Composer\TestCase;
|
||||
|
||||
class CompletePackageTest extends TestCase
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace Composer\Test\Package\Dumper;
|
|||
|
||||
use Composer\Package\Dumper\ArrayDumper;
|
||||
use Composer\Package\Link;
|
||||
use Composer\Package\LinkConstraint\VersionConstraint;
|
||||
use Composer\Semver\Constraint\Constraint;
|
||||
|
||||
class ArrayDumperTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
@ -161,13 +161,13 @@ class ArrayDumperTest extends \PHPUnit_Framework_TestCase
|
|||
),
|
||||
array(
|
||||
'require',
|
||||
array(new Link('foo', 'foo/bar', new VersionConstraint('=', '1.0.0.0'), 'requires', '1.0.0')),
|
||||
array(new Link('foo', 'foo/bar', new Constraint('=', '1.0.0.0'), 'requires', '1.0.0')),
|
||||
'requires',
|
||||
array('foo/bar' => '1.0.0'),
|
||||
),
|
||||
array(
|
||||
'require-dev',
|
||||
array(new Link('foo', 'foo/bar', new VersionConstraint('=', '1.0.0.0'), 'requires (for development)', '1.0.0')),
|
||||
array(new Link('foo', 'foo/bar', new Constraint('=', '1.0.0.0'), 'requires (for development)', '1.0.0')),
|
||||
'devRequires',
|
||||
array('foo/bar' => '1.0.0'),
|
||||
),
|
||||
|
@ -182,13 +182,13 @@ class ArrayDumperTest extends \PHPUnit_Framework_TestCase
|
|||
),
|
||||
array(
|
||||
'require',
|
||||
array(new Link('foo', 'foo/bar', new VersionConstraint('=', '1.0.0.0'), 'requires', '1.0.0'), new Link('bar', 'bar/baz', new VersionConstraint('=', '1.0.0.0'), 'requires', '1.0.0')),
|
||||
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')),
|
||||
'requires',
|
||||
array('bar/baz' => '1.0.0', 'foo/bar' => '1.0.0')
|
||||
),
|
||||
array(
|
||||
'require-dev',
|
||||
array(new Link('foo', 'foo/bar', new VersionConstraint('=', '1.0.0.0'), 'requires', '1.0.0'), new Link('bar', 'bar/baz', new VersionConstraint('=', '1.0.0.0'), 'requires', '1.0.0')),
|
||||
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')),
|
||||
'devRequires',
|
||||
array('bar/baz' => '1.0.0', 'foo/bar' => '1.0.0')
|
||||
),
|
||||
|
@ -200,19 +200,19 @@ class ArrayDumperTest extends \PHPUnit_Framework_TestCase
|
|||
),
|
||||
array(
|
||||
'provide',
|
||||
array(new Link('foo', 'foo/bar', new VersionConstraint('=', '1.0.0.0'), 'requires', '1.0.0'), new Link('bar', 'bar/baz', new VersionConstraint('=', '1.0.0.0'), 'requires', '1.0.0')),
|
||||
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')),
|
||||
'provides',
|
||||
array('bar/baz' => '1.0.0', 'foo/bar' => '1.0.0')
|
||||
),
|
||||
array(
|
||||
'replace',
|
||||
array(new Link('foo', 'foo/bar', new VersionConstraint('=', '1.0.0.0'), 'requires', '1.0.0'), new Link('bar', 'bar/baz', new VersionConstraint('=', '1.0.0.0'), 'requires', '1.0.0')),
|
||||
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')),
|
||||
'replaces',
|
||||
array('bar/baz' => '1.0.0', 'foo/bar' => '1.0.0')
|
||||
),
|
||||
array(
|
||||
'conflict',
|
||||
array(new Link('foo', 'foo/bar', new VersionConstraint('=', '1.0.0.0'), 'requires', '1.0.0'), new Link('bar', 'bar/baz', new VersionConstraint('=', '1.0.0.0'), 'requires', '1.0.0')),
|
||||
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')),
|
||||
'conflicts',
|
||||
array('bar/baz' => '1.0.0', 'foo/bar' => '1.0.0')
|
||||
),
|
||||
|
|
|
@ -16,7 +16,7 @@ use Composer\Config;
|
|||
use Composer\Package\Loader\RootPackageLoader;
|
||||
use Composer\Package\BasePackage;
|
||||
use Composer\Package\Version\VersionGuesser;
|
||||
use Composer\Package\Version\VersionParser;
|
||||
use Composer\Semver\VersionParser;
|
||||
|
||||
class RootPackageLoaderTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace Composer\Test\Package\Version;
|
|||
|
||||
use Composer\Config;
|
||||
use Composer\Package\Version\VersionGuesser;
|
||||
use Composer\Package\Version\VersionParser;
|
||||
use Composer\Semver\VersionParser;
|
||||
|
||||
class VersionGuesserTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
namespace Composer\Test\Package\Version;
|
||||
|
||||
use Composer\Package\Version\VersionSelector;
|
||||
use Composer\Package\Version\VersionParser;
|
||||
use Composer\Semver\VersionParser;
|
||||
|
||||
class VersionSelectorTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
|
|
@ -16,7 +16,7 @@ use Composer\IO\NullIO;
|
|||
use Composer\Test\Mock\FactoryMock;
|
||||
use Composer\TestCase;
|
||||
use Composer\Package\Loader\ArrayLoader;
|
||||
use Composer\Package\Version\VersionParser;
|
||||
use Composer\Semver\VersionParser;
|
||||
|
||||
class ComposerRepositoryTest extends TestCase
|
||||
{
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
namespace Composer\Repository;
|
||||
|
||||
use Composer\Package\Loader\ArrayLoader;
|
||||
use Composer\Package\Version\VersionParser;
|
||||
use Composer\Semver\VersionParser;
|
||||
use Composer\TestCase;
|
||||
use Composer\IO\NullIO;
|
||||
use Composer\Config;
|
||||
|
|
|
@ -13,8 +13,8 @@
|
|||
namespace Composer\Repository\Pear;
|
||||
|
||||
use Composer\TestCase;
|
||||
use Composer\Package\Version\VersionParser;
|
||||
use Composer\Package\LinkConstraint\VersionConstraint;
|
||||
use Composer\Semver\VersionParser;
|
||||
use Composer\Semver\Constraint\Constraint;
|
||||
use Composer\Package\Link;
|
||||
use Composer\Package\CompletePackage;
|
||||
use Composer\Test\Mock\RemoteFilesystemMock;
|
||||
|
@ -135,7 +135,7 @@ class ChannelReaderTest extends TestCase
|
|||
'*-ext-xml' => '*',
|
||||
));
|
||||
$expectedPackage->setReplaces(array(
|
||||
new Link('pear-test.loc/sample', 'pear-test/sample', new VersionConstraint('==', '1.0.0.1'), 'replaces', '== 1.0.0.1'),
|
||||
new Link('pear-test.loc/sample', 'pear-test/sample', new Constraint('==', '1.0.0.1'), 'replaces', '== 1.0.0.1'),
|
||||
));
|
||||
|
||||
$this->assertCount(1, $packages);
|
||||
|
@ -144,7 +144,7 @@ class ChannelReaderTest extends TestCase
|
|||
|
||||
private function createConstraint($operator, $version)
|
||||
{
|
||||
$constraint = new VersionConstraint($operator, $version);
|
||||
$constraint = new Constraint($operator, $version);
|
||||
$constraint->setPrettyString($operator.' '.$version);
|
||||
|
||||
return $constraint;
|
||||
|
|
|
@ -12,9 +12,9 @@
|
|||
|
||||
namespace Composer;
|
||||
|
||||
use Composer\Package\Version\VersionParser;
|
||||
use Composer\Semver\VersionParser;
|
||||
use Composer\Package\AliasPackage;
|
||||
use Composer\Package\LinkConstraint\VersionConstraint;
|
||||
use Composer\Semver\Constraint\Constraint;
|
||||
use Composer\Util\Filesystem;
|
||||
|
||||
abstract class TestCase extends \PHPUnit_Framework_TestCase
|
||||
|
@ -32,7 +32,7 @@ abstract class TestCase extends \PHPUnit_Framework_TestCase
|
|||
|
||||
protected function getVersionConstraint($operator, $version)
|
||||
{
|
||||
$constraint = new VersionConstraint(
|
||||
$constraint = new Constraint(
|
||||
$operator,
|
||||
self::getVersionParser()->normalize($version)
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue