diff --git a/src/Psalm/Internal/Analyzer/TypeAnalyzer.php b/src/Psalm/Internal/Analyzer/TypeAnalyzer.php index db39dec4c..ab333ce79 100644 --- a/src/Psalm/Internal/Analyzer/TypeAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/TypeAnalyzer.php @@ -1027,6 +1027,12 @@ class TypeAnalyzer } try { + $method_id = $codebase->methods->getDeclaringMethodId($method_id); + + if (!$method_id) { + return false; + } + $codebase->methods->getStorage($method_id); } catch (\Exception $e) { return false; diff --git a/tests/CallableTest.php b/tests/CallableTest.php index 1715e91e1..05f0ca791 100644 --- a/tests/CallableTest.php +++ b/tests/CallableTest.php @@ -757,6 +757,30 @@ class CallableTest extends TestCase } }' ], + 'publicCallableFromInside' => [ + ' [ + ' 'InvalidArgument' ], + 'privateCallable' => [ + '