File tree Expand file tree Collapse file tree 2 files changed +11
-0
lines changed
tests/PHPStan/Analyser/nsrt Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -3744,6 +3744,8 @@ private function enterAnonymousFunctionWithoutReflection(
37443744 && $ expr ->var instanceof Variable
37453745 && is_string ($ expr ->var ->name )
37463746 && $ expr ->var ->name === 'this '
3747+ && !$ closure ->static
3748+ && $ this ->hasVariableType ('this ' )->yes ()
37473749 && $ this ->phpVersion ->supportsReadOnlyProperties ()
37483750 ) {
37493751 $ propertyReflection = $ this ->propertyReflectionFinder ->findPropertyReflectionFromNode ($ expr , $ this );
Original file line number Diff line number Diff line change @@ -37,6 +37,15 @@ public function bar(): void
3737 };
3838
3939 $ test ();
40+
41+ $ test = static function () {
42+ assertType ('mixed ' , $ this ->foo );
43+ assertType ('mixed ' , $ this ->writableFoo );
44+
45+ echo $ this ->foo ->value ;
46+ };
47+
48+ $ test ();
4049 }
4150
4251}
You can’t perform that action at this time.
0 commit comments