-
-
Notifications
You must be signed in to change notification settings - Fork 946
Closed
Labels
Milestone
Description
interface I1 {
public function someMethod();
}
interface I2 {
public function someOtherMethod();
}
class Foo {
/**
* @return I1&static
*/
public function bar() {
if ($this instanceof I1) {
return $this;
}
throw new \Exception('bad');
}
/**
* @return I2&static
*/
public function bat() {
if ($this instanceof I2) {
return $this;
}
throw new \Exception('bad');
}
}
$a = (new Foo)->bar();
$b = $a->bat();
$b->someMethod();
$b->someOtherMethod();Expected: No issue (these functions should allow composition so that $b has type I1&I2&Foo)
Actual: An issue - $b has type I2&Foo
Reactions are currently unavailable