Conditions | 2 |
Paths | 1 |
Total Lines | 14 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
47 | protected function continueConfiguration(NodeDefinition $node) |
||
48 | { |
||
49 | parent::continueConfiguration($node); |
||
50 | $node |
||
|
|||
51 | ->validate() |
||
52 | ->ifTrue(function ($config) { |
||
53 | return true === $config['enabled'] && empty($config['path']); |
||
54 | }) |
||
55 | ->thenInvalid('The route name must be set.') |
||
56 | ->end() |
||
57 | ->children() |
||
58 | ->scalarNode('path')->defaultValue('/.well-known/openid-configuration')->end() |
||
59 | ->end(); //FIXME: add signature support |
||
60 | } |
||
61 | } |
||
62 |
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: