mirror of
https://github.com/danog/psalm.git
synced 2025-01-22 05:41:20 +01:00
Merge pull request #9519 from edsrzf/eval-inside-call
This commit is contained in:
commit
70a024f5e3
@ -26,7 +26,10 @@ class EvalAnalyzer
|
||||
PhpParser\Node\Expr\Eval_ $stmt,
|
||||
Context $context
|
||||
): void {
|
||||
$was_inside_call = $context->inside_call;
|
||||
$context->inside_call = true;
|
||||
ExpressionAnalyzer::analyze($statements_analyzer, $stmt->expr, $context);
|
||||
$context->inside_call = $was_inside_call;
|
||||
|
||||
$codebase = $statements_analyzer->getCodebase();
|
||||
|
||||
|
@ -709,6 +709,10 @@ class UnusedCodeTest extends TestCase
|
||||
return $i;
|
||||
}',
|
||||
],
|
||||
'usedFunctionCallInEval' => [
|
||||
'code' => '<?php
|
||||
eval(str_repeat("a", 10));',
|
||||
],
|
||||
'usedFunctionCallInsideSwitchWithTernary' => [
|
||||
'code' => '<?php
|
||||
function getArg(string $method) : void {
|
||||
|
@ -115,6 +115,13 @@ class UnusedVariableTest extends TestCase
|
||||
|
||||
unset($arr[$a]);',
|
||||
],
|
||||
'eval' => [
|
||||
'code' => '<?php
|
||||
if (rand()) {
|
||||
$v = "";
|
||||
eval($v);
|
||||
}',
|
||||
],
|
||||
'usedVariables' => [
|
||||
'code' => '<?php
|
||||
/** @return string */
|
||||
|
Loading…
x
Reference in New Issue
Block a user