mirror of
https://github.com/danog/psalm.git
synced 2024-11-30 04:39:00 +01:00
Copy inferred type when suppressing errors
This commit is contained in:
parent
34fe935eb6
commit
5d6fb4efdf
@ -509,6 +509,7 @@ class ExpressionChecker
|
|||||||
if (self::analyze($statements_checker, $stmt->expr, $context) === false) {
|
if (self::analyze($statements_checker, $stmt->expr, $context) === false) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
$stmt->inferredType = isset($stmt->expr->inferredType) ? $stmt->expr->inferredType : null;
|
||||||
} elseif ($stmt instanceof PhpParser\Node\Expr\ShellExec) {
|
} elseif ($stmt instanceof PhpParser\Node\Expr\ShellExec) {
|
||||||
if (IssueBuffer::accepts(
|
if (IssueBuffer::accepts(
|
||||||
new ForbiddenCode(
|
new ForbiddenCode(
|
||||||
|
@ -941,6 +941,13 @@ class FunctionCallTest extends TestCase
|
|||||||
*/
|
*/
|
||||||
function acceptsAShape(array $a): void {}',
|
function acceptsAShape(array $a): void {}',
|
||||||
],
|
],
|
||||||
|
'suppressError' => [
|
||||||
|
'<?php
|
||||||
|
$a = @file_get_contents("foo");',
|
||||||
|
'assertions' => [
|
||||||
|
'$a' => 'string|false',
|
||||||
|
],
|
||||||
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user