| Conditions | 2 |
| Paths | 2 |
| Total Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 4 |
| CRAP Score | 2 |
| Changes | 0 | ||
| 1 | <?php |
||
| 26 | 2 | protected function createAdjustment(DiscountContract $discount, $amount) |
|
| 27 | { |
||
| 28 | 2 | $adjustment = app(AdjustmentContract::class); |
|
| 29 | |||
| 30 | 2 | $originType = $discount->isCouponBased() ? 'coupon' : 'discount'; |
|
| 31 | |||
| 32 | 2 | return $adjustment->createNew(AdjustmentContract::ORDER_DISCOUNT_ADJUSTMENT, $discount->label, $amount, $discount->id, $originType); |
|
| 33 | } |
||
| 34 | } |
||
| 35 |
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: