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 @@ -3714,6 +3714,8 @@ private function enterAnonymousFunctionWithoutReflection(
37143714 && $ expr ->var instanceof Variable
37153715 && is_string ($ expr ->var ->name )
37163716 && $ expr ->var ->name === 'this '
3717+ && !$ closure ->static
3718+ && $ this ->hasVariableType ('this ' )->yes ()
37173719 && $ this ->phpVersion ->supportsReadOnlyProperties ()
37183720 ) {
37193721 $ 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