Skip to content

Commit c6db4e7

Browse files
committed
test array-accessory to X
1 parent c16582a commit c6db4e7

File tree

1 file changed

+75
-0
lines changed

1 file changed

+75
-0
lines changed

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

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -501,6 +501,81 @@ public function doFoo(array $arr): void
501501
assertType('*NEVER*', $this->foo);
502502
}
503503

504+
/**
505+
* @param non-empty-array $arr
506+
*/
507+
public function doBar(array $arr): void
508+
{
509+
$this->foo = $arr;
510+
assertType('*NEVER*', $this->foo);
511+
}
512+
513+
/**
514+
* @param non-empty-list $list
515+
*/
516+
public function doBaz(array $list): void
517+
{
518+
$this->foo = $list;
519+
assertType('*NEVER*', $this->foo);
520+
}
521+
}
522+
523+
class FooArrayToFloat
524+
{
525+
public float $foo;
526+
527+
public function doFoo(array $arr): void
528+
{
529+
$this->foo = $arr;
530+
assertType('*NEVER*', $this->foo);
531+
}
532+
533+
/**
534+
* @param non-empty-array $arr
535+
*/
536+
public function doBar(array $arr): void
537+
{
538+
$this->foo = $arr;
539+
assertType('*NEVER*', $this->foo);
540+
}
541+
542+
/**
543+
* @param non-empty-list $list
544+
*/
545+
public function doBaz(array $list): void
546+
{
547+
$this->foo = $list;
548+
assertType('*NEVER*', $this->foo);
549+
}
550+
}
551+
552+
class FooArrayToString
553+
{
554+
public string $foo;
555+
556+
public function doFoo(array $arr): void
557+
{
558+
$this->foo = $arr;
559+
assertType('*NEVER*', $this->foo);
560+
}
561+
562+
/**
563+
* @param non-empty-array $arr
564+
*/
565+
public function doBar(array $arr): void
566+
{
567+
$this->foo = $arr;
568+
assertType('*NEVER*', $this->foo);
569+
}
570+
571+
/**
572+
* @param non-empty-list $list
573+
*/
574+
public function doBaz(array $list): void
575+
{
576+
$this->foo = $list;
577+
assertType('*NEVER*', $this->foo);
578+
}
504579
}
505580

506581
class FooArray

0 commit comments

Comments
 (0)