tests/phpunit: populate iterable types for phpstan

This commit is contained in:
Dylan K. Taylor 2020-02-06 13:11:56 +00:00
parent 54ccc330d5
commit 532dc0fb6f
6 changed files with 22 additions and 4 deletions

View File

@ -95,7 +95,8 @@ class BlockTest extends TestCase{
}
/**
* @return array
* @return int[][]
* @phpstan-return list<array{int,int}>
*/
public function blockGetProvider() : array{
return [

View File

@ -61,6 +61,10 @@ class ItemTest extends TestCase{
}
}
/**
* @return mixed[][]
* @phpstan-return list<array{string,int,int}>
*/
public function itemFromStringProvider() : array{
return [
["dye:4", ItemIds::DYE, 4],

View File

@ -69,6 +69,10 @@ class RegionLoaderTest extends TestCase{
self::assertSame($data, $r->readChunk(0, 0));
}
/**
* @return \Generator|int[][]
* @phpstan-return \Generator<int, array{int,int}, void, void>
*/
public function outOfBoundsCoordsProvider() : \Generator{
yield [-1, -1];
yield [32, 32];

View File

@ -33,6 +33,10 @@ class StupidJsonDecodeTest extends TestCase{
$this->stupidJsonDecodeFunc = (new \ReflectionMethod(PlayerNetworkSessionAdapter::class, 'stupid_json_decode'))->getClosure();
}
/**
* @return mixed[][]
* @phpstan-return list<array{string,mixed}>
*/
public function stupidJsonDecodeProvider() : array{
return [
["[\n \"a\",\"b,c,d,e\\\" \",,0,1,2, false, 0.001]", ['a', 'b,c,d,e" ', '', 0, 1, 2, false, 0.001]],

View File

@ -28,7 +28,8 @@ use PHPUnit\Framework\TestCase;
class ConfigTest extends TestCase{
/**
* @return \Generator
* @return \Generator|mixed[][]
* @phpstan-return \Generator<int, array{string, mixed[]}, void, void>
*/
public function fixYamlIndexesProvider() : \Generator{
yield ["x: 1\ny: 2\nz: 3\n", [
@ -60,8 +61,8 @@ class ConfigTest extends TestCase{
/**
* @dataProvider fixYamlIndexesProvider
*
* @param string $test
* @param array $expected
* @param string $test
* @param mixed[] $expected
*/
public function testFixYamlIndexes(string $test, array $expected) : void{
$fixed = Config::fixYAMLIndexes($test);

View File

@ -38,6 +38,10 @@ class UtilsTest extends TestCase{
}
}
/**
* @return string[][]
* @phpstan-return list<array{string}>
*/
public function parseDocCommentNewlineProvider() : array{
return [
["\t/**\r\n\t * @param PlayerJoinEvent \$event\r\n\t * @priority HIGHEST\r\n\t * @notHandler\r\n\t */"],