diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/CallAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/CallAnalyzer.php index 5b32c89b2..22cb4f9ca 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/CallAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/CallAnalyzer.php @@ -383,6 +383,7 @@ class CallAnalyzer || $arg->value instanceof PhpParser\Node\Expr\FuncCall || $arg->value instanceof PhpParser\Node\Expr\MethodCall || $arg->value instanceof PhpParser\Node\Expr\Assign + || $arg->value instanceof PhpParser\Node\Expr\Array_ ) ) { if (self::handleByRefFunctionArg( @@ -461,6 +462,7 @@ class CallAnalyzer || $arg->value instanceof PhpParser\Node\Expr\MethodCall || $arg->value instanceof PhpParser\Node\Expr\Assign || $arg->value instanceof PhpParser\Node\Expr\ArrayDimFetch + || $arg->value instanceof PhpParser\Node\Expr\Array_ ) { if (ExpressionAnalyzer::analyze($statements_analyzer, $arg->value, $context) === false) { return false; diff --git a/tests/UnusedVariableTest.php b/tests/UnusedVariableTest.php index 406ca6d3b..22be37dec 100644 --- a/tests/UnusedVariableTest.php +++ b/tests/UnusedVariableTest.php @@ -901,6 +901,17 @@ class UnusedVariableTest extends TestCase return (int) $_SESSION["str"]; }', ], + 'usedInArray' => [ + 'bar([$b]); + }', + ], ]; }