[CoreBundle] Remove deprecated code in the AddressType class

This commit is contained in:
Rafikooo 2023-09-21 17:05:52 +02:00
parent 54240b2ebb
commit db4e53dd55
No known key found for this signature in database
GPG key ID: 4A26D8327BC2442B
3 changed files with 13 additions and 16 deletions

View file

@ -61,6 +61,16 @@
* `Sylius\Bundle\ApiBundle\CommandHandler\Account\VerifyCustomerAccountHandler`
* `Sylius\Component\Taxation\Checker\TaxRateDateEligibilityChecker`
* The parameter order of `Sylius\Bundle\CoreBundle\Form\Type\Checkout\AddressType::__construct` has been changed:
```php
public function __construct(
+ private readonly AddressComparatorInterface $addressComparator,
string $dataClass,
array $validationGroups = []
- private readonly AddressComparatorInterface $addressComparator = null,
)
```
## 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

@ -33,22 +33,9 @@ use Webmozart\Assert\Assert;
final class AddressType extends AbstractResourceType
{
private ?AddressComparatorInterface $addressComparator;
public function __construct(string $dataClass, array $validationGroups = [], ?AddressComparatorInterface $addressComparator = null)
public function __construct(private readonly AddressComparatorInterface $addressComparator, string $dataClass, array $validationGroups = [])
{
parent::__construct($dataClass, $validationGroups);
if (null === $addressComparator) {
trigger_deprecation(
'sylius/core-bundle',
'1.8',
'Not passing an $addressComparator to "%s" constructor is deprecated and will be prohibited in Sylius 2.0.',
self::class,
);
}
$this->addressComparator = $addressComparator;
}
/**
@ -164,7 +151,7 @@ final class AddressType extends AbstractResourceType
private function areAddressesDifferent(?AddressInterface $firstAddress, ?AddressInterface $secondAddress): bool
{
if (null === $this->addressComparator || null === $firstAddress || null === $secondAddress) {
if (null === $firstAddress || null === $secondAddress) {
return false;
}

View file

@ -37,9 +37,9 @@
<defaults public="true" />
<service id="sylius.form.type.checkout_address" class="Sylius\Bundle\CoreBundle\Form\Type\Checkout\AddressType">
<argument type="service" id="sylius.address_comparator" />
<argument>%sylius.model.order.class%</argument>
<argument>%sylius.form.type.checkout_address.validation_groups%</argument>
<argument type="service" id="sylius.address_comparator" />
<tag name="form.type" />
</service>
<service id="sylius.form.type.checkout_select_shipping" class="Sylius\Bundle\CoreBundle\Form\Type\Checkout\SelectShippingType">