Conditions | 3 |
Paths | 4 |
Total Lines | 11 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
44 | public function prepend(array $bundleConfig, string $path, ContainerBuilder $container) |
||
45 | { |
||
46 | parent::prepend($bundleConfig, $path, $container); |
||
47 | |||
48 | if (null !== $bundleConfig['key_set']['signature']) { |
||
49 | ConfigurationHelper::addKeyset($container, 'oauth2_server.key_set.signature', 'jwkset', ['value' => $bundleConfig['key_set']['signature']]); |
||
50 | } |
||
51 | if (null !== $bundleConfig['key_set']['encryption']) { |
||
52 | ConfigurationHelper::addKeyset($container, 'oauth2_server.key_set.encryption', 'jwkset', ['value' => $bundleConfig['key_set']['encryption']]); |
||
53 | } |
||
54 | } |
||
55 | } |
||
56 |
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: