Skip to content

Commit 906ca75

Browse files
committed
Add failling test
1 parent c902e22 commit 906ca75

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

.phpunit.cache/test-results

Lines changed: 1 addition & 0 deletions
Large diffs are not rendered by default.

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,16 @@ function foo(object $bar): void
1717
assertType("object&hasMethod(quux)&hasMethod(qux)", $bar);
1818
}
1919
}
20+
21+
/**
22+
* @param 'quux'|'qux' $constUnion
23+
*/
24+
function fooBar(object $bar, string $constUnion): void
25+
{
26+
if (!method_exists($bar, $constUnion)) {
27+
throw new \Exception;
28+
}
29+
30+
// at this point we don't know whether $constUnion was 'quux' or 'qux'
31+
assertType("object", $bar);
32+
}

0 commit comments

Comments
 (0)