File tree 2 files changed +41
-0
lines changed
tests/PHPStan/Rules/Properties
2 files changed +41
-0
lines changed Original file line number Diff line number Diff line change @@ -392,6 +392,16 @@ public function testBug10048(): void
392
392
$ this ->analyse ([__DIR__ . '/data/bug-10048.php ' ], []);
393
393
}
394
394
395
+ public function testBug11828 (): void
396
+ {
397
+ if (PHP_VERSION_ID < 80100 ) {
398
+ $ this ->markTestSkipped ('Test requires PHP 8.1. ' );
399
+ }
400
+
401
+ $ this ->shouldNarrowMethodScopeFromConstructor = true ;
402
+ $ this ->analyse ([__DIR__ . '/data/bug-11828.php ' ], []);
403
+ }
404
+
395
405
public function testBug9864 (): void
396
406
{
397
407
if (PHP_VERSION_ID < 80100 ) {
Original file line number Diff line number Diff line change
1
+ <?php declare (strict_types = 1 );
2
+
3
+ namespace Bug11828 ;
4
+
5
+ class Dummy
6
+ {
7
+ /**
8
+ * @var callable
9
+ */
10
+ private $ callable ;
11
+ private readonly int $ foo ;
12
+
13
+ public function __construct (int $ foo )
14
+ {
15
+ $ this ->foo = $ foo ;
16
+
17
+ $ this ->callable = function () {
18
+ $ foo = $ this ->getFoo ();
19
+ };
20
+ }
21
+
22
+ public function getFoo (): int
23
+ {
24
+ return $ this ->foo ;
25
+ }
26
+
27
+ public function getCallable (): callable
28
+ {
29
+ return $ this ->callable ;
30
+ }
31
+ }
You can’t perform that action at this time.
0 commit comments