Conditions | 1 |
Paths | 1 |
Total Lines | 7 |
Code Lines | 5 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php namespace Tequilarapido\Cli\Commands\Base; |
||
42 | protected function outputGain() |
||
43 | { |
||
44 | $gain = $this->databaseSize['before'] - $this->databaseSize['after']; |
||
45 | $percentGain = round(($gain * 100) / $this->databaseSize['before'], 2); |
||
46 | $this->output->info(); |
||
|
|||
47 | $this->output->info("Database size: before=" . $this->databaseSize['before'] . "Mb -> after=" . $this->databaseSize['after'] . "Mb > Gain : " . $gain . "Mb (" . $percentGain . "%)"); |
||
48 | } |
||
49 | |||
50 | } |
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 implementation 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 interface: