mirror of
https://github.com/danog/psalm.git
synced 2025-01-21 21:31:13 +01:00
Fix #2685 - always evaluate $a++ in unknown call
This commit is contained in:
parent
3af48347a9
commit
34d73e7243
@ -644,6 +644,10 @@ class CallAnalyzer
|
||||
|| $arg->value instanceof PhpParser\Node\Expr\Array_
|
||||
|| $arg->value instanceof PhpParser\Node\Expr\BinaryOp
|
||||
|| $arg->value instanceof PhpParser\Node\Scalar\Encapsed
|
||||
|| $arg->value instanceof PhpParser\Node\Expr\PostInc
|
||||
|| $arg->value instanceof PhpParser\Node\Expr\PostDec
|
||||
|| $arg->value instanceof PhpParser\Node\Expr\PreInc
|
||||
|| $arg->value instanceof PhpParser\Node\Expr\PreDec
|
||||
) {
|
||||
$was_inside_call = $context->inside_call;
|
||||
$context->inside_call = true;
|
||||
|
@ -987,6 +987,15 @@ class CallableTest extends TestCase
|
||||
}',
|
||||
'error_message' => 'MixedArgumentTypeCoercion'
|
||||
],
|
||||
'undefinedVarInBareCallable' => [
|
||||
'<?php
|
||||
$fn = function(int $a): void{};
|
||||
function a(callable $fn): void{
|
||||
$fn(++$a);
|
||||
}
|
||||
a($fn);',
|
||||
'error_message' => 'UndefinedVariable',
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user