Skip to content

Commit d3909c7

Browse files
committed
Test for set-hooked property being overriden by readonly property
1 parent d25a815 commit d3909c7

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

tests/PHPStan/Rules/Properties/OverridingPropertyRuleTest.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,12 @@ public function testBug12586(): void
260260
}
261261

262262
$this->reportMaybes = true;
263-
$this->analyse([__DIR__ . '/data/bug-12586.php'], []);
263+
$this->analyse([__DIR__ . '/data/bug-12586.php'], [
264+
[
265+
'Readonly property Bug12586\FooImpl::$baz overrides readwrite property Bug12586\Foo::$baz.',
266+
23,
267+
],
268+
]);
264269
}
265270

266271
}

tests/PHPStan/Rules/Properties/data/bug-12586.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,18 @@ interface Foo
99
public string $bar {
1010
get;
1111
}
12+
13+
public string $baz {
14+
get;
15+
set;
16+
}
1217
}
1318

1419
readonly class FooImpl implements Foo
1520
{
1621
public function __construct(
1722
public string $bar,
23+
public string $baz,
1824
)
1925
{
2026
}

0 commit comments

Comments
 (0)