mirror of
https://github.com/danog/psalm.git
synced 2024-11-30 04:39:00 +01:00
Fix #2358 - always analyse new XXX(...) in unknown method calls
This commit is contained in:
parent
e76beffa78
commit
81f513bb4c
@ -405,6 +405,7 @@ class CallAnalyzer
|
||||
|| $arg->value instanceof PhpParser\Node\Expr\FuncCall
|
||||
|| $arg->value instanceof PhpParser\Node\Expr\MethodCall
|
||||
|| $arg->value instanceof PhpParser\Node\Expr\StaticCall
|
||||
|| $arg->value instanceof PhpParser\Node\Expr\New_
|
||||
|| $arg->value instanceof PhpParser\Node\Expr\Assign
|
||||
|| $arg->value instanceof PhpParser\Node\Expr\Array_
|
||||
)
|
||||
@ -625,6 +626,7 @@ class CallAnalyzer
|
||||
|| $arg->value instanceof PhpParser\Node\Expr\FuncCall
|
||||
|| $arg->value instanceof PhpParser\Node\Expr\MethodCall
|
||||
|| $arg->value instanceof PhpParser\Node\Expr\StaticCall
|
||||
|| $arg->value instanceof PhpParser\Node\Expr\New_
|
||||
|| $arg->value instanceof PhpParser\Node\Expr\Assign
|
||||
|| $arg->value instanceof PhpParser\Node\Expr\ArrayDimFetch
|
||||
|| $arg->value instanceof PhpParser\Node\Expr\PropertyFetch
|
||||
|
@ -1292,6 +1292,20 @@ class UnusedVariableTest extends TestCase
|
||||
echo $i;
|
||||
}'
|
||||
],
|
||||
'usedInNewCall' => [
|
||||
'<?php
|
||||
/**
|
||||
* @psalm-suppress MixedAssignment
|
||||
* @psalm-suppress MixedMethodCall
|
||||
* @psalm-suppress MissingParamType
|
||||
* @psalm-suppress MixedArgument
|
||||
* @psalm-suppress PossiblyNullArgument
|
||||
*/
|
||||
function foo($a): void {
|
||||
$m = $_GET["m"] ?? null;
|
||||
$a->foo(new Exception($m));
|
||||
}',
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user