1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-27 04:45:20 +01:00

Fix issues

This commit is contained in:
Brown 2020-08-31 23:03:36 -04:00
parent 940459787a
commit 3cdb13f7ab
3 changed files with 16 additions and 4 deletions

View File

@ -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()
);

View File

@ -0,0 +1,8 @@
<?php
namespace Psalm\Issue;
class UnhandledMatchCondition extends CodeIssue
{
const ERROR_LEVEL = 7;
const SHORTCODE = 236;
}

View File

@ -136,7 +136,7 @@ class MatchTest extends TestCase
"foo" => "foo",
};
}',
'error_message' => 'ParadoxicalCondition',
'error_message' => 'UnhandledMatchCondition',
[],
false,
'8.0',