mirror of
https://github.com/danog/psalm.git
synced 2024-11-26 20:34:47 +01:00
remove unused function, fix unusedVariable error after suppress
This commit is contained in:
parent
6a0a9d1c15
commit
88e3cda3b9
@ -536,14 +536,16 @@ final class AssignmentAnalyzer
|
||||
$statements_analyzer->getSuppressedIssues(),
|
||||
)) {
|
||||
// if the error is suppressed, do not treat it as never anymore
|
||||
$context->vars_in_scope[$var_id] = Type::getMixed();
|
||||
$new_mutable = $context->vars_in_scope[$var_id]->getBuilder()->addType(new TMixed);
|
||||
$new_mutable->removeType('never');
|
||||
$context->vars_in_scope[$var_id] = $new_mutable->freeze();
|
||||
$context->has_returned = false;
|
||||
}
|
||||
|
||||
} else {
|
||||
$context->inside_assignment = $was_in_assignment;
|
||||
|
||||
return $context->vars_in_scope[$var_id];
|
||||
}
|
||||
}
|
||||
|
||||
if ($statements_analyzer->data_flow_graph) {
|
||||
$data_flow_graph = $statements_analyzer->data_flow_graph;
|
||||
|
@ -1332,10 +1332,6 @@ class UnusedCodeTest extends TestCase
|
||||
*/
|
||||
function foo() : void {}
|
||||
|
||||
function bar(mixed $s) : string {
|
||||
return is_string($s) ? "hello" : "world";
|
||||
}
|
||||
|
||||
/** @psalm-suppress NoValue */
|
||||
$a = foo();
|
||||
print_r($a);',
|
||||
@ -1349,6 +1345,7 @@ class UnusedCodeTest extends TestCase
|
||||
*/
|
||||
function foo() : void {}
|
||||
|
||||
/** @psalm-suppress UnusedParam */
|
||||
function bar(mixed $s) : void {}
|
||||
|
||||
/** @psalm-suppress NoValue */
|
||||
|
Loading…
Reference in New Issue
Block a user