1
0
mirror of https://github.com/danog/psalm.git synced 2025-01-22 05:41:20 +01:00

Update DateTimeInterface type reconciliation

This commit is contained in:
Jack Robertson 2021-07-26 13:41:52 +01:00
parent 8bec5fc743
commit 0e6160c1e0

View File

@ -208,6 +208,21 @@ class NegatedAssertionReconciler extends Reconciler
return $existing_var_type;
}
if (!$is_equality
&& ($assertion === 'DateTime' || $assertion === 'DateTimeImmutable')
&& isset($existing_var_atomic_types['DateTimeInterface'])
) {
$existing_var_type->removeType('DateTimeInterface');
if ($assertion === 'DateTime') {
$existing_var_type->addType(new TNamedObject('DateTimeImmutable'));
} else {
$existing_var_type->addType(new TNamedObject('DateTime'));
}
return $existing_var_type;
}
if (strtolower($assertion) === 'traversable'
&& isset($existing_var_atomic_types['iterable'])
) {