mirror of
https://github.com/danog/psalm.git
synced 2024-11-26 20:34:47 +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) {
|
||||
return false;
|
||||
}
|
||||
$stmt->inferredType = isset($stmt->expr->inferredType) ? $stmt->expr->inferredType : null;
|
||||
} elseif ($stmt instanceof PhpParser\Node\Expr\ShellExec) {
|
||||
if (IssueBuffer::accepts(
|
||||
new ForbiddenCode(
|
||||
|
@ -941,6 +941,13 @@ class FunctionCallTest extends TestCase
|
||||
*/
|
||||
function acceptsAShape(array $a): void {}',
|
||||
],
|
||||
'suppressError' => [
|
||||
'<?php
|
||||
$a = @file_get_contents("foo");',
|
||||
'assertions' => [
|
||||
'$a' => 'string|false',
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user