Interface inheritance #6159
-
I cant figure out if I am being silly here or not - but I have the below abstract class, which implements an interface: interface IAbstractClass {
public function getAll();
}
abstract class AbstractClass implements IAbstractClass {
public function getAll() {
return ["test", "array"];
}
} Then I have a class, which extends the abstract class: interface IChildClass {
}
class ChildClass extends AbstractClass implements IChildClass {
} For some reason PHP Stan cannot find the $test = new ChildClass();
$test->getAll(); // returns ["test", "array"] - PHP Stan says "undefined method getAll" Yet, if I change IChildClass to be: interface IChildClass extends IAbstractClass {
} It works as expected. Surely I shouldnt need to do that though, as ChildClass extends AbstractClass anyway? or am I being silly? xD Any help/explanation is appreciated! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
Hi, this looks complicated, can you replicate that on phpstan.org? |
Beta Was this translation helpful? Give feedback.
Hi, this looks complicated, can you replicate that on phpstan.org?