| Conditions | 3 |
| Paths | 4 |
| Total Lines | 13 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| 1 | <?php namespace Modules\Core\Console\Installers\Scripts; |
||
| 13 | public function fire(Command $command) |
||
| 14 | { |
||
| 15 | if ($command->option('verbose')) { |
||
| 16 | $command->blockMessage('Themes', 'Publishing theme assets ...', 'comment'); |
||
|
|
|||
| 17 | } |
||
| 18 | |||
| 19 | if ($command->option('verbose')) { |
||
| 20 | $command->call('stylist:publish'); |
||
| 21 | |||
| 22 | return; |
||
| 23 | } |
||
| 24 | $command->callSilent('stylist:publish'); |
||
| 25 | } |
||
| 26 | } |
||
| 27 |
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: