Skip to content

Commit d332bf5

Browse files
committed
Regression test
Closes phpstan/phpstan#6773
1 parent 51cffd4 commit d332bf5

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

tests/PHPStan/Rules/Properties/ReadOnlyPropertyAssignRuleTest.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,4 +140,13 @@ public function testReadOnlyClasses(): void
140140
]);
141141
}
142142

143+
public function testBug6773(): void
144+
{
145+
if (PHP_VERSION_ID < 80100) {
146+
$this->markTestSkipped('Test requires PHP 8.1.');
147+
}
148+
149+
$this->analyse([__DIR__ . '/data/bug-6773.php'], []);
150+
}
151+
143152
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php // lint >= 8.1
2+
3+
namespace Bug6773;
4+
5+
final class Repository
6+
{
7+
/**
8+
* @param array<string, string> $data
9+
*/
10+
public function __construct(private readonly array $data)
11+
{
12+
}
13+
14+
public function remove(string $key): void
15+
{
16+
unset($this->data[$key]);
17+
}
18+
}

0 commit comments

Comments
 (0)