When binding an implementation for given Interface or Abstract class, e. g
$app->singleton(
Illuminate\Contracts\Http\Kernel::class,
App\Http\Kernel::class
);
how laravel determines that given implementation is one of the implementations of the the passed interface/abstract class
Lets assume I have following interfaces
IVehicle.php
namespace App;
interface IVehicle {
public function getNumberOfWheels();
}
IBicycle.php
namespace App;
interface IBicycle extends IVehicle {
}
I4Wheeler.php
namespace App;
interface I4Wheeler extends IVehicle {
}
Implementations:
Bike.php
namespace App;
class Bike implements IBicycle{
public function getNumberOfWheels(){
return 2;
}
}
Car.php
namespace App;
class Car implements I4Wheeler{
public function getNumberOfWheels(){
return 4;
}
}
Back to bind method :
$app->bind(
App\IBicycle::class,
App\Car::class
);
Give the above binding my question is how laravel validates OR not validate that Car is/or not is an implementation of App\IBicycle
interface ? What is the use of passing inteface/abstract class in more general sense if no validation is performed ?