File tree Expand file tree Collapse file tree 2 files changed +43
-1
lines changed
tests/PHPStan/Analyser/nsrt Expand file tree Collapse file tree 2 files changed +43
-1
lines changed Original file line number Diff line number Diff line change 1- <?php
1+ <?php // lint >= 8.1
22
33namespace Bug13321 ;
44
Original file line number Diff line number Diff line change 1+ <?php // lint >= 8.2
2+
3+ namespace Bug13321b ;
4+
5+ use function PHPStan \Testing \assertType ;
6+
7+ class Foo
8+ {
9+ public function __construct (public string $ value )
10+ {
11+ }
12+ }
13+
14+ readonly class Bar
15+ {
16+ public function __construct (
17+ private ?Foo $ foo ,
18+ )
19+ {
20+ }
21+
22+ public function bar (): void
23+ {
24+ if ($ this ->foo === null ) {
25+ return ;
26+ }
27+ if ($ this ->foo ->value === '' ) {
28+ return ;
29+ }
30+
31+ assertType (Foo::class, $ this ->foo );
32+ assertType ('non-empty-string ' , $ this ->foo ->value );
33+
34+ $ test = function () {
35+ assertType (Foo::class, $ this ->foo );
36+ assertType ('string ' , $ this ->foo ->value );
37+ };
38+
39+ $ test ();
40+ }
41+
42+ }
You can’t perform that action at this time.
0 commit comments