mirror of
https://github.com/danog/psalm.git
synced 2024-11-27 04:45:20 +01:00
Fix issues
This commit is contained in:
parent
940459787a
commit
3cdb13f7ab
@ -133,17 +133,21 @@ class MatchAnalyzer
|
||||
$statements_analyzer->removeSuppressedIssues(['RedundantConditionGivenDocblockType']);
|
||||
}
|
||||
|
||||
if ($switch_var_id) {
|
||||
if ($switch_var_id && $last_arm->conds) {
|
||||
$codebase = $statements_analyzer->getCodebase();
|
||||
|
||||
$all_conds = $last_arm->conds ?: [];
|
||||
$all_conds = $last_arm->conds;
|
||||
|
||||
foreach ($arms as $arm) {
|
||||
if (!$arm->conds) {
|
||||
throw new \UnexpectedValueException('bad');
|
||||
}
|
||||
|
||||
$all_conds = array_merge($arm->conds, $all_conds);
|
||||
}
|
||||
|
||||
$all_match_condition = self::convertCondsToConditional(
|
||||
$all_conds,
|
||||
array_values($all_conds),
|
||||
$match_condition,
|
||||
$match_condition->getAttributes()
|
||||
);
|
||||
|
8
src/Psalm/Issue/UnhandledMatchCondition.php
Normal file
8
src/Psalm/Issue/UnhandledMatchCondition.php
Normal file
@ -0,0 +1,8 @@
|
||||
<?php
|
||||
namespace Psalm\Issue;
|
||||
|
||||
class UnhandledMatchCondition extends CodeIssue
|
||||
{
|
||||
const ERROR_LEVEL = 7;
|
||||
const SHORTCODE = 236;
|
||||
}
|
@ -136,7 +136,7 @@ class MatchTest extends TestCase
|
||||
"foo" => "foo",
|
||||
};
|
||||
}',
|
||||
'error_message' => 'ParadoxicalCondition',
|
||||
'error_message' => 'UnhandledMatchCondition',
|
||||
[],
|
||||
false,
|
||||
'8.0',
|
||||
|
Loading…
Reference in New Issue
Block a user