From 7f0dcae0b2a498c9b0037fbed768c1599642c140 Mon Sep 17 00:00:00 2001 From: Brown Date: Fri, 12 Jul 2019 14:39:06 -0400 Subject: [PATCH] Always evaluate property calls on mixed methods --- .../Analyzer/Statements/Expression/CallAnalyzer.php | 1 + tests/MethodCallTest.php | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/CallAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/CallAnalyzer.php index b001d9d4a3c..377eb8867f4 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/CallAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/CallAnalyzer.php @@ -585,6 +585,7 @@ private static function evaluateAribitraryParam( || $arg->value instanceof PhpParser\Node\Expr\StaticCall || $arg->value instanceof PhpParser\Node\Expr\Assign || $arg->value instanceof PhpParser\Node\Expr\ArrayDimFetch + || $arg->value instanceof PhpParser\Node\Expr\PropertyFetch || $arg->value instanceof PhpParser\Node\Expr\Array_ ) { if (ExpressionAnalyzer::analyze($statements_analyzer, $arg->value, $context) === false) { diff --git a/tests/MethodCallTest.php b/tests/MethodCallTest.php index ad7ea3ece86..83e8822b434 100644 --- a/tests/MethodCallTest.php +++ b/tests/MethodCallTest.php @@ -590,6 +590,17 @@ function foo($a) : void { }', 'error_message' => 'UndefinedMethod', ], + 'complainAboutUndefinedPropertyOnMixedCall' => [ + 'bar($this->d); + } + }', + 'error_message' => 'UndefinedThisPropertyFetch', + ], ]; } }