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\Component\Core\Model; |
||
15 | |||
16 | use Doctrine\Common\Collections\ArrayCollection; |
||
17 | use Doctrine\Common\Collections\Collection; |
||
18 | use Sylius\Component\Addressing\Model\ZoneInterface; |
||
19 | use Sylius\Component\Channel\Model\ChannelInterface as BaseChannelInterface; |
||
20 | use Sylius\Component\Shipping\Model\ShippingMethod as BaseShippingMethod; |
||
21 | use Sylius\Component\Shipping\Model\ShippingMethodTranslation; |
||
22 | use Sylius\Component\Taxation\Model\TaxCategoryInterface; |
||
23 | |||
24 | class ShippingMethod extends BaseShippingMethod implements ShippingMethodInterface |
||
25 | { |
||
26 | /** |
||
27 | * @var ZoneInterface |
||
28 | */ |
||
29 | protected $zone; |
||
30 | |||
31 | /** |
||
32 | * @var TaxCategoryInterface |
||
33 | */ |
||
34 | protected $taxCategory; |
||
35 | |||
36 | /** |
||
37 | * @var Collection |
||
38 | */ |
||
39 | protected $channels; |
||
40 | |||
41 | public function __construct() |
||
42 | { |
||
43 | parent::__construct(); |
||
44 | |||
45 | $this->channels = new ArrayCollection(); |
||
0 ignored issues
–
show
|
|||
46 | } |
||
47 | |||
48 | /** |
||
49 | * {@inheritdoc} |
||
50 | */ |
||
51 | public function getZone(): ?ZoneInterface |
||
52 | { |
||
53 | return $this->zone; |
||
54 | } |
||
55 | |||
56 | /** |
||
57 | * {@inheritdoc} |
||
58 | */ |
||
59 | public function setZone(?ZoneInterface $zone): void |
||
60 | { |
||
61 | $this->zone = $zone; |
||
62 | } |
||
63 | |||
64 | /** |
||
65 | * {@inheritdoc} |
||
66 | */ |
||
67 | public function getTaxCategory(): ?TaxCategoryInterface |
||
68 | { |
||
69 | return $this->taxCategory; |
||
70 | } |
||
71 | |||
72 | /** |
||
73 | * {@inheritdoc} |
||
74 | */ |
||
75 | public function setTaxCategory(?TaxCategoryInterface $category): void |
||
76 | { |
||
77 | $this->taxCategory = $category; |
||
78 | } |
||
79 | |||
80 | /** |
||
81 | * {@inheritdoc} |
||
82 | */ |
||
83 | public function getChannels(): Collection |
||
84 | { |
||
85 | return $this->channels; |
||
86 | } |
||
87 | |||
88 | /** |
||
89 | * {@inheritdoc} |
||
90 | */ |
||
91 | public function hasChannel(BaseChannelInterface $channel): bool |
||
92 | { |
||
93 | return $this->channels->contains($channel); |
||
94 | } |
||
95 | |||
96 | /** |
||
97 | * {@inheritdoc} |
||
98 | */ |
||
99 | public function addChannel(BaseChannelInterface $channel): void |
||
100 | { |
||
101 | if (!$this->hasChannel($channel)) { |
||
102 | $this->channels->add($channel); |
||
103 | } |
||
104 | } |
||
105 | |||
106 | /** |
||
107 | * {@inheritdoc} |
||
108 | */ |
||
109 | public function removeChannel(BaseChannelInterface $channel): void |
||
110 | { |
||
111 | if ($this->hasChannel($channel)) { |
||
112 | $this->channels->removeElement($channel); |
||
113 | } |
||
114 | } |
||
115 | |||
116 | /** |
||
117 | * {@inheritdoc} |
||
118 | */ |
||
119 | public static function getTranslationClass(): string |
||
120 | { |
||
121 | return ShippingMethodTranslation::class; |
||
122 | } |
||
123 | } |
||
124 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..