[Component/Core] Change parameter order in OrderPaymentProcessor class

This commit is contained in:
Grzegorz Sadowski 2023-09-28 07:37:33 +02:00
parent 14194a463c
commit 8ffcacd67a
4 changed files with 18 additions and 5 deletions

View file

@ -73,6 +73,17 @@
* The `\Serializable` interface has been removed from the `Sylius\Component\User\Model\UserInterface`.
* The parameter order of the `Sylius\Component\Core\OrderProcessing\OrderPaymentProcessor::__construct` has been changed:
```php
public function __construct(
private OrderPaymentProviderInterface $orderPaymentProvider,
- private string $targetState = PaymentInterface::STATE_CART,
private OrderPaymentsRemoverInterface $orderPaymentsRemover,
private array $unprocessableOrderStates,
+ private string $targetState = PaymentInterface::STATE_CART,
)
```
## Frontend
* `use_webpack` option was removed from the `sylius_ui` configuration, and the Webpack has become the only module bundler provided by Sylius.

View file

@ -70,16 +70,16 @@
<service id="sylius.order_processing.order_payment_processor.checkout" class="Sylius\Component\Core\OrderProcessing\OrderPaymentProcessor">
<argument type="service" id="sylius.order_payment_provider" />
<argument>cart</argument>
<argument type="service" id="Sylius\Component\Core\Payment\Remover\OrderPaymentsRemoverInterface" />
<argument>%sylius.order_payment_processor.checkout.unsupported_states%</argument>
<argument>cart</argument>
<tag name="sylius.order_processor" priority="0"/>
</service>
<service id="sylius.order_processing.order_payment_processor.after_checkout" class="Sylius\Component\Core\OrderProcessing\OrderPaymentProcessor">
<argument type="service" id="sylius.order_payment_provider" />
<argument>new</argument>
<argument type="service" id="Sylius\Component\Core\Payment\Remover\OrderPaymentsRemoverInterface" />
<argument>%sylius.order_payment_processor.after_checkout.unsupported_states%</argument>
<argument>new</argument>
</service>
</services>
</container>

View file

@ -24,12 +24,14 @@ use Webmozart\Assert\Assert;
final class OrderPaymentProcessor implements OrderProcessorInterface
{
/**
* @param array<string> $unprocessableOrderStates
*/
public function __construct(
private OrderPaymentProviderInterface $orderPaymentProvider,
private string $targetState = PaymentInterface::STATE_CART,
private OrderPaymentsRemoverInterface $orderPaymentsRemover,
/** @var array<string> $unprocessableOrderStates */
private array $unprocessableOrderStates,
private string $targetState = PaymentInterface::STATE_CART,
) {
}

View file

@ -31,11 +31,11 @@ final class OrderPaymentProcessorSpec extends ObjectBehavior
): void {
$this->beConstructedWith(
$orderPaymentProvider,
PaymentInterface::STATE_CART,
$orderPaymentsRemover,
[
OrderInterface::STATE_FULFILLED,
],
PaymentInterface::STATE_CART,
);
}