|
23 | 23 |
|
24 | 24 | final class CancelPayPalOrderAction |
25 | 25 | { |
26 | | - private PaymentProviderInterface $paymentProvider; |
27 | | - |
28 | | - private OrderRepositoryInterface $orderRepository; |
29 | | - |
30 | | - private FlashBag|RequestStack $flashBagOrRequestStack; |
31 | | - |
32 | 26 | public function __construct( |
33 | | - PaymentProviderInterface $paymentProvider, |
34 | | - OrderRepositoryInterface $orderRepository, |
35 | | - FlashBag|RequestStack $flashBagOrRequestStack, |
| 27 | + private readonly ?PaymentProviderInterface $paymentProvider, |
| 28 | + private readonly ?OrderRepositoryInterface $orderRepository, |
| 29 | + private readonly FlashBag|RequestStack $flashBagOrRequestStack, |
36 | 30 | ) { |
37 | 31 | if ($flashBagOrRequestStack instanceof FlashBag) { |
38 | 32 | trigger_deprecation('sylius/paypal-plugin', '1.5', sprintf('Passing an instance of %s as constructor argument for %s is deprecated as of PayPalPlugin 1.5 and will be removed in 2.0. Pass an instance of %s instead.', FlashBag::class, self::class, RequestStack::class)); |
39 | 33 | } |
40 | | - |
41 | | - $this->paymentProvider = $paymentProvider; |
42 | | - $this->orderRepository = $orderRepository; |
43 | | - $this->flashBagOrRequestStack = $flashBagOrRequestStack; |
| 34 | + if (null !== $this->paymentProvider) { |
| 35 | + trigger_deprecation('sylius/paypal-plugin', '1.7', sprintf('Passing an instance of %s as the first argument is deprecated and will be prohibited in 3.0', PaymentProviderInterface::class)); |
| 36 | + } |
| 37 | + if (null !== $this->orderRepository) { |
| 38 | + trigger_deprecation('sylius/paypal-plugin', '1.7', sprintf('Passing an instance of %s as the second argument is deprecated and will be prohibited in 3.0', OrderRepositoryInterface::class)); |
| 39 | + } |
44 | 40 | } |
45 | 41 |
|
46 | 42 | public function __invoke(Request $request): Response |
|
0 commit comments