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? (30 h 09 min)

You also get:

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

Already a member? Login here

Comments & Discussion

F
fpolli ✓ Link copied!

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?

PK
Povilas Korop ✓ Link copied!

Interface cannot extend other interfaces, from what I know.

F
fpolli ✓ Link copied!

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

PK
Povilas Korop ✓ Link copied!

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.