mirror of
https://github.com/pestphp/pest.git
synced 2026-03-06 07:47:22 +01:00
upgrade to phpstan level 6
This commit is contained in:
@ -4,7 +4,7 @@ includes:
|
||||
- vendor/thecodingmachine/phpstan-strict-rules/phpstan-strict-rules.neon
|
||||
|
||||
parameters:
|
||||
level: 5
|
||||
level: 6
|
||||
paths:
|
||||
- src
|
||||
|
||||
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@ -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
|
||||
{
|
||||
|
||||
@ -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
|
||||
{
|
||||
|
||||
@ -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
|
||||
{
|
||||
|
||||
@ -80,7 +80,7 @@ final class TestRepository
|
||||
}
|
||||
}
|
||||
|
||||
public function get($filename): TestCaseFactory
|
||||
public function get(string $filename): TestCaseFactory
|
||||
{
|
||||
return $this->testCases[$filename];
|
||||
}
|
||||
|
||||
@ -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
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user