upgrade to phpstan level 6

This commit is contained in:
Fabio Ivona
2021-11-15 12:23:53 +01:00
parent f6004e07c1
commit ffd4e6d577
7 changed files with 25 additions and 10 deletions

View File

@ -4,7 +4,7 @@ includes:
- vendor/thecodingmachine/phpstan-strict-rules/phpstan-strict-rules.neon
parameters:
level: 5
level: 6
paths:
- src

View File

@ -9,6 +9,7 @@ use Pest\Exceptions\DatasetAlreadyExist;
use Pest\Exceptions\DatasetDoesNotExist;
use SebastianBergmann\Exporter\Exporter;
use Traversable;
use function sprintf;
/**
* @internal
@ -25,14 +26,14 @@ final class Datasets
/**
* Holds the withs.
*
* @var array<string, \Closure|iterable|string>
* @var array<string, Closure|iterable<mixed>|string>
*/
private static array $withs = [];
/**
* Sets the given.
*
* @param Closure|iterable<int|string, mixed> $data
* @phpstan-param Closure|iterable<int|string, mixed> $data
*/
public static function set(string $name, Closure|iterable $data): void
{
@ -46,7 +47,7 @@ final class Datasets
/**
* Sets the given.
*
* @param Closure|iterable<int|string, mixed>|string $with
* @phpstan-param Closure|iterable<int|string, mixed>|string $with
*/
public static function with(string $filename, string $description, Closure|iterable|string $with): void
{
@ -119,7 +120,7 @@ final class Datasets
/**
* @param array<Closure|iterable<int|string, mixed>|string> $datasets
*
* @return array<array>
* @return array<array<mixed>>
*/
private static function processDatasets(array $datasets): array
{
@ -159,9 +160,9 @@ final class Datasets
}
/**
* @param array<array> $combinations
* @param array<array<mixed>> $combinations
*
* @return array<array>
* @return array<array<mixed>>
*/
private static function getDataSetsCombinations(array $combinations): array
{
@ -187,9 +188,9 @@ final class Datasets
$exporter = new Exporter();
if (is_int($key)) {
return \sprintf('(%s)', $exporter->shortenedRecursiveExport($data));
return sprintf('(%s)', $exporter->shortenedRecursiveExport($data));
}
return \sprintf('data set "%s"', $key);
return sprintf('data set "%s"', $key);
}
}

View File

@ -14,6 +14,10 @@ final class Depends
{
/**
* Adds annotations regarding the "depends" feature.
*
* @param array<string> $annotations
*
* @return array<string>
*/
public function add(TestCaseMethodFactory $method, array $annotations): array
{

View File

@ -13,6 +13,10 @@ final class Groups
{
/**
* Adds annotations regarding the "groups" feature.
*
* @param array<string> $annotations
*
* @return array<string>
*/
public function add(TestCaseMethodFactory $method, array $annotations): array
{

View File

@ -98,6 +98,8 @@ final class TestCaseFactory
/**
* Creates a Test Case class using a runtime evaluate.
*
* @param array<TestCaseMethodFactory> $methods
*/
public function evaluate(string $filename, array $methods): string
{

View File

@ -80,7 +80,7 @@ final class TestRepository
}
}
public function get($filename): TestCaseFactory
public function get(string $filename): TestCaseFactory
{
return $this->testCases[$filename];
}

View File

@ -11,6 +11,8 @@ final class Arr
{
/**
* Checks if the given array has the given key.
*
* @param array<mixed> $array
*/
public static function has(array $array, string|int $key): bool
{
@ -33,6 +35,8 @@ final class Arr
/**
* Gets the given key value.
*
* @param array<mixed> $array
*/
public static function get(array $array, string|int $key, mixed $default = null): mixed
{