1
0
mirror of https://github.com/danog/psalm.git synced 2025-01-21 21:31:13 +01:00

Analyse encapsulated string when method not known

Ref #2052
This commit is contained in:
Brown 2019-08-23 10:59:59 -04:00
parent e0cd04d809
commit f00ee740c0
2 changed files with 13 additions and 3 deletions

View File

@ -341,10 +341,10 @@ class CallAnalyzer
protected static function checkFunctionArguments(
StatementsAnalyzer $statements_analyzer,
array $args,
$function_params,
$method_id,
?array $function_params,
?string $method_id,
Context $context,
$generic_params = null
?array $generic_params = null
) {
$last_param = $function_params
? $function_params[count($function_params) - 1]
@ -592,6 +592,7 @@ class CallAnalyzer
|| $arg->value instanceof PhpParser\Node\Expr\PropertyFetch
|| $arg->value instanceof PhpParser\Node\Expr\Array_
|| $arg->value instanceof PhpParser\Node\Expr\BinaryOp
|| $arg->value instanceof PhpParser\Node\Scalar\Encapsed
) {
$was_inside_call = $context->inside_call;
$context->inside_call = true;

View File

@ -528,6 +528,15 @@ class UnusedCodeTest extends TestCase
($foo . ucfirst($bar))();',
],
'usedParamInUnknownMethodConcat' => [
'<?php
/**
* @psalm-suppress MixedMethodCall
*/
function foo(string $s, object $o) : void {
$o->foo("COUNT{$s}");
}'
],
];
}