diff --git a/tests/PHPStan/Rules/Methods/CallMethodsRuleTest.php b/tests/PHPStan/Rules/Methods/CallMethodsRuleTest.php index ccc70a0afc2..eb59267532a 100644 --- a/tests/PHPStan/Rules/Methods/CallMethodsRuleTest.php +++ b/tests/PHPStan/Rules/Methods/CallMethodsRuleTest.php @@ -867,7 +867,11 @@ public function testClosureBind(): void ], [ 'Call to an undefined method CallClosureBind\Foo::nonexistentMethod().', - 44, + 43, + ], + [ + 'Call to an undefined method CallClosureBind\Foo::nonexistentMethod().', + 49, ], ]); } diff --git a/tests/PHPStan/Rules/Methods/data/closure-bind.php b/tests/PHPStan/Rules/Methods/data/closure-bind.php index f6aa9e05b73..bbd622f43ad 100644 --- a/tests/PHPStan/Rules/Methods/data/closure-bind.php +++ b/tests/PHPStan/Rules/Methods/data/closure-bind.php @@ -38,6 +38,11 @@ public function fooMethod(): Foo $foo->nonexistentMethod(); }, null, get_class(new Foo())); + \Closure::bind(function (Foo $foo) { + $foo->privateMethod(); + $foo->nonexistentMethod(); + }, null, get_class($this)); + \Closure::bind(function () { // $this is Foo $this->privateMethod();