mirror of
https://github.com/pestphp/pest.git
synced 2026-03-06 15:57:21 +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
|
- vendor/thecodingmachine/phpstan-strict-rules/phpstan-strict-rules.neon
|
||||||
|
|
||||||
parameters:
|
parameters:
|
||||||
level: 5
|
level: 6
|
||||||
paths:
|
paths:
|
||||||
- src
|
- src
|
||||||
|
|
||||||
|
|||||||
@ -9,6 +9,7 @@ use Pest\Exceptions\DatasetAlreadyExist;
|
|||||||
use Pest\Exceptions\DatasetDoesNotExist;
|
use Pest\Exceptions\DatasetDoesNotExist;
|
||||||
use SebastianBergmann\Exporter\Exporter;
|
use SebastianBergmann\Exporter\Exporter;
|
||||||
use Traversable;
|
use Traversable;
|
||||||
|
use function sprintf;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @internal
|
* @internal
|
||||||
@ -25,14 +26,14 @@ final class Datasets
|
|||||||
/**
|
/**
|
||||||
* Holds the withs.
|
* Holds the withs.
|
||||||
*
|
*
|
||||||
* @var array<string, \Closure|iterable|string>
|
* @var array<string, Closure|iterable<mixed>|string>
|
||||||
*/
|
*/
|
||||||
private static array $withs = [];
|
private static array $withs = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the given.
|
* 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
|
public static function set(string $name, Closure|iterable $data): void
|
||||||
{
|
{
|
||||||
@ -46,7 +47,7 @@ final class Datasets
|
|||||||
/**
|
/**
|
||||||
* Sets the given.
|
* 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
|
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
|
* @param array<Closure|iterable<int|string, mixed>|string> $datasets
|
||||||
*
|
*
|
||||||
* @return array<array>
|
* @return array<array<mixed>>
|
||||||
*/
|
*/
|
||||||
private static function processDatasets(array $datasets): array
|
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
|
private static function getDataSetsCombinations(array $combinations): array
|
||||||
{
|
{
|
||||||
@ -187,9 +188,9 @@ final class Datasets
|
|||||||
$exporter = new Exporter();
|
$exporter = new Exporter();
|
||||||
|
|
||||||
if (is_int($key)) {
|
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.
|
* Adds annotations regarding the "depends" feature.
|
||||||
|
*
|
||||||
|
* @param array<string> $annotations
|
||||||
|
*
|
||||||
|
* @return array<string>
|
||||||
*/
|
*/
|
||||||
public function add(TestCaseMethodFactory $method, array $annotations): array
|
public function add(TestCaseMethodFactory $method, array $annotations): array
|
||||||
{
|
{
|
||||||
|
|||||||
@ -13,6 +13,10 @@ final class Groups
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Adds annotations regarding the "groups" feature.
|
* Adds annotations regarding the "groups" feature.
|
||||||
|
*
|
||||||
|
* @param array<string> $annotations
|
||||||
|
*
|
||||||
|
* @return array<string>
|
||||||
*/
|
*/
|
||||||
public function add(TestCaseMethodFactory $method, array $annotations): array
|
public function add(TestCaseMethodFactory $method, array $annotations): array
|
||||||
{
|
{
|
||||||
|
|||||||
@ -98,6 +98,8 @@ final class TestCaseFactory
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a Test Case class using a runtime evaluate.
|
* Creates a Test Case class using a runtime evaluate.
|
||||||
|
*
|
||||||
|
* @param array<TestCaseMethodFactory> $methods
|
||||||
*/
|
*/
|
||||||
public function evaluate(string $filename, array $methods): string
|
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];
|
return $this->testCases[$filename];
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,6 +11,8 @@ final class Arr
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Checks if the given array has the given key.
|
* Checks if the given array has the given key.
|
||||||
|
*
|
||||||
|
* @param array<mixed> $array
|
||||||
*/
|
*/
|
||||||
public static function has(array $array, string|int $key): bool
|
public static function has(array $array, string|int $key): bool
|
||||||
{
|
{
|
||||||
@ -33,6 +35,8 @@ final class Arr
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the given key value.
|
* Gets the given key value.
|
||||||
|
*
|
||||||
|
* @param array<mixed> $array
|
||||||
*/
|
*/
|
||||||
public static function get(array $array, string|int $key, mixed $default = null): mixed
|
public static function get(array $array, string|int $key, mixed $default = null): mixed
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user