Skip to content

Commit

Permalink
Always evaluate property calls on mixed methods
Browse files Browse the repository at this point in the history
  • Loading branch information
muglug committed Jul 12, 2019
1 parent 1208437 commit 7f0dcae
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
Expand Up @@ -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) {
Expand Down
11 changes: 11 additions & 0 deletions tests/MethodCallTest.php
Expand Up @@ -590,6 +590,17 @@ function foo($a) : void {
}',
'error_message' => 'UndefinedMethod',
],
'complainAboutUndefinedPropertyOnMixedCall' => [
'<?php
class C {
/** @param mixed $a */
public function foo($a) : void {
/** @psalm-suppress MixedMethodCall */
$a->bar($this->d);
}
}',
'error_message' => 'UndefinedThisPropertyFetch',
],
];
}
}

0 comments on commit 7f0dcae

Please sign in to comment.