1
0
Fork 0

phpstan: update tests/Composer/Test/Autoload/* to level 6 standard (#10223)

pull/10224/head
megubyte 2021-10-26 20:48:56 +01:00 committed by GitHub
parent 3d5a100018
commit 135f806f6f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 45 additions and 2 deletions

View File

@ -84,7 +84,7 @@ class AutoloadGeneratorTest extends TestCase
* Note: must be public for compatibility with PHP 5.3 runtimes where
* closures cannot access private members of the classes they are created
* in.
* @var array
* @var array<string, callable|boolean>
*/
public $configValueMap;
@ -1706,6 +1706,12 @@ EOF;
}
/**
* @param array<string, Link> $requires
* @param string|null $expectedFixture
* @param array<string, Link> $provides
* @param array<string, Link> $replaces
* @param bool $ignorePlatformReqs
*
* @dataProvider platformCheckProvider
*/
public function testGeneratesPlatformCheck(array $requires, $expectedFixture, array $provides = array(), array $replaces = array(), $ignorePlatformReqs = false)
@ -1828,6 +1834,13 @@ EOF;
);
}
/**
* @param string $name
* @param string $dir
* @param string $type
*
* @return void
*/
private function assertAutoloadFiles($name, $dir, $type = 'namespaces')
{
$a = __DIR__.'/Fixtures/autoload_'.$name.'.php';
@ -1835,6 +1848,15 @@ EOF;
$this->assertFileContentEquals($a, $b);
}
/**
* @param string $expected
* @param string $actual
* @param string $message
* @param bool $canonicalize
* @param bool $ignoreCase
*
* @return void
*/
public static function assertFileContentEquals($expected, $actual, $message = '', $canonicalize = false, $ignoreCase = false)
{
self::assertEqualsNormalized(
@ -1848,6 +1870,17 @@ EOF;
);
}
/**
* @param string $expected
* @param string $actual
* @param string $message
* @param int $delta
* @param int $maxDepth
* @param bool $canonicalize
* @param bool $ignoreCase
*
* @return void
*/
public static function assertEqualsNormalized($expected, $actual, $message = '', $delta = 0, $maxDepth = 10, $canonicalize = false, $ignoreCase = false)
{
parent::assertEquals(str_replace("\r", '', $expected), str_replace("\r", '', $actual), $message, $delta, $maxDepth, $canonicalize, $ignoreCase);

View File

@ -40,7 +40,7 @@ class ClassLoaderTest extends TestCase
/**
* Provides arguments for ->testLoadClass().
*
* @return array Array of parameter sets to test with.
* @return array<array<string>> Array of parameter sets to test with.
*/
public function getLoadClassTests()
{

View File

@ -33,6 +33,9 @@ class ClassMapGeneratorTest extends TestCase
$this->assertEqualsNormalized($expected, ClassMapGenerator::createMap($directory));
}
/**
* @return array<array<string|array<string>>>
*/
public function getTestCreateMapTests()
{
if (PHP_VERSION_ID == 50303) {
@ -268,6 +271,12 @@ class ClassMapGeneratorTest extends TestCase
$this->assertEqualsNormalized($expected, $result);
}
/**
* @param array<class-string> $expected
* @param array<class-string> $actual
* @param string $message
* @return void
*/
protected function assertEqualsNormalized($expected, $actual, $message = '')
{
foreach ($expected as $ns => $path) {
@ -279,6 +288,7 @@ class ClassMapGeneratorTest extends TestCase
$this->assertEquals($expected, $actual, $message);
}
/** @return void */
private function checkIfFinderIsAvailable()
{
if (!class_exists('Symfony\\Component\\Finder\\Finder')) {