| Conditions | 2 |
| Paths | 2 |
| Total Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 26 | public function getDataCellValue($position, $key, $index): string |
||
| 27 | { |
||
| 28 | $price = $this->cart->formatCurrency($position->cost, $position->currency); |
||
| 29 | if ($relatedPosition = $this->cart->findRelatedFor($position)) { |
||
| 30 | $price .= sprintf( |
||
| 31 | ' + <span class="text-success text-bold">%s</span>', |
||
| 32 | $this->cart->formatCurrency($relatedPosition->getCost(), $relatedPosition->currency) |
||
| 33 | ); |
||
| 34 | } |
||
| 35 | |||
| 36 | return $price; |
||
| 37 | } |
||
| 38 | } |
||
| 39 |
If you access a property on an interface, you most likely code against a concrete implementation of the interface.
Available Fixes
Adding an additional type check:
Changing the type hint: