diff --git a/UPGRADE.md b/UPGRADE.md index 1656378b3..b1136db3b 100644 --- a/UPGRADE.md +++ b/UPGRADE.md @@ -37,7 +37,7 @@ LineItemsConverterInterface $shipmentLineItemsConverter, TaxItemsGeneratorInterface $taxItemsGenerator, CreditMemoFactoryInterface $creditMemoFactory, - + CustomerBillingDataFactoryInterface $customerBillingDataFactory + + CustomerBillingDataFactoryInterface $customerBillingDataFactory, + ShopBillingDataFactoryInterface $shopBillingDataFactory ) { ... diff --git a/phpstan.neon b/phpstan.neon index 0528eca52..5b570ff01 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -19,3 +19,8 @@ parameters: - '/Method Sylius\\RefundPlugin\\Entity\\CustomerBillingData::setId\(\) has parameter \$id with no typehint specified./' - '/Method Sylius\\RefundPlugin\\Entity\\CustomerBillingDataInterface::id\(\) has no return typehint specified./' - '/Method Sylius\\RefundPlugin\\Entity\\CustomerBillingDataInterface::setId\(\) has parameter \$id with no typehint specified./' + - '/Method Sylius\\RefundPlugin\\Entity\\ShopBillingData::id\(\) has no return typehint specified./' + - '/Method Sylius\\RefundPlugin\\Entity\\ShopBillingData::getId\(\) has no return typehint specified./' + - '/Method Sylius\\RefundPlugin\\Entity\\ShopBillingData::setId\(\) has parameter \$id with no typehint specified./' + - '/Method Sylius\\RefundPlugin\\Entity\\ShopBillingData::id\(\) has no return typehint specified./' + - '/Method Sylius\\RefundPlugin\\Entity\\ShopBillingData::setId\(\) has parameter \$id with no typehint specified./' \ No newline at end of file diff --git a/spec/Entity/ShopBillingDataSpec.php b/spec/Entity/ShopBillingDataSpec.php index 337b3d09f..90cad56c0 100644 --- a/spec/Entity/ShopBillingDataSpec.php +++ b/spec/Entity/ShopBillingDataSpec.php @@ -28,37 +28,37 @@ public function it_has_no_id_by_default(): void $this->getId()->shouldReturn(null); } - public function it_has_company(): void + public function it_has_a_company(): void { $this->setCompany('Needful Things'); $this->getCompany()->shouldReturn('Needful Things'); } - public function it_has_tax_id(): void + public function it_has_a_tax_id(): void { $this->setTaxId('000222'); $this->getTaxId()->shouldReturn('000222'); } - public function it_has_country_code(): void + public function it_has_a_country_code(): void { $this->setCountryCode('US'); $this->getCountryCode()->shouldReturn('US'); } - public function it_has_street(): void + public function it_has_a_street(): void { $this->setStreet('Main St. 123'); $this->getStreet()->shouldReturn('Main St. 123'); } - public function it_has_city(): void + public function it_has_a_city(): void { $this->setCity('Los Angeles'); $this->getCity()->shouldReturn('Los Angeles'); } - public function it_has_postcode(): void + public function it_has_a_postcode(): void { $this->setPostcode('90001'); $this->getPostcode()->shouldReturn('90001'); diff --git a/src/Entity/ShopBillingData.php b/src/Entity/ShopBillingData.php index c27522a17..021195056 100644 --- a/src/Entity/ShopBillingData.php +++ b/src/Entity/ShopBillingData.php @@ -16,7 +16,7 @@ /** final */ class ShopBillingData implements ShopBillingDataInterface { - /** @var int|null */ + /** @var mixed */ protected $id; /** @var string|null */ @@ -37,12 +37,12 @@ class ShopBillingData implements ShopBillingDataInterface /** @var string|null */ protected $postcode; - public function getId(): ?int + public function getId() { return $this->id; } - public function setId(?int $id): void + public function setId($id): void { $this->id = $id; } @@ -107,7 +107,7 @@ public function setPostcode(?string $postcode): void $this->postcode = $postcode; } - public function id(): ?int + public function id() { return $this->id; } diff --git a/src/Entity/ShopBillingDataInterface.php b/src/Entity/ShopBillingDataInterface.php index 01a021694..2e0cf433d 100644 --- a/src/Entity/ShopBillingDataInterface.php +++ b/src/Entity/ShopBillingDataInterface.php @@ -17,9 +17,9 @@ interface ShopBillingDataInterface extends ResourceInterface { - public function getId(): ?int; + public function getId(); - public function setId(?int $id): void; + public function setId($id): void; public function getCompany(): ?string; @@ -44,4 +44,25 @@ public function setCity(?string $city): void; public function getPostcode(): ?string; public function setPostcode(?string $postcode): void; + + /** @deprecated this function is deprecated and will be removed in v1.0.0. Use CustomerBillingDataInterface::getId() instead */ + public function id(); + + /** @deprecated this function is deprecated and will be removed in v1.0.0. Use CustomerBillingDataInterface::getCompany() instead */ + public function company(): ?string; + + /** @deprecated this function is deprecated and will be removed in v1.0.0. Use CustomerBillingDataInterface::getTaxId() instead */ + public function taxId(): ?string; + + /** @deprecated this function is deprecated and will be removed in v1.0.0. Use CustomerBillingDataInterface::getCountryCode() instead */ + public function countryCode(): ?string; + + /** @deprecated this function is deprecated and will be removed in v1.0.0. Use CustomerBillingDataInterface::getStreet() instead */ + public function street(): ?string; + + /** @deprecated this function is deprecated and will be removed in v1.0.0. Use CustomerBillingDataInterface::getCity() instead */ + public function city(): ?string; + + /** @deprecated this function is deprecated and will be removed in v1.0.0. Use CustomerBillingDataInterface::getPostcode() instead */ + public function postcode(): ?string; } diff --git a/src/Generator/CreditMemoGenerator.php b/src/Generator/CreditMemoGenerator.php index 1d525f32b..75539eb80 100644 --- a/src/Generator/CreditMemoGenerator.php +++ b/src/Generator/CreditMemoGenerator.php @@ -20,9 +20,9 @@ use Sylius\RefundPlugin\Converter\LineItemsConverterInterface; use Sylius\RefundPlugin\Entity\CreditMemoInterface; use Sylius\RefundPlugin\Entity\CustomerBillingDataInterface; +use Sylius\RefundPlugin\Entity\ShopBillingDataInterface; use Sylius\RefundPlugin\Factory\CreditMemoFactoryInterface; use Sylius\RefundPlugin\Factory\CustomerBillingDataFactoryInterface; -use Sylius\RefundPlugin\Entity\ShopBillingDataInterface; use Sylius\RefundPlugin\Factory\ShopBillingDataFactoryInterface; use Sylius\RefundPlugin\Model\OrderItemUnitRefund; use Sylius\RefundPlugin\Model\ShipmentRefund; diff --git a/src/Resources/config/services/generators.xml b/src/Resources/config/services/generators.xml index 3fe7034b2..4743ea633 100644 --- a/src/Resources/config/services/generators.xml +++ b/src/Resources/config/services/generators.xml @@ -39,10 +39,10 @@