| Conditions | 4 |
| Paths | 6 |
| Total Lines | 14 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php namespace Modules\Core\Console\Installers\Scripts; |
||
| 25 | public function fire(Command $command) |
||
| 26 | { |
||
| 27 | if ($command->option('verbose')) { |
||
| 28 | $command->blockMessage('Migrations', 'Starting the module migrations ...', 'comment'); |
||
|
|
|||
| 29 | } |
||
| 30 | |||
| 31 | foreach ($this->modules as $module) { |
||
| 32 | if ($command->option('verbose')) { |
||
| 33 | $command->call('module:migrate', ['module' => $module]); |
||
| 34 | continue; |
||
| 35 | } |
||
| 36 | $command->callSilent('module:migrate', ['module' => $module]); |
||
| 37 | } |
||
| 38 | } |
||
| 39 | } |
||
| 40 |
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: