We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c902e22 commit 906ca75Copy full SHA for 906ca75
.phpunit.cache/test-results
tests/PHPStan/Analyser/nsrt/bug-13272.php
@@ -17,3 +17,16 @@ function foo(object $bar): void
17
assertType("object&hasMethod(quux)&hasMethod(qux)", $bar);
18
}
19
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