| 1 | <?php  | 
            ||
| 7 | class MakeBundleMod extends LaravelLangBundlerCommand  | 
            ||
| 8 | { | 
            ||
| 9 | /**  | 
            ||
| 10 | * The name and signature of the console command.  | 
            ||
| 11 | *  | 
            ||
| 12 | * @var string  | 
            ||
| 13 | */  | 
            ||
| 14 |     protected $signature = 'langb:mod {name}'; | 
            ||
| 15 | |||
| 16 | /**  | 
            ||
| 17 | * The console command description.  | 
            ||
| 18 | *  | 
            ||
| 19 | * @var string  | 
            ||
| 20 | */  | 
            ||
| 21 | protected $description = 'Create a custom modification file.';  | 
            ||
| 22 | |||
| 23 | /**  | 
            ||
| 24 | * Execute the console command.  | 
            ||
| 25 | */  | 
            ||
| 26 | public function handle()  | 
            ||
| 47 | |||
| 48 | /**  | 
            ||
| 49 | * Get stub and fill.  | 
            ||
| 50 | *  | 
            ||
| 51 | * @param string $name  | 
            ||
| 52 | *  | 
            ||
| 53 | * @return string  | 
            ||
| 54 | */  | 
            ||
| 55 | protected function getStub($name)  | 
            ||
| 78 | }  | 
            ||
| 79 | 
Let’s take a look at an example:
In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different sub-classes of User which does not have a getDisplayName() method, the code will break.
Available Fixes
Change the type-hint for the parameter:
Add an additional type-check:
Add the method to the parent class: