File tree Expand file tree Collapse file tree 2 files changed +35
-0
lines changed
tests/PHPStan/Rules/Properties Expand file tree Collapse file tree 2 files changed +35
-0
lines changed Original file line number Diff line number Diff line change @@ -806,4 +806,14 @@ public function testBug11171(): void
806806 $ this ->analyse ([__DIR__ . '/data/bug-11171.php ' ], []);
807807 }
808808
809+ public function testBug8282 (): void
810+ {
811+ if (PHP_VERSION_ID < 80000 ) {
812+ $ this ->markTestSkipped ('Test requires PHP 8.0. ' );
813+ }
814+
815+ $ this ->checkExplicitMixed = true ;
816+ $ this ->analyse ([__DIR__ . '/data/bug-8282.php ' ], []);
817+ }
818+
809819}
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace Bug8282 ;
4+
5+ /**
6+ * @phpstan-type record array{id: positive-int, name: string}
7+ */
8+ class Collection
9+ {
10+ /** @param list<record> $list */
11+ public function __construct (
12+ public array $ list
13+ )
14+ {
15+ }
16+
17+ public function updateNameById (int $ id , string $ name ): void
18+ {
19+ foreach ($ this ->list as $ index => $ entry ) {
20+ if ($ entry ['id ' ] === $ id ) {
21+ $ this ->list [$ index ]['name ' ] = $ name ;
22+ }
23+ }
24+ }
25+ }
You can’t perform that action at this time.
0 commit comments