Hi,
I’m trying to understand why when a class implements an interface it can be used just like hinting for a class.
IE:
interface FooInterface {}
class Foo implements FooInterface {}
class Boz implements FooInterface {}
class Bar {
public function check(FooInterface $fi) {} // will work for Foo and Boz class
}
Why does this work? Although they implement the same interface an object may not have a method if it is called.