-
-
Notifications
You must be signed in to change notification settings - Fork 946
Closed
Labels
Description
There already are a few issues discussing using trait and class inheritance together but it seems to me none of them really fit my observation (I may be wrong) .
I'm trying to override a trait method the way the official PHP documentation shows but PHPStan complains. Please see the example:
https://phpstan.org/r/3cd9314c-002d-4796-b9ce-4715c57650da
On 3v4l.org the code executes just fine. Any hints? Thank you.
class A {
}
class B extends A {
public function bar() : bool {
return true;
}
}
trait T {
public function bar() : bool {
return parent::bar();
}
}
class C extends A {
use T;
public function bar() : bool {
return false;
}
}
var_dump((new C())->bar());Reactions are currently unavailable