mirror of
https://github.com/danog/psalm.git
synced 2025-01-22 05:41:20 +01:00
Examine arrays in unknown function calls
This commit is contained in:
parent
b7472c62c2
commit
e9afd3a6f3
@ -383,6 +383,7 @@ class CallAnalyzer
|
|||||||
|| $arg->value instanceof PhpParser\Node\Expr\FuncCall
|
|| $arg->value instanceof PhpParser\Node\Expr\FuncCall
|
||||||
|| $arg->value instanceof PhpParser\Node\Expr\MethodCall
|
|| $arg->value instanceof PhpParser\Node\Expr\MethodCall
|
||||||
|| $arg->value instanceof PhpParser\Node\Expr\Assign
|
|| $arg->value instanceof PhpParser\Node\Expr\Assign
|
||||||
|
|| $arg->value instanceof PhpParser\Node\Expr\Array_
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
if (self::handleByRefFunctionArg(
|
if (self::handleByRefFunctionArg(
|
||||||
@ -461,6 +462,7 @@ class CallAnalyzer
|
|||||||
|| $arg->value instanceof PhpParser\Node\Expr\MethodCall
|
|| $arg->value instanceof PhpParser\Node\Expr\MethodCall
|
||||||
|| $arg->value instanceof PhpParser\Node\Expr\Assign
|
|| $arg->value instanceof PhpParser\Node\Expr\Assign
|
||||||
|| $arg->value instanceof PhpParser\Node\Expr\ArrayDimFetch
|
|| $arg->value instanceof PhpParser\Node\Expr\ArrayDimFetch
|
||||||
|
|| $arg->value instanceof PhpParser\Node\Expr\Array_
|
||||||
) {
|
) {
|
||||||
if (ExpressionAnalyzer::analyze($statements_analyzer, $arg->value, $context) === false) {
|
if (ExpressionAnalyzer::analyze($statements_analyzer, $arg->value, $context) === false) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -901,6 +901,17 @@ class UnusedVariableTest extends TestCase
|
|||||||
return (int) $_SESSION["str"];
|
return (int) $_SESSION["str"];
|
||||||
}',
|
}',
|
||||||
],
|
],
|
||||||
|
'usedInArray' => [
|
||||||
|
'<?php
|
||||||
|
/**
|
||||||
|
* @psalm-suppress MixedMethodCall
|
||||||
|
* @psalm-suppress MissingParamType
|
||||||
|
*/
|
||||||
|
function foo($a) : void {
|
||||||
|
$b = "b";
|
||||||
|
$a->bar([$b]);
|
||||||
|
}',
|
||||||
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user