Skip to content

Commit d338a47

Browse files
committed
test mix of array value types
1 parent 4bb13d8 commit d338a47

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

tests/PHPStan/Analyser/nsrt/bug-12393b.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,32 @@ public function doFoo(array $arr): void
507507
assertType("non-empty-array&hasOffsetValue('foo', 'bar')", $this->foo);
508508
}
509509
}
510+
}
511+
512+
class FooTypedArray
513+
{
514+
/**
515+
* @var array<int>
516+
*/
517+
public array $foo;
518+
519+
/**
520+
* @param array<float> $arr
521+
*/
522+
public function doFoo(array $arr): void
523+
{
524+
$this->foo = $arr;
525+
assertType('array<float>', $this->foo);
526+
}
510527

528+
/**
529+
* @param array<string> $arr
530+
*/
531+
public function doBar(array $arr): void
532+
{
533+
$this->foo = $arr;
534+
assertType('array<string>', $this->foo);
535+
}
511536
}
512537

513538
class FooList

0 commit comments

Comments
 (0)