We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 430589e commit eb8304aCopy full SHA for eb8304a
1 file changed
tests/PHPStan/Analyser/nsrt/bug-14362.php
@@ -36,7 +36,27 @@ public function __invoke(B $b): int {
36
}
37
38
39
+interface E
40
+{
41
+ public function __invoke(string $s): bool;
42
+}
43
+
44
+interface F
45
46
47
48
49
function () : void {
50
assertType('Closure(Bug14362\B): int', C::u()(...));
51
assertType('Closure(Bug14362\B): int', D::u()(...));
52
53
+ // Intersection with only yes-callable types (both have __invoke)
54
+ /** @var A&E $yesCallable */
55
+ $yesCallable = C::u();
56
+ assertType('(Closure(Bug14362\B): int)|(Closure(string): bool)', $yesCallable(...));
57
58
+ // Intersection with only maybe-callable types (neither has __invoke)
59
+ /** @var B&F $maybeCallable */
60
+ $maybeCallable = C::u();
61
+ assertType('Closure', $maybeCallable(...));
62
};
0 commit comments