| Conditions | 1 |
| Paths | 1 |
| Total Lines | 21 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 26 | public function handle() |
||
| 27 | { |
||
| 28 | $this->setUp(); |
||
| 29 | |||
| 30 | $pathArray = ['LangBundler', 'Mods']; |
||
| 31 | |||
| 32 | $basePath = app_path().DIRECTORY_SEPARATOR; |
||
| 33 | |||
| 34 | $this->buildPath($pathArray, $basePath); |
||
| 35 | |||
| 36 | $name = ucfirst($this->argument('name')).'Mod'; |
||
| 37 | |||
| 38 | $stub = $this->getStub($name); |
||
| 39 | |||
| 40 | $this->filesystem->put( |
||
| 41 | app_path(implode(DIRECTORY_SEPARATOR, $pathArray).DIRECTORY_SEPARATOR.$name.'.php'), |
||
| 42 | $stub |
||
| 43 | ); |
||
| 44 | |||
| 45 | $this->info('New bundle modification file successfully created!'); |
||
| 46 | } |
||
| 47 | |||
| 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: