Skip to content

Commit 362f47a

Browse files
committed
Regression test
1 parent 1bec9b6 commit 362f47a

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

tests/PHPStan/Rules/Properties/TypesAssignedToPropertiesRuleTest.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -914,4 +914,14 @@ public function testBug2888(): void
914914
]);
915915
}
916916

917+
public function testBug11241b(): void
918+
{
919+
$this->analyse([__DIR__ . '/data/bug-11241b.php'], [
920+
[
921+
'Property Bug11241b\HelloWorld::$property1 (bool) does not accept string.',
922+
14,
923+
],
924+
]);
925+
}
926+
917927
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
3+
namespace Bug11241b;
4+
5+
/**
6+
* @property-read string $property1
7+
*/
8+
class HelloWorld
9+
{
10+
public bool $property1 = false;
11+
}
12+
13+
$object = new HelloWorld();
14+
$object->property1 = 'foo';

0 commit comments

Comments
 (0)