public function versionCompare(PackageInterface $a, PackageInterface $b, $operator) { if ($this->preferStable && ($stabA = $a->getStability()) !== ($stabB = $b->getStability())) { return BasePackage::$stabilities[$stabA] < BasePackage::$stabilities[$stabB]; } $constraint = new VersionConstraint($operator, $b->getVersion()); $version = new VersionConstraint('==', $a->getVersion()); return $constraint->matchSpecific($version, true); }
public function testComparableBranches() { $versionRequire = new VersionConstraint('>', '0.12'); $versionProvide = new VersionConstraint('==', 'dev-foo'); $this->assertFalse($versionRequire->matches($versionProvide)); $this->assertFalse($versionRequire->matchSpecific($versionProvide, true)); $versionRequire = new VersionConstraint('<', '0.12'); $versionProvide = new VersionConstraint('==', 'dev-foo'); $this->assertFalse($versionRequire->matches($versionProvide)); $this->assertTrue($versionRequire->matchSpecific($versionProvide, true)); }
public function versionCompare(PackageInterface $a, PackageInterface $b, $operator) { $constraint = new VersionConstraint($operator, $b->getVersion()); $version = new VersionConstraint('==', $a->getVersion()); return $constraint->matchSpecific($version); }