mirror of
https://github.com/danog/psalm.git
synced 2024-11-30 04:39:00 +01:00
Fix #3779 - allow ParadoxicalCondition of default to be suppressed
This commit is contained in:
parent
33a834bb0b
commit
bf7bcc0dca
@ -499,7 +499,8 @@ class SwitchCaseAnalyzer
|
||||
new ParadoxicalCondition(
|
||||
'All possible case statements have been met, default is impossible here',
|
||||
new CodeLocation($statements_analyzer->getSource(), $case)
|
||||
)
|
||||
),
|
||||
$statements_analyzer->getSuppressedIssues()
|
||||
)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -923,6 +923,20 @@ class SwitchTypeTest extends TestCase
|
||||
return 4;
|
||||
}'
|
||||
],
|
||||
'suppressParadox' => [
|
||||
'<?php
|
||||
/** @psalm-var 1|2|3 $i */
|
||||
$i = rand(1, 3);
|
||||
|
||||
/** @psalm-suppress ParadoxicalCondition */
|
||||
switch($i) {
|
||||
case 1: break;
|
||||
case 2: break;
|
||||
case 3: break;
|
||||
default:
|
||||
echo "bar";
|
||||
}'
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user