From a155c076dbe826c7ca9947eb874295a9b283d756 Mon Sep 17 00:00:00 2001 From: megubyte <939805+megubyte@users.noreply.github.com> Date: Sat, 30 Oct 2021 09:30:36 +0100 Subject: [PATCH] phpstan: update tests/Composer/Test/DependencyResolver/* to level 6 standard (#10242) --- .../Test/DependencyResolver/PoolBuilderTest.php | 8 ++++++++ tests/Composer/Test/DependencyResolver/PoolTest.php | 6 +++++- tests/Composer/Test/DependencyResolver/SolverTest.php | 10 ++++++++++ .../Test/DependencyResolver/TransactionTest.php | 5 +++++ 4 files changed, 28 insertions(+), 1 deletion(-) diff --git a/tests/Composer/Test/DependencyResolver/PoolBuilderTest.php b/tests/Composer/Test/DependencyResolver/PoolBuilderTest.php index afa39e532..52589d5dd 100644 --- a/tests/Composer/Test/DependencyResolver/PoolBuilderTest.php +++ b/tests/Composer/Test/DependencyResolver/PoolBuilderTest.php @@ -140,6 +140,9 @@ class PoolBuilderTest extends TestCase $this->assertSame($expect, $result); } + /** + * @return array> + */ public function getIntegrationTests() { $fixturesDir = realpath(__DIR__.'/Fixtures/poolbuilder/'); @@ -173,6 +176,11 @@ class PoolBuilderTest extends TestCase return $tests; } + /** + * @param \SplFileInfo $file + * @param string $fixturesDir + * @return array + */ protected function readTestFile(\SplFileInfo $file, $fixturesDir) { $tokens = preg_split('#(?:^|\n*)--([A-Z-]+)--\n#', file_get_contents($file->getRealPath()), -1, PREG_SPLIT_DELIM_CAPTURE); diff --git a/tests/Composer/Test/DependencyResolver/PoolTest.php b/tests/Composer/Test/DependencyResolver/PoolTest.php index da5385589..350a5cab8 100644 --- a/tests/Composer/Test/DependencyResolver/PoolTest.php +++ b/tests/Composer/Test/DependencyResolver/PoolTest.php @@ -57,7 +57,11 @@ class PoolTest extends TestCase $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); } diff --git a/tests/Composer/Test/DependencyResolver/SolverTest.php b/tests/Composer/Test/DependencyResolver/SolverTest.php index 178793b33..539e0e80b 100644 --- a/tests/Composer/Test/DependencyResolver/SolverTest.php +++ b/tests/Composer/Test/DependencyResolver/SolverTest.php @@ -1039,12 +1039,18 @@ class SolverTest extends TestCase $this->assertTrue($this->solver->testFlagLearnedPositiveLiteral); } + /** + * @return void + */ protected function reposComplete() { $this->repoSet->addRepository($this->repo); $this->repoSet->addRepository($this->repoLocked); } + /** + * @return void + */ protected function createSolver() { $io = new NullIO(); @@ -1052,6 +1058,10 @@ class SolverTest extends TestCase $this->solver = new Solver($this->policy, $this->pool, $io); } + /** + * @param array> $expected + * @return void + */ protected function checkSolverResult(array $expected) { $this->createSolver(); diff --git a/tests/Composer/Test/DependencyResolver/TransactionTest.php b/tests/Composer/Test/DependencyResolver/TransactionTest.php index f909fd0b6..76f6beede 100644 --- a/tests/Composer/Test/DependencyResolver/TransactionTest.php +++ b/tests/Composer/Test/DependencyResolver/TransactionTest.php @@ -98,6 +98,11 @@ class TransactionTest extends TestCase $this->checkTransactionOperations($transaction, $expectedOperations); } + /** + * @param \Composer\DependencyResolver\Transaction $transaction + * @param array> $expected + * @return void + */ protected function checkTransactionOperations(Transaction $transaction, array $expected) { $result = array();