Skip to content

Commit

Permalink
void|never shouldn't be combined to null but keep void
Browse files Browse the repository at this point in the history
  • Loading branch information
kkmuffme committed Feb 29, 2024
1 parent 9aa450b commit bd11897
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/Psalm/Internal/Type/TypeCombiner.php
Original file line number Diff line number Diff line change
Expand Up @@ -149,14 +149,18 @@ public static function combine(
if (isset($combination->value_types['true'])) {
return Type::getTrue($from_docblock);
}
} elseif (isset($combination->value_types['void'])) {
unset($combination->value_types['void']);
} elseif (isset($combination->value_types['void']) && count($combination->value_types) > 1) {
if (count($combination->value_types) === 2 && isset($combination->value_types['never'])) {
// this is handled separately below, we can keep void
} else {
unset($combination->value_types['void']);

// if we're merging with another type, we cannot represent it in PHP
$from_docblock = true;
// if we're merging with another type, we cannot represent it in PHP
$from_docblock = true;

if (!isset($combination->value_types['null'])) {
$combination->value_types['null'] = new TNull($from_docblock);
if (!isset($combination->value_types['null'])) {
$combination->value_types['null'] = new TNull($from_docblock);
}
}
}

Expand Down

0 comments on commit bd11897

Please sign in to comment.