diff --git a/src/Composer/Command/CreateProjectCommand.php b/src/Composer/Command/CreateProjectCommand.php index 54cd63538..4c93561eb 100644 --- a/src/Composer/Command/CreateProjectCommand.php +++ b/src/Composer/Command/CreateProjectCommand.php @@ -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. diff --git a/src/Composer/Command/InitCommand.php b/src/Composer/Command/InitCommand.php index 112c10129..fe5e1bda0 100644 --- a/src/Composer/Command/InitCommand.php +++ b/src/Composer/Command/InitCommand.php @@ -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; diff --git a/src/Composer/Command/RequireCommand.php b/src/Composer/Command/RequireCommand.php index 4499904bb..c7bcc8735 100644 --- a/src/Composer/Command/RequireCommand.php +++ b/src/Composer/Command/RequireCommand.php @@ -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; diff --git a/src/Composer/Command/ShowCommand.php b/src/Composer/Command/ShowCommand.php index 30d8797c8..81bc93b3f 100644 --- a/src/Composer/Command/ShowCommand.php +++ b/src/Composer/Command/ShowCommand.php @@ -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; diff --git a/src/Composer/DependencyResolver/DefaultPolicy.php b/src/Composer/DependencyResolver/DefaultPolicy.php index 440d6856c..684f11851 100644 --- a/src/Composer/DependencyResolver/DefaultPolicy.php +++ b/src/Composer/DependencyResolver/DefaultPolicy.php @@ -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 @@ -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; } diff --git a/src/Composer/DependencyResolver/Pool.php b/src/Composer/DependencyResolver/Pool.php index 343fad9be..d5eac138e 100644 --- a/src/Composer/DependencyResolver/Pool.php +++ b/src/Composer/DependencyResolver/Pool.php @@ -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; diff --git a/src/Composer/DependencyResolver/Problem.php b/src/Composer/DependencyResolver/Problem.php index 5d2117f2c..f4e5f1744 100644 --- a/src/Composer/DependencyResolver/Problem.php +++ b/src/Composer/DependencyResolver/Problem.php @@ -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) diff --git a/src/Composer/DependencyResolver/Request.php b/src/Composer/DependencyResolver/Request.php index 0776f040e..10ffcb2c4 100644 --- a/src/Composer/DependencyResolver/Request.php +++ b/src/Composer/DependencyResolver/Request.php @@ -12,7 +12,7 @@ namespace Composer\DependencyResolver; -use Composer\Package\LinkConstraint\LinkConstraintInterface; +use Composer\Semver\Constraint\ConstraintInterface; /** * @author Nils Adermann @@ -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); diff --git a/src/Composer/Factory.php b/src/Composer/Factory.php index 2e6f31898..e3c899880 100644 --- a/src/Composer/Factory.php +++ b/src/Composer/Factory.php @@ -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. diff --git a/src/Composer/Installer.php b/src/Composer/Installer.php index 3f208ea32..c94eedc7f 100644 --- a/src/Composer/Installer.php +++ b/src/Composer/Installer.php @@ -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)) { diff --git a/src/Composer/Package/AliasPackage.php b/src/Composer/Package/AliasPackage.php index f6aa98a4c..130de6bae 100644 --- a/src/Composer/Package/AliasPackage.php +++ b/src/Composer/Package/AliasPackage.php @@ -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 @@ -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); } } } diff --git a/src/Composer/Package/Link.php b/src/Composer/Package/Link.php index e09f163eb..fb2662a6f 100644 --- a/src/Composer/Package/Link.php +++ b/src/Composer/Package/Link.php @@ -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() { diff --git a/src/Composer/Package/Loader/ArrayLoader.php b/src/Composer/Package/Loader/ArrayLoader.php index 160b8000a..42398e41f 100644 --- a/src/Composer/Package/Loader/ArrayLoader.php +++ b/src/Composer/Package/Loader/ArrayLoader.php @@ -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 diff --git a/src/Composer/Package/Loader/RootPackageLoader.php b/src/Composer/Package/Loader/RootPackageLoader.php index c084c846a..1266346db 100644 --- a/src/Composer/Package/Loader/RootPackageLoader.php +++ b/src/Composer/Package/Loader/RootPackageLoader.php @@ -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; diff --git a/src/Composer/Package/Loader/ValidatingArrayLoader.php b/src/Composer/Package/Loader/ValidatingArrayLoader.php index 86386989c..4f01a680d 100644 --- a/src/Composer/Package/Loader/ValidatingArrayLoader.php +++ b/src/Composer/Package/Loader/ValidatingArrayLoader.php @@ -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])) { diff --git a/src/Composer/Package/Package.php b/src/Composer/Package/Package.php index 0c98a0e56..7f813887e 100644 --- a/src/Composer/Package/Package.php +++ b/src/Composer/Package/Package.php @@ -12,7 +12,7 @@ namespace Composer\Package; -use Composer\Package\Version\VersionParser; +use Composer\Semver\VersionParser; use Composer\Util\ComposerMirror; /** diff --git a/src/Composer/Package/Version/VersionGuesser.php b/src/Composer/Package/Version/VersionGuesser.php index 34f997078..6f71dbe7d 100644 --- a/src/Composer/Package/Version/VersionGuesser.php +++ b/src/Composer/Package/Version/VersionGuesser.php @@ -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; diff --git a/src/Composer/Package/Version/VersionSelector.php b/src/Composer/Package/Version/VersionSelector.php index 563ba056a..04b4cd28d 100644 --- a/src/Composer/Package/Version/VersionSelector.php +++ b/src/Composer/Package/Version/VersionSelector.php @@ -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 diff --git a/src/Composer/Plugin/PluginManager.php b/src/Composer/Plugin/PluginManager.php index 833b3e29b..be8d925cd 100644 --- a/src/Composer/Plugin/PluginManager.php +++ b/src/Composer/Plugin/PluginManager.php @@ -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('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.'); diff --git a/src/Composer/Repository/ArrayRepository.php b/src/Composer/Repository/ArrayRepository.php index a5023c1fe..5f9eaf406 100644 --- a/src/Composer/Repository/ArrayRepository.php +++ b/src/Composer/Repository/ArrayRepository.php @@ -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; } diff --git a/src/Composer/Repository/ComposerRepository.php b/src/Composer/Repository/ComposerRepository.php index f3b0642d0..632f3a03b 100644 --- a/src/Composer/Repository/ComposerRepository.php +++ b/src/Composer/Repository/ComposerRepository.php @@ -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 @@ -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; } diff --git a/src/Composer/Repository/PathRepository.php b/src/Composer/Repository/PathRepository.php index 3b600ea36..18827f896 100644 --- a/src/Composer/Repository/PathRepository.php +++ b/src/Composer/Repository/PathRepository.php @@ -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; /** diff --git a/src/Composer/Repository/PearRepository.php b/src/Composer/Repository/PearRepository.php index 1f882eb80..e2519d9b9 100644 --- a/src/Composer/Repository/PearRepository.php +++ b/src/Composer/Repository/PearRepository.php @@ -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); } diff --git a/src/Composer/Repository/PlatformRepository.php b/src/Composer/Repository/PlatformRepository.php index d7be746a2..44a70b83b 100644 --- a/src/Composer/Repository/PlatformRepository.php +++ b/src/Composer/Repository/PlatformRepository.php @@ -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; /** diff --git a/src/Composer/Repository/RepositoryInterface.php b/src/Composer/Repository/RepositoryInterface.php index aaba31a9e..0b2e8132a 100644 --- a/src/Composer/Repository/RepositoryInterface.php +++ b/src/Composer/Repository/RepositoryInterface.php @@ -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 */ diff --git a/src/Composer/Repository/RepositoryManager.php b/src/Composer/Repository/RepositoryManager.php index 9dd88b176..336a735b6 100644 --- a/src/Composer/Repository/RepositoryManager.php +++ b/src/Composer/Repository/RepositoryManager.php @@ -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 */ diff --git a/src/Composer/Repository/VcsRepository.php b/src/Composer/Repository/VcsRepository.php index bb9d76814..b6ebd3b35 100644 --- a/src/Composer/Repository/VcsRepository.php +++ b/src/Composer/Repository/VcsRepository.php @@ -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; diff --git a/tests/Composer/Test/DependencyResolver/DefaultPolicyTest.php b/tests/Composer/Test/DependencyResolver/DefaultPolicyTest.php index 993cbffe8..d694813c6 100644 --- a/tests/Composer/Test/DependencyResolver/DefaultPolicyTest.php +++ b/tests/Composer/Test/DependencyResolver/DefaultPolicyTest.php @@ -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); diff --git a/tests/Composer/Test/DependencyResolver/SolverTest.php b/tests/Composer/Test/DependencyResolver/SolverTest.php index e50b38b93..9d4d41462 100644 --- a/tests/Composer/Test/DependencyResolver/SolverTest.php +++ b/tests/Composer/Test/DependencyResolver/SolverTest.php @@ -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 { diff --git a/tests/Composer/Test/Package/CompletePackageTest.php b/tests/Composer/Test/Package/CompletePackageTest.php index de119ebaa..aa3127071 100644 --- a/tests/Composer/Test/Package/CompletePackageTest.php +++ b/tests/Composer/Test/Package/CompletePackageTest.php @@ -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 diff --git a/tests/Composer/Test/Package/Dumper/ArrayDumperTest.php b/tests/Composer/Test/Package/Dumper/ArrayDumperTest.php index c9aa2b8a0..852d667e4 100644 --- a/tests/Composer/Test/Package/Dumper/ArrayDumperTest.php +++ b/tests/Composer/Test/Package/Dumper/ArrayDumperTest.php @@ -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') ), diff --git a/tests/Composer/Test/Package/Loader/RootPackageLoaderTest.php b/tests/Composer/Test/Package/Loader/RootPackageLoaderTest.php index cec33fd94..e393d3536 100644 --- a/tests/Composer/Test/Package/Loader/RootPackageLoaderTest.php +++ b/tests/Composer/Test/Package/Loader/RootPackageLoaderTest.php @@ -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 { diff --git a/tests/Composer/Test/Package/Version/VersionGuesserTest.php b/tests/Composer/Test/Package/Version/VersionGuesserTest.php index 6f7f7ce83..84da8d2e9 100644 --- a/tests/Composer/Test/Package/Version/VersionGuesserTest.php +++ b/tests/Composer/Test/Package/Version/VersionGuesserTest.php @@ -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 { diff --git a/tests/Composer/Test/Package/Version/VersionSelectorTest.php b/tests/Composer/Test/Package/Version/VersionSelectorTest.php index 6547e7056..a48cc805d 100644 --- a/tests/Composer/Test/Package/Version/VersionSelectorTest.php +++ b/tests/Composer/Test/Package/Version/VersionSelectorTest.php @@ -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 { diff --git a/tests/Composer/Test/Repository/ComposerRepositoryTest.php b/tests/Composer/Test/Repository/ComposerRepositoryTest.php index 6f21f9d9c..06fa58b6a 100644 --- a/tests/Composer/Test/Repository/ComposerRepositoryTest.php +++ b/tests/Composer/Test/Repository/ComposerRepositoryTest.php @@ -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 { diff --git a/tests/Composer/Test/Repository/PathRepositoryTest.php b/tests/Composer/Test/Repository/PathRepositoryTest.php index 1a5392c28..9dd7c1249 100644 --- a/tests/Composer/Test/Repository/PathRepositoryTest.php +++ b/tests/Composer/Test/Repository/PathRepositoryTest.php @@ -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; diff --git a/tests/Composer/Test/Repository/Pear/ChannelReaderTest.php b/tests/Composer/Test/Repository/Pear/ChannelReaderTest.php index c22250a04..1d9d39767 100644 --- a/tests/Composer/Test/Repository/Pear/ChannelReaderTest.php +++ b/tests/Composer/Test/Repository/Pear/ChannelReaderTest.php @@ -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; diff --git a/tests/Composer/TestCase.php b/tests/Composer/TestCase.php index 4abf1a7ff..2057c09b8 100644 --- a/tests/Composer/TestCase.php +++ b/tests/Composer/TestCase.php @@ -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) );