Skip to content

Commit 92a5797

Browse files
ondrejmirtesclaude
andcommitted
Fix tests: bug-7963, bug-13978
bug-7963: loosen `@phpstan-return` to `array<int, non-empty-list<mixed>>` to match the actual heterogeneous list-of-lists return shape — the prior shape required positional `string`/`array<string, mixed>` types that no union member satisfies. bug-13978: PHPStan checks `@param-out` at every mutation, so the intermediate state with both `key1` and `key2` (between `$item['key2'] =` and `unset($item['key1'])`) needs to be in the union too. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent afc78ff commit 92a5797

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
* @param-out array{
1212
* key1: int
1313
* }|array{
14+
* key1: int,
15+
* key2: float
16+
* }|array{
1417
* key2: float
1518
* } $item
1619
*

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ interface FieldDescriptionInterface
3131
class HelloWorld
3232
{
3333
/**
34-
* @phpstan-return array<array{string, string, mixed, array<string, mixed>, ...}>
34+
* @phpstan-return array<int, non-empty-list<mixed>>
3535
*/
3636
public function getRenderViewElementTests(): array
3737
{

0 commit comments

Comments
 (0)