Skip to content

Commit 1c4a92c

Browse files
herndlmondrejmirtes
authored andcommitted
only run test starting with PHP 8.1, add second snippet in test file
1 parent 1bf6784 commit 1c4a92c

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

tests/PHPStan/Analyser/NodeScopeResolverTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -879,6 +879,7 @@ public function dataFileAsserts(): iterable
879879
if (PHP_VERSION_ID >= 80100) {
880880
yield from $this->gatherAssertTypes(__DIR__ . '/data/bug-7167.php');
881881
yield from $this->gatherAssertTypes(__DIR__ . '/data/bug-6864.php');
882+
yield from $this->gatherAssertTypes(__DIR__ . '/data/bug-7776.php');
882883
}
883884

884885
yield from $this->gatherAssertTypes(__DIR__ . '/data/bug-7068.php');
@@ -970,7 +971,6 @@ public function dataFileAsserts(): iterable
970971
yield from $this->gatherAssertTypes(__DIR__ . '/../Rules/Arrays/data/bug-7469.php');
971972
yield from $this->gatherAssertTypes(__DIR__ . '/../Rules/Variables/data/bug-3391.php');
972973
yield from $this->gatherAssertTypes(__DIR__ . '/data/bug-6901.php');
973-
yield from $this->gatherAssertTypes(__DIR__ . '/data/bug-7776.php');
974974
}
975975

976976
/**

tests/PHPStan/Analyser/data/bug-7776.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,13 @@ function test(array $settings = []): bool {
1313
assertType('array{page?: int, search?: string}', $settings);
1414
return isset($copy['search']);
1515
}
16+
17+
/**
18+
* @param array{page?: int, search?: string} $settings
19+
*/
20+
function test2(array $settings = []): bool {
21+
$copy = ['page' => 1, ...$settings];
22+
assertType('array{page: int, search?: string}', $copy);
23+
assertType('array{page?: int, search?: string}', $settings);
24+
return isset($copy['search']);
25+
}

0 commit comments

Comments
 (0)