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 @@ -785,4 +785,14 @@ public function testBug11171(): void
785785 $ this ->analyse ([__DIR__ . '/data/bug-11171.php ' ], []);
786786 }
787787
788+ public function testBug8282 (): void
789+ {
790+ if (PHP_VERSION_ID < 80000 ) {
791+ $ this ->markTestSkipped ('Test requires PHP 8.0. ' );
792+ }
793+
794+ $ this ->checkExplicitMixed = true ;
795+ $ this ->analyse ([__DIR__ . '/data/bug-8282.php ' ], []);
796+ }
797+
788798}
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