mirror of
https://github.com/danog/psalm.git
synced 2024-11-27 04:45:20 +01:00
Fix #3327 - convert void to null when comparing conditional type with nullable
This commit is contained in:
parent
742282bbb5
commit
a4141a7581
@ -609,16 +609,21 @@ abstract class FunctionLikeAnalyzer extends SourceAnalyzer
|
||||
true
|
||||
);
|
||||
|
||||
if ($closure_return_types) {
|
||||
$closure_return_type = \Psalm\Internal\Type\TypeCombination::combineTypes(
|
||||
$closure_return_type = $closure_return_types
|
||||
? \Psalm\Internal\Type\TypeCombination::combineTypes(
|
||||
$closure_return_types,
|
||||
$codebase
|
||||
);
|
||||
)
|
||||
: null;
|
||||
|
||||
$closure_yield_type = $closure_yield_types
|
||||
? \Psalm\Internal\Type\TypeCombination::combineTypes($closure_yield_types)
|
||||
: null;
|
||||
$closure_yield_type = $closure_yield_types
|
||||
? \Psalm\Internal\Type\TypeCombination::combineTypes(
|
||||
$closure_yield_types,
|
||||
$codebase
|
||||
)
|
||||
: null;
|
||||
|
||||
if ($closure_return_type || $closure_yield_type) {
|
||||
if ($closure_yield_type) {
|
||||
$closure_return_type = $closure_yield_type;
|
||||
}
|
||||
|
@ -1378,6 +1378,10 @@ class Union implements TypeNode
|
||||
$codebase
|
||||
);
|
||||
|
||||
if ($atomic_type->as_type->isNullable() && $template_type->isVoid()) {
|
||||
$template_type = Type::getNull();
|
||||
}
|
||||
|
||||
if (TypeAnalyzer::isContainedBy(
|
||||
$codebase,
|
||||
$template_type,
|
||||
|
Loading…
Reference in New Issue
Block a user