Conditions | 1 |
Paths | 1 |
Total Lines | 13 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Tests | 6 |
CRAP Score | 1 |
Changes | 0 |
1 | <?php |
||
21 | 4 | protected function configure() |
|
22 | { |
||
23 | $this |
||
24 | 4 | ->setName('REPORT') |
|
25 | 4 | ->setDescription('Get a report from the robot') |
|
26 | 4 | ->setHelp(<<<EOT |
|
27 | 4 | The <info>robot:report</info> will get a report from the robot; |
|
28 | |||
29 | <info>./toyrobot</info> <comment>REPORT</comment> |
||
30 | |||
31 | EOT |
||
32 | ); |
||
33 | 4 | } |
|
34 | |||
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: