Skip to content

Commit b260dad

Browse files
committed
test union of intersection types
1 parent 04f8a96 commit b260dad

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

tests/PHPStan/Analyser/nsrt/bug-14362.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,3 +68,12 @@ function () : void {
6868
// Intersection with only maybe-callable types (neither has __invoke)
6969
assertType('Closure', H::u()(...));
7070
};
71+
72+
function doFoo(string $c):void {
73+
if (is_callable($c)) {
74+
$a = $c;
75+
} else {
76+
$a = C::u()(...);
77+
}
78+
assertType('callable-string|(Closure(Bug14362\B): int)', $a);
79+
}

0 commit comments

Comments
 (0)