These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | /* |
||
4 | * This file is part of the Sylius package. |
||
5 | * |
||
6 | * (c) Paweł Jędrzejewski |
||
7 | * |
||
8 | * For the full copyright and license information, please view the LICENSE |
||
9 | * file that was distributed with this source code. |
||
10 | */ |
||
11 | |||
12 | declare(strict_types=1); |
||
13 | |||
14 | namespace Sylius\Bundle\CoreBundle\Provider; |
||
15 | |||
16 | use Sylius\Component\Addressing\Model\ZoneInterface; |
||
17 | use Sylius\Component\Core\Model\OrderInterface; |
||
18 | use Sylius\Component\Core\Provider\ZoneProviderInterface; |
||
19 | |||
20 | final class ChannelBasedDefaultTaxZoneProvider implements ZoneProviderInterface |
||
21 | { |
||
22 | /** |
||
23 | * {@inheritdoc} |
||
24 | */ |
||
25 | public function getZone(OrderInterface $order): ?ZoneInterface |
||
26 | { |
||
27 | return $order->getChannel()->getDefaultTaxZone(); |
||
0 ignored issues
–
show
|
|||
28 | } |
||
29 | } |
||
30 |
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: