1
0
Fork 0

PHP5 disallows require as a function name, use requireName analog to fixPackage

pull/8537/head
Nils Adermann 2020-01-19 23:28:00 +01:00
parent 5bdc0fc9c5
commit 0b4e8952f6
6 changed files with 52 additions and 52 deletions

View File

@ -33,7 +33,7 @@ class Request
$this->lockedRepository = $lockedRepository;
}
public function require($packageName, ConstraintInterface $constraint = null)
public function requireName($packageName, ConstraintInterface $constraint = null)
{
$packageName = strtolower($packageName);
$this->requires[$packageName] = $constraint;

View File

@ -371,11 +371,11 @@ class Installer
// if we're updating mirrors we want to keep exactly the same versions installed which are in the lock file, but we want current remote metadata
if ($this->updateMirrors) {
foreach ($lockedRepository->getPackages() as $lockedPackage) {
$request->require($lockedPackage->getName(), new Constraint('==', $lockedPackage->getVersion()));
$request->requireName($lockedPackage->getName(), new Constraint('==', $lockedPackage->getVersion()));
}
} else {
foreach ($links as $link) {
$request->require($link->getTarget(), $link->getConstraint());
$request->requireName($link->getTarget(), $link->getConstraint());
}
}
@ -523,7 +523,7 @@ class Installer
$links = $this->package->getRequires();
foreach ($links as $link) {
$request->require($link->getTarget(), $link->getConstraint());
$request->requireName($link->getTarget(), $link->getConstraint());
}
$pool = $repositorySet->createPool($request);
@ -581,7 +581,7 @@ class Installer
}
foreach ($this->locker->getPlatformRequirements($this->devMode) as $link) {
$request->require($link->getTarget(), $link->getConstraint());
$request->requireName($link->getTarget(), $link->getConstraint());
}
//$this->eventDispatcher->dispatchInstallerEvent(InstallerEvents::PRE_DEPENDENCIES_SOLVING, $this->devMode, $policy, $repositorySet, $installedRepo, $request);

View File

@ -157,7 +157,7 @@ class RepositorySet
$request = new Request($lockedRepo);
foreach ($packageNames as $packageName) {
$request->require($packageName);
$request->requireName($packageName);
}
return $this->createPool($request);

View File

@ -82,7 +82,7 @@ class PoolBuilderTest extends TestCase
$request = new Request();
foreach ($requestData as $package => $constraint) {
$request->require($package, $parser->parseConstraints($constraint));
$request->requireName($package, $parser->parseConstraints($constraint));
}
foreach ($fixed as $fixedPackage) {

View File

@ -30,7 +30,7 @@ class RequestTest extends TestCase
$repo->addPackage($foobar);
$request = new Request();
$request->require('foo');
$request->requireName('foo');
$this->assertEquals(
array(
@ -52,7 +52,7 @@ class RequestTest extends TestCase
$repo2->addPackage($foo2);
$request = new Request();
$request->require('foo', $constraint = $this->getVersionConstraint('=', '1'));
$request->requireName('foo', $constraint = $this->getVersionConstraint('=', '1'));
$this->assertEquals(
array(

View File

@ -50,7 +50,7 @@ class SolverTest extends TestCase
$this->repo->addPackage($packageA = $this->getPackage('A', '1.0'));
$this->reposComplete();
$this->request->require('A');
$this->request->requireName('A');
$this->checkSolverResult(array(
array('job' => 'install', 'package' => $packageA),
@ -72,7 +72,7 @@ class SolverTest extends TestCase
$this->repo->addPackage($this->getPackage('A', '1.0'));
$this->reposComplete();
$this->request->require('B', $this->getVersionConstraint('==', '1'));
$this->request->requireName('B', $this->getVersionConstraint('==', '1'));
$this->createSolver();
try {
@ -97,7 +97,7 @@ class SolverTest extends TestCase
$this->repoSet->addRepository($repo1);
$this->repoSet->addRepository($repo2);
$this->request->require('foo');
$this->request->requireName('foo');
$this->checkSolverResult(array(
array('job' => 'install', 'package' => $foo1),
@ -114,7 +114,7 @@ class SolverTest extends TestCase
$this->reposComplete();
$this->request->require('A');
$this->request->requireName('A');
$this->checkSolverResult(array(
array('job' => 'install', 'package' => $packageB),
@ -140,7 +140,7 @@ class SolverTest extends TestCase
$this->reposComplete();
$this->request->require('A');
$this->request->requireName('A');
$this->checkSolverResult(array(
array('job' => 'install', 'package' => $newPackageB11),
@ -164,9 +164,9 @@ class SolverTest extends TestCase
$this->reposComplete();
$this->request->require('A');
$this->request->require('B');
$this->request->require('C');
$this->request->requireName('A');
$this->request->requireName('B');
$this->request->requireName('C');
$this->checkSolverResult(array(
array('job' => 'install', 'package' => $packageA),
@ -206,7 +206,7 @@ class SolverTest extends TestCase
$packageA->setRequires(array('b' => new Link('A', 'B', $this->getVersionConstraint('>=', '1.0.0.0'), 'requires')));
$this->request->fixPackage($packageA);
$this->request->require('B', $this->getVersionConstraint('=', '1.1.0.0'));
$this->request->requireName('B', $this->getVersionConstraint('=', '1.1.0.0'));
$this->checkSolverResult(array(
array('job' => 'update', 'from' => $packageB, 'to' => $newPackageB),
@ -219,7 +219,7 @@ class SolverTest extends TestCase
$this->repo->addPackage($newPackageA = $this->getPackage('A', '1.1'));
$this->reposComplete();
$this->request->require('A');
$this->request->requireName('A');
$this->checkSolverResult(array(
array('job' => 'update', 'from' => $packageA, 'to' => $newPackageA),
@ -238,7 +238,7 @@ class SolverTest extends TestCase
$this->reposComplete();
$this->request->require('A');
$this->request->requireName('A');
$this->checkSolverResult(array(
array('job' => 'update', 'from' => $packageB, 'to' => $newPackageB),
@ -252,7 +252,7 @@ class SolverTest extends TestCase
$this->repo->addPackage($this->getPackage('A', '1.0'));
$this->reposComplete();
$this->request->require('A');
$this->request->requireName('A');
$this->checkSolverResult(array());
}
@ -266,7 +266,7 @@ class SolverTest extends TestCase
$this->reposComplete();
$this->request->require('A');
$this->request->requireName('A');
$this->request->fixPackage($packageB);
$this->checkSolverResult(array(
@ -281,7 +281,7 @@ class SolverTest extends TestCase
$this->repo->addPackage($this->getPackage('A', '2.0'));
$this->reposComplete();
$this->request->require('A', $this->getVersionConstraint('<', '2.0.0.0'));
$this->request->requireName('A', $this->getVersionConstraint('<', '2.0.0.0'));
$this->checkSolverResult(array(array(
'job' => 'update',
@ -297,7 +297,7 @@ class SolverTest extends TestCase
$this->repo->addPackage($this->getPackage('A', '2.0'));
$this->reposComplete();
$this->request->require('A', $this->getVersionConstraint('<', '2.0.0.0'));
$this->request->requireName('A', $this->getVersionConstraint('<', '2.0.0.0'));
$this->checkSolverResult(array(array(
'job' => 'update',
@ -314,7 +314,7 @@ class SolverTest extends TestCase
$this->repo->addPackage($this->getPackage('A', '2.0'));
$this->reposComplete();
$this->request->require('A', $this->getVersionConstraint('<', '2.0.0.0'));
$this->request->requireName('A', $this->getVersionConstraint('<', '2.0.0.0'));
$this->checkSolverResult(array(
array(
@ -343,8 +343,8 @@ class SolverTest extends TestCase
$this->reposComplete();
$this->request->require('A');
$this->request->require('C');
$this->request->requireName('A');
$this->request->requireName('C');
$this->checkSolverResult(array(
array('job' => 'remove', 'package' => $packageD),
@ -365,7 +365,7 @@ class SolverTest extends TestCase
$this->reposComplete();
$this->request->require('A');
$this->request->requireName('A');
$this->checkSolverResult(array(
array('job' => 'install', 'package' => $middlePackageB),
@ -381,7 +381,7 @@ class SolverTest extends TestCase
$this->reposComplete();
$this->request->require('B');
$this->request->requireName('B');
$this->checkSolverResult(array(
array('job' => 'remove', 'package' => $packageA),
@ -396,7 +396,7 @@ class SolverTest extends TestCase
$this->reposComplete();
$this->request->require('A');
$this->request->requireName('A');
$this->checkSolverResult(array(
array('job' => 'install', 'package' => $packageA),
@ -412,7 +412,7 @@ class SolverTest extends TestCase
$this->reposComplete();
$this->request->require('A');
$this->request->requireName('A');
// must explicitly pick the provider, so error in this case
$this->setExpectedException('Composer\DependencyResolver\SolverProblemsException');
@ -430,7 +430,7 @@ class SolverTest extends TestCase
$this->reposComplete();
$this->request->require('A');
$this->request->requireName('A');
$this->checkSolverResult(array(
array('job' => 'install', 'package' => $packageB),
@ -447,7 +447,7 @@ class SolverTest extends TestCase
$this->reposComplete();
$this->request->require('A');
$this->request->requireName('A');
$this->setExpectedException('Composer\DependencyResolver\SolverProblemsException');
$this->createSolver();
@ -464,8 +464,8 @@ class SolverTest extends TestCase
$this->reposComplete();
$this->request->require('A');
$this->request->require('Q');
$this->request->requireName('A');
$this->request->requireName('Q');
$this->checkSolverResult(array(
array('job' => 'install', 'package' => $packageQ),
@ -502,7 +502,7 @@ class SolverTest extends TestCase
$this->reposComplete();
$this->request->require('X');
$this->request->requireName('X');
$this->checkSolverResult(array(
array('job' => 'install', 'package' => $newPackageB),
@ -521,7 +521,7 @@ class SolverTest extends TestCase
$this->reposComplete();
$this->request->require('A');
$this->request->requireName('A');
$this->checkSolverResult(array(
array('job' => 'install', 'package' => $packageB2),
@ -545,8 +545,8 @@ class SolverTest extends TestCase
$this->reposComplete();
$this->request->require('A');
$this->request->require('C');
$this->request->requireName('A');
$this->request->requireName('C');
$this->checkSolverResult(array(
array('job' => 'install', 'package' => $packageB),
@ -583,8 +583,8 @@ class SolverTest extends TestCase
$this->reposComplete();
$this->request->require('A');
$this->request->require('D');
$this->request->requireName('A');
$this->request->requireName('D');
$this->checkSolverResult(array(
array('job' => 'install', 'package' => $packageD2),
@ -619,7 +619,7 @@ class SolverTest extends TestCase
$this->reposComplete();
$this->request->require('C', $this->getVersionConstraint('==', '2.0.0.0-dev'));
$this->request->requireName('C', $this->getVersionConstraint('==', '2.0.0.0-dev'));
$this->setExpectedException('Composer\DependencyResolver\SolverProblemsException');
@ -637,8 +637,8 @@ class SolverTest extends TestCase
$this->reposComplete();
$this->request->require('A');
$this->request->require('B');
$this->request->requireName('A');
$this->request->requireName('B');
$this->createSolver();
try {
@ -668,7 +668,7 @@ class SolverTest extends TestCase
$this->reposComplete();
$this->request->require('A');
$this->request->requireName('A');
$this->createSolver();
try {
@ -716,7 +716,7 @@ class SolverTest extends TestCase
$this->reposComplete();
$this->request->require('A');
$this->request->requireName('A');
$this->createSolver();
try {
@ -756,8 +756,8 @@ class SolverTest extends TestCase
$this->reposComplete();
$this->request->require('symfony/twig-bridge');
$this->request->require('twig/twig');
$this->request->requireName('symfony/twig-bridge');
$this->request->requireName('twig/twig');
$this->checkSolverResult(array(
array('job' => 'install', 'package' => $packageTwig16),
@ -782,7 +782,7 @@ class SolverTest extends TestCase
$this->reposComplete();
$this->request->require('A', $this->getVersionConstraint('==', '1.1.0.0'));
$this->request->requireName('A', $this->getVersionConstraint('==', '1.1.0.0'));
$this->checkSolverResult(array(
array('job' => 'install', 'package' => $packageB),
@ -804,8 +804,8 @@ class SolverTest extends TestCase
$this->reposComplete();
$this->request->require('A', $this->getVersionConstraint('==', '2.0'));
$this->request->require('B');
$this->request->requireName('A', $this->getVersionConstraint('==', '2.0'));
$this->request->requireName('B');
$this->checkSolverResult(array(
array('job' => 'install', 'package' => $packageA),
@ -865,7 +865,7 @@ class SolverTest extends TestCase
$this->reposComplete();
$this->request->require('A');
$this->request->requireName('A');
$this->createSolver();