Skip to main content

L: Liskov Substitution Principle - Type-Hint Everything

Premium
6:21

The Full Lesson is Only for Premium Members

Want to access all of our courses? (36 h 00 min)

You also get:

61 courses
Premium tutorials
Access to repositories
Private Discord
Get Premium for $129/year or $29/month

Already a member? Login here

fpolli avatar

When you need to add a function for a class, can you just extend the interface to a new interface that adds that function and implement the new interface with the class?

Povilas Korop avatar

Interface cannot extend other interfaces, from what I know.

fpolli avatar

The PHP manual says "Note: Interfaces can be extended like classes using the extends operator." https://www.php.net/manual/en/language.oop5.interfaces.php

Pretty cool

Povilas Korop avatar

Hmm, sorry for misleading you. Maybe it's just me - I just haven't USED it in this way, never had practical need to make such extending.

We'd Love Your Feedback

Tell us what you like or what we can improve

Feel free to share anything you like or dislike about this page or the platform in general.