The concept that I think comes from the Traversable interface. This interface cannot be implemented directly, but instead an interface is implemented that extends it.
Can I declare an interface that cannot be implemented and extend it using public interfaces?
Edit: I understand that the opportunity would be completely pointless, as it could be circumvented by a third-party interface developer who could extend the base interface. I am looking for a cleaner way to express polymorphism.
For example:
abstract interface Vehicle { } interface Car extends Vehicle { public function drive(RouteProvider $routeProvider, $speed) } interface Boat extends Vehicle { public function sail(BodyOfWater $water, $heading); } class PeopleMover { public function move(Vehicle $vehicle) { if ($vehicle instanceof Boat) {
oop php abstract
Steve buzonas
source share