Answer the question
In order to leave comments, you need to log in
Interface when inheriting a method: how to do it right?
interface IUser {
public static function getById(): IUser;
}
interface IAdmin extends IUser { ... }
class User implements IUser {
public static function getById(): IUser { ... }
}
class Admin extends User implements IAdmin {
// ...
}
public static function getById(): self;
Answer the question
In order to leave comments, you need to log in
There is a base User class from which other classes are inherited, such as Admin.
There is a discussion
here https://stackoverflow.com/questions/39068983/php-7...
Maybe we should abandon statics and return IUser ?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question