mirror of
https://github.com/danog/psalm.git
synced 2024-11-30 04:39:00 +01:00
parent
3af9ccde91
commit
f801561ea7
@ -945,6 +945,15 @@ class AssertionReconciler extends Reconciler
|
||||
$redundant = false;
|
||||
$existing_var_type->removeType($atomic_key);
|
||||
$existing_var_type->addType(new TEnumCase($fq_enum_name, $case_name));
|
||||
} elseif (AtomicTypeComparator::canBeIdentical(
|
||||
$statements_analyzer->getCodebase(),
|
||||
$atomic_type,
|
||||
$assertion_type,
|
||||
)) {
|
||||
$can_be_equal = true;
|
||||
$redundant = $atomic_key === $assertion_type->getKey();
|
||||
$existing_var_type->removeType($atomic_key);
|
||||
$existing_var_type->addType(new TEnumCase($fq_enum_name, $case_name));
|
||||
} elseif ($atomic_key !== $assertion_type->getKey()) {
|
||||
$existing_var_type->removeType($atomic_key);
|
||||
$redundant = false;
|
||||
|
@ -527,6 +527,21 @@ class EnumTest extends TestCase
|
||||
'ignored_issues' => [],
|
||||
'php_version' => '8.1',
|
||||
],
|
||||
'reconcileCaseWithInterface' => [
|
||||
'code' => <<<'PHP'
|
||||
<?php
|
||||
interface I {}
|
||||
enum E implements I { case A; }
|
||||
function f(I $i): void {
|
||||
if ($i === E::A) {
|
||||
} else {
|
||||
}
|
||||
}
|
||||
PHP,
|
||||
'assertions' => [],
|
||||
'ignored_issues' => [],
|
||||
'php_version' => '8.1',
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user