-
Notifications
You must be signed in to change notification settings - Fork 555
Fix phpstan/phpstan#6799: wrongly reported empty array #5206
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 2.1.x
Are you sure you want to change the base?
Changes from 1 commit
c548c52
5ed6c61
8fbc944
58e5d14
2cb5e98
d285cf5
0a988f2
037a1c6
9697ad0
47445ba
1a312aa
3c97119
e013a69
bc76dc0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -51,10 +51,10 @@ function testByRefInArray(): void | |
| assertType('array{}', $a); | ||
|
|
||
| $b = [&$a]; | ||
| assertType('mixed', $a); // Could stay array{} | ||
| assertType('array{}', $a); | ||
|
|
||
| foo($b); | ||
| assertType('mixed', $a); | ||
| assertType('array{}', $a); | ||
| } | ||
|
|
||
| function testByRefInArrayWithKey(): void | ||
|
|
@@ -63,10 +63,10 @@ function testByRefInArrayWithKey(): void | |
| assertType("'hello'", $a); | ||
|
|
||
| $b = ['key' => &$a]; | ||
| assertType('mixed', $a); // Could stay 'hello' | ||
| assertType("'hello'", $a); | ||
|
|
||
| $b['key'] = 42; | ||
| assertType('mixed', $a); // Could be 42 | ||
| assertType("'hello'", $a); | ||
|
||
| } | ||
|
|
||
| function testMultipleByRefInArray(): void | ||
|
|
@@ -75,13 +75,13 @@ function testMultipleByRefInArray(): void | |
| $c = 'test'; | ||
|
|
||
| $b = [&$a, 'normal', &$c]; | ||
| assertType('mixed', $a); // Could stay 1 | ||
| assertType('mixed', $c); // Could stay 'test' | ||
| assertType('1', $a); | ||
| assertType("'test'", $c); | ||
|
|
||
| $b[0] = 2; | ||
| $b[1] = 'foo'; | ||
| $b[2] = 'bar'; | ||
|
|
||
| assertType('mixed', $a); // Could be 2 | ||
| assertType('mixed', $c); // Could be 'bar' | ||
| assertType('1', $a); | ||
| assertType("'test'", $c); | ||
|
||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be modified since $b was passed to foo and is related to $a