1
0
Fork 0

phpstan: update tests/Composer/Test/DependencyResolver/* to level 6 standard (#10242)

pull/10245/head
megubyte 2021-10-30 09:30:36 +01:00 committed by GitHub
parent 8b7e2b600d
commit a155c076db
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 28 additions and 1 deletions

View File

@ -140,6 +140,9 @@ class PoolBuilderTest extends TestCase
$this->assertSame($expect, $result); $this->assertSame($expect, $result);
} }
/**
* @return array<string, array<string>>
*/
public function getIntegrationTests() public function getIntegrationTests()
{ {
$fixturesDir = realpath(__DIR__.'/Fixtures/poolbuilder/'); $fixturesDir = realpath(__DIR__.'/Fixtures/poolbuilder/');
@ -173,6 +176,11 @@ class PoolBuilderTest extends TestCase
return $tests; return $tests;
} }
/**
* @param \SplFileInfo $file
* @param string $fixturesDir
* @return array<string, string>
*/
protected function readTestFile(\SplFileInfo $file, $fixturesDir) protected function readTestFile(\SplFileInfo $file, $fixturesDir)
{ {
$tokens = preg_split('#(?:^|\n*)--([A-Z-]+)--\n#', file_get_contents($file->getRealPath()), -1, PREG_SPLIT_DELIM_CAPTURE); $tokens = preg_split('#(?:^|\n*)--([A-Z-]+)--\n#', file_get_contents($file->getRealPath()), -1, PREG_SPLIT_DELIM_CAPTURE);

View File

@ -57,7 +57,11 @@ class PoolTest extends TestCase
$this->assertEquals(array(), $pool->whatProvides('foo')); $this->assertEquals(array(), $pool->whatProvides('foo'));
} }
protected function createPool(array $packages = array()) /**
* @param array<\Composer\Package\BasePackage>|null $packages
* @return \Composer\DependencyResolver\Pool
*/
protected function createPool($packages = array())
{ {
return new Pool($packages); return new Pool($packages);
} }

View File

@ -1039,12 +1039,18 @@ class SolverTest extends TestCase
$this->assertTrue($this->solver->testFlagLearnedPositiveLiteral); $this->assertTrue($this->solver->testFlagLearnedPositiveLiteral);
} }
/**
* @return void
*/
protected function reposComplete() protected function reposComplete()
{ {
$this->repoSet->addRepository($this->repo); $this->repoSet->addRepository($this->repo);
$this->repoSet->addRepository($this->repoLocked); $this->repoSet->addRepository($this->repoLocked);
} }
/**
* @return void
*/
protected function createSolver() protected function createSolver()
{ {
$io = new NullIO(); $io = new NullIO();
@ -1052,6 +1058,10 @@ class SolverTest extends TestCase
$this->solver = new Solver($this->policy, $this->pool, $io); $this->solver = new Solver($this->policy, $this->pool, $io);
} }
/**
* @param array<array<string, string>> $expected
* @return void
*/
protected function checkSolverResult(array $expected) protected function checkSolverResult(array $expected)
{ {
$this->createSolver(); $this->createSolver();

View File

@ -98,6 +98,11 @@ class TransactionTest extends TestCase
$this->checkTransactionOperations($transaction, $expectedOperations); $this->checkTransactionOperations($transaction, $expectedOperations);
} }
/**
* @param \Composer\DependencyResolver\Transaction $transaction
* @param array<array<string, string>> $expected
* @return void
*/
protected function checkTransactionOperations(Transaction $transaction, array $expected) protected function checkTransactionOperations(Transaction $transaction, array $expected)
{ {
$result = array(); $result = array();