1 | <?php |
||
2 | |||
3 | /** |
||
4 | * MIT License |
||
5 | * Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file. |
||
6 | */ |
||
7 | |||
8 | namespace SprykerEco\Zed\Ratepay\Business\Expander; |
||
9 | |||
10 | use Generated\Shared\Transfer\CartChangeTransfer; |
||
11 | use SprykerEco\Zed\Ratepay\Dependency\Facade\RatepayToProductInterface; |
||
12 | |||
13 | class ProductExpander implements ProductExpanderInterface |
||
14 | { |
||
15 | /** |
||
16 | * @var \SprykerEco\Zed\Ratepay\Dependency\Facade\RatepayToProductBridge |
||
17 | */ |
||
18 | protected $ratepayToProductBridge; |
||
19 | |||
20 | /** |
||
21 | * @param \SprykerEco\Zed\Ratepay\Dependency\Facade\RatepayToProductInterface $ratepayToProductBridge |
||
22 | */ |
||
23 | public function __construct(RatepayToProductInterface $ratepayToProductBridge) |
||
24 | { |
||
25 | $this->ratepayToProductBridge = $ratepayToProductBridge; |
||
0 ignored issues
–
show
|
|||
26 | } |
||
27 | |||
28 | /** |
||
29 | * @param \Generated\Shared\Transfer\CartChangeTransfer $change |
||
30 | * |
||
31 | * @return \Generated\Shared\Transfer\CartChangeTransfer |
||
32 | */ |
||
33 | public function expandItems(CartChangeTransfer $change) |
||
34 | { |
||
35 | foreach ($change->getItems() as $cartItem) { |
||
36 | $productConcreteTransfer = $this->ratepayToProductBridge->getProductConcrete($cartItem->getSku()); |
||
37 | |||
38 | foreach ($productConcreteTransfer->getLocalizedAttributes() as $localizedAttribute) { |
||
39 | $attr = $localizedAttribute->getAttributes(); |
||
40 | if (isset($attr['short_description'])) { |
||
41 | $cartItem->setDescriptionAddition($attr['short_description']); |
||
42 | } |
||
43 | if (isset($attr['long_description'])) { |
||
44 | $cartItem->setDescription($attr['long_description']); |
||
45 | } |
||
46 | } |
||
47 | } |
||
48 | |||
49 | return $change; |
||
50 | } |
||
51 | } |
||
52 |
Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a given class or a super-class is assigned to a property that is type hinted more strictly.
Either this assignment is in error or an instanceof check should be added for that assignment.