| Conditions | 1 |
| Paths | 1 |
| Total Lines | 11 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 1 | Features | 1 |
| 1 | <?php |
||
| 49 | public function addConfiguration(NodeDefinition $node) |
||
| 50 | { |
||
| 51 | $node |
||
|
1 ignored issue
–
show
|
|||
| 52 | ->children() |
||
| 53 | ->arrayNode('id') |
||
| 54 | ->prototype('scalar') |
||
| 55 | ->end() |
||
| 56 | ->isRequired() |
||
| 57 | ->end() |
||
| 58 | ->end(); |
||
| 59 | } |
||
| 60 | |||
| 76 |
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: