diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index a264503816..abe2390cc8 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -745,36 +745,6 @@ parameters: count: 1 path: src/Sylius/Bundle/ApiBundle/DataPersister/PaymentMethodDataPersister.php - - - message: "#^Method Sylius\\\\Bundle\\\\ApiBundle\\\\DataPersister\\\\ProductAttributeDataPersister\\:\\:persist\\(\\) has parameter \\$context with no value type specified in iterable type array\\.$#" - count: 1 - path: src/Sylius/Bundle/ApiBundle/DataPersister/ProductAttributeDataPersister.php - - - - message: "#^Method Sylius\\\\Bundle\\\\ApiBundle\\\\DataPersister\\\\ProductAttributeDataPersister\\:\\:remove\\(\\) has no return type specified\\.$#" - count: 1 - path: src/Sylius/Bundle/ApiBundle/DataPersister/ProductAttributeDataPersister.php - - - - message: "#^Method Sylius\\\\Bundle\\\\ApiBundle\\\\DataPersister\\\\ProductAttributeDataPersister\\:\\:remove\\(\\) has parameter \\$context with no value type specified in iterable type array\\.$#" - count: 1 - path: src/Sylius/Bundle/ApiBundle/DataPersister/ProductAttributeDataPersister.php - - - - message: "#^Method Sylius\\\\Bundle\\\\ApiBundle\\\\DataPersister\\\\ProductAttributeDataPersister\\:\\:remove\\(\\) has parameter \\$data with no type specified\\.$#" - count: 1 - path: src/Sylius/Bundle/ApiBundle/DataPersister/ProductAttributeDataPersister.php - - - - message: "#^Method Sylius\\\\Bundle\\\\ApiBundle\\\\DataPersister\\\\ProductAttributeDataPersister\\:\\:supports\\(\\) has parameter \\$context with no value type specified in iterable type array\\.$#" - count: 1 - path: src/Sylius/Bundle/ApiBundle/DataPersister/ProductAttributeDataPersister.php - - - - message: "#^Method Sylius\\\\Bundle\\\\ApiBundle\\\\DataPersister\\\\ProductAttributeDataPersister\\:\\:supports\\(\\) has parameter \\$data with no type specified\\.$#" - count: 1 - path: src/Sylius/Bundle/ApiBundle/DataPersister/ProductAttributeDataPersister.php - - message: "#^Method Sylius\\\\Bundle\\\\ApiBundle\\\\DataPersister\\\\ProductDataPersister\\:\\:persist\\(\\) has parameter \\$data with no type specified\\.$#" count: 1 diff --git a/src/Sylius/Bundle/ApiBundle/DataPersister/ProductAttributeDataPersister.php b/src/Sylius/Bundle/ApiBundle/DataPersister/ProductAttributeDataPersister.php deleted file mode 100644 index 8926b115b3..0000000000 --- a/src/Sylius/Bundle/ApiBundle/DataPersister/ProductAttributeDataPersister.php +++ /dev/null @@ -1,47 +0,0 @@ -decoratedDataPersister->persist($data, $context); - } - - public function remove($data, array $context = []) - { - try { - return $this->decoratedDataPersister->remove($data, $context); - } catch (ForeignKeyConstraintViolationException) { - throw new ProductAttributeCannotBeRemoved(); - } - } -} diff --git a/src/Sylius/Bundle/ApiBundle/Resources/config/services/data_persisters.xml b/src/Sylius/Bundle/ApiBundle/Resources/config/services/data_persisters.xml index bd6afb40f2..75d0dddf57 100644 --- a/src/Sylius/Bundle/ApiBundle/Resources/config/services/data_persisters.xml +++ b/src/Sylius/Bundle/ApiBundle/Resources/config/services/data_persisters.xml @@ -39,11 +39,6 @@ - - - - - diff --git a/src/Sylius/Bundle/ApiBundle/disabledSpec/DataPersister/ProductAttributeDataPersisterSpec.php b/src/Sylius/Bundle/ApiBundle/disabledSpec/DataPersister/ProductAttributeDataPersisterSpec.php deleted file mode 100644 index b9761c9362..0000000000 --- a/src/Sylius/Bundle/ApiBundle/disabledSpec/DataPersister/ProductAttributeDataPersisterSpec.php +++ /dev/null @@ -1,72 +0,0 @@ -beConstructedWith($persister); - } - - function it_is_a_context_aware_persister(): void - { - $this->shouldImplement(ContextAwareDataPersisterInterface::class); - } - - function it_supports_only_product_attribute(ProductAttributeInterface $productAttribute): void - { - $this->supports(new \stdClass())->shouldReturn(false); - $this->supports($productAttribute)->shouldReturn(true); - } - - function it_uses_inner_persister_to_persist_product_attribute( - ContextAwareDataPersisterInterface $persister, - ProductAttributeInterface $productAttribute, - ): void { - $persister->persist($productAttribute, [])->shouldBeCalled(); - - $this->persist($productAttribute, []); - } - - function it_throws_cannot_be_removed_exception_if_constraint_fails_on_removal( - ContextAwareDataPersisterInterface $persister, - ProductAttributeInterface $productAttribute, - ): void { - $persister - ->remove($productAttribute, []) - ->willThrow(ForeignKeyConstraintViolationException::class) - ; - - $this - ->shouldThrow(ProductAttributeCannotBeRemoved::class) - ->during('remove', [$productAttribute]) - ; - } - - function it_uses_inner_persister_to_remove_product_attribute( - ContextAwareDataPersisterInterface $persister, - ProductAttributeInterface $productAttribute, - ): void { - $persister->remove($productAttribute, [])->shouldBeCalled(); - - $this->remove($productAttribute, []); - } -}