mirror of
https://github.com/pestphp/pest.git
synced 2026-03-12 02:37:22 +01:00
fix: type declaration for and add small comment RE: merge behaviour
This commit is contained in:
@ -25,7 +25,7 @@ final class TestRepository
|
|||||||
private $state = [];
|
private $state = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var array<string, array<int, array<int, string, Closure>>>
|
* @var array<string, array<int, array<int, string|Closure>>>
|
||||||
*/
|
*/
|
||||||
private $uses = [];
|
private $uses = [];
|
||||||
|
|
||||||
@ -53,7 +53,7 @@ final class TestRepository
|
|||||||
[$filename] = explode('@', $key);
|
[$filename] = explode('@', $key);
|
||||||
|
|
||||||
if ((!is_dir($path) && $filename === $path) || (is_dir($path) && $startsWith($filename, $path))) {
|
if ((!is_dir($path) && $filename === $path) || (is_dir($path) && $startsWith($filename, $path))) {
|
||||||
foreach ($classOrTraits as $class) {
|
foreach ($classOrTraits as $class) { /** @var string $class */
|
||||||
if (class_exists($class)) {
|
if (class_exists($class)) {
|
||||||
if ($testCase->class !== TestCase::class) {
|
if ($testCase->class !== TestCase::class) {
|
||||||
throw new TestCaseAlreadyInUse($testCase->class, $class, $filename);
|
throw new TestCaseAlreadyInUse($testCase->class, $class, $filename);
|
||||||
@ -114,7 +114,7 @@ final class TestRepository
|
|||||||
$this->uses[$path] = [
|
$this->uses[$path] = [
|
||||||
array_merge($this->uses[$path][0], $classOrTraits),
|
array_merge($this->uses[$path][0], $classOrTraits),
|
||||||
array_merge($this->uses[$path][1], $groups),
|
array_merge($this->uses[$path][1], $groups),
|
||||||
$this->uses[$path][2] + $hooks,
|
$this->uses[$path][2] + $hooks, // NOTE: array_merge will destroy numeric indices
|
||||||
];
|
];
|
||||||
} else {
|
} else {
|
||||||
$this->uses[$path] = [$classOrTraits, $groups, $hooks];
|
$this->uses[$path] = [$classOrTraits, $groups, $hooks];
|
||||||
|
|||||||
Reference in New Issue
Block a user