diff --git a/spec/Assigner/ChannelsAssignerSpec.php b/spec/Assigner/ChannelsAssignerSpec.php
index 3bcb6e409..f1bf42b79 100644
--- a/spec/Assigner/ChannelsAssignerSpec.php
+++ b/spec/Assigner/ChannelsAssignerSpec.php
@@ -32,7 +32,7 @@ public function it_assigns_channels(
ChannelRepositoryInterface $channelRepository,
ChannelInterface $webChannel,
ChannelInterface $posChannel,
- ChannelsAwareInterface $channelsAware
+ ChannelsAwareInterface $channelsAware,
): void {
$channelRepository->findOneBy(['code' => 'web'])->willReturn($webChannel);
$channelRepository->findOneBy(['code' => 'pos'])->willReturn($posChannel);
diff --git a/spec/Assigner/CollectionsAssignerSpec.php b/spec/Assigner/CollectionsAssignerSpec.php
index 898ad2de7..90e74df3c 100644
--- a/spec/Assigner/CollectionsAssignerSpec.php
+++ b/spec/Assigner/CollectionsAssignerSpec.php
@@ -38,9 +38,8 @@ public function it_assigns_collections(
CollectionRepositoryInterface $collectionRepository,
CollectionInterface $aboutCollection,
CollectionInterface $blogCollection,
- CollectibleInterface $collectionsAware
- ): void
- {
+ CollectibleInterface $collectionsAware,
+ ): void {
$collectionRepository->findOneBy(['code' => 'about'])->willReturn($aboutCollection);
$collectionRepository->findOneBy(['code' => 'blog'])->willReturn($blogCollection);
diff --git a/spec/Assigner/LocalesAssignerSpec.php b/spec/Assigner/LocalesAssignerSpec.php
index e757ff87b..db38072b3 100644
--- a/spec/Assigner/LocalesAssignerSpec.php
+++ b/spec/Assigner/LocalesAssignerSpec.php
@@ -38,7 +38,7 @@ public function it_assigns_locales_to_locale_aware_entity(
RepositoryInterface $localeRepository,
LocaleAwareInterface $localesAware,
LocaleInterface $locale1,
- LocaleInterface $locale2
+ LocaleInterface $locale2,
) {
$locale1->getCode()->willReturn('en_US');
$locale2->getCode()->willReturn('fr_FR');
diff --git a/spec/Assigner/ProductsAssignerSpec.php b/spec/Assigner/ProductsAssignerSpec.php
index e1b999612..0e50991ef 100644
--- a/spec/Assigner/ProductsAssignerSpec.php
+++ b/spec/Assigner/ProductsAssignerSpec.php
@@ -32,7 +32,7 @@ public function it_assigns_products(
ProductRepositoryInterface $productRepository,
ProductInterface $mugProduct,
ProductInterface $tshirtProduct,
- ProductsAwareInterface $productsAware
+ ProductsAwareInterface $productsAware,
): void {
$productRepository->findOneBy(['code' => 'mug'])->willReturn($mugProduct);
$productRepository->findOneBy(['code' => 't-shirt'])->willReturn($tshirtProduct);
diff --git a/spec/Assigner/ProductsInTaxonsAssignerSpec.php b/spec/Assigner/ProductsInTaxonsAssignerSpec.php
index 6d5454f95..6b59106d6 100644
--- a/spec/Assigner/ProductsInTaxonsAssignerSpec.php
+++ b/spec/Assigner/ProductsInTaxonsAssignerSpec.php
@@ -38,7 +38,7 @@ public function it_assigns_taxons_to_products_in_taxons_aware_entity(
TaxonRepositoryInterface $taxonRepository,
ProductsInTaxonsAwareInterface $productsInTaxonsAware,
TaxonInterface $taxon1,
- TaxonInterface $taxon2
+ TaxonInterface $taxon2,
) {
$taxon1->getCode()->willReturn('taxon_code_1');
$taxon2->getCode()->willReturn('taxon_code_2');
diff --git a/spec/Assigner/TaxonsAssignerSpec.php b/spec/Assigner/TaxonsAssignerSpec.php
index 7eade976e..092ab8818 100644
--- a/spec/Assigner/TaxonsAssignerSpec.php
+++ b/spec/Assigner/TaxonsAssignerSpec.php
@@ -32,7 +32,7 @@ public function it_assigns_taxons(
TaxonRepositoryInterface $taxonRepository,
TaxonInterface $mugsTaxon,
TaxonInterface $stickersTaxon,
- TaxonAwareInterface $taxonsAware
+ TaxonAwareInterface $taxonsAware,
): void {
$taxonRepository->findOneBy(['code' => 'mugs'])->willReturn($mugsTaxon);
$taxonRepository->findOneBy(['code' => 'stickers'])->willReturn($stickersTaxon);
diff --git a/spec/Controller/Action/Admin/UploadEditorImageActionSpec.php b/spec/Controller/Action/Admin/UploadEditorImageActionSpec.php
index 380016d16..8eb4b8088 100644
--- a/spec/Controller/Action/Admin/UploadEditorImageActionSpec.php
+++ b/spec/Controller/Action/Admin/UploadEditorImageActionSpec.php
@@ -26,7 +26,7 @@ final class UploadEditorImageActionSpec extends ObjectBehavior
public function let(
MediaProviderResolverInterface $mediaProviderResolver,
MediaRepositoryInterface $mediaRepository,
- FactoryInterface $mediaFactory
+ FactoryInterface $mediaFactory,
) {
$this->beConstructedWith($mediaProviderResolver, $mediaRepository, $mediaFactory);
}
@@ -43,7 +43,7 @@ public function it_uploads_media(
FileBag $fileBag,
MediaProviderResolverInterface $mediaProviderResolver,
ProviderInterface $provider,
- MediaRepositoryInterface $mediaRepository
+ MediaRepositoryInterface $mediaRepository,
): void {
$uploadedFile = new UploadedFile(__DIR__ . '/../../../../tests/Behat/Resources/images/aston_martin_db_11.jpg', 'aston_martin_db_11.jpg');
diff --git a/spec/Entity/BlockSpec.php b/spec/Entity/BlockSpec.php
index 190db4c18..2a9085ead 100755
--- a/spec/Entity/BlockSpec.php
+++ b/spec/Entity/BlockSpec.php
@@ -15,8 +15,6 @@
use BitBag\SyliusCmsPlugin\Entity\CollectionInterface;
use PhpSpec\ObjectBehavior;
use Sylius\Component\Core\Model\ChannelInterface;
-use Sylius\Component\Core\Model\ProductInterface;
-use Sylius\Component\Core\Model\TaxonInterface;
use Sylius\Component\Resource\Model\ResourceInterface;
final class BlockSpec extends ObjectBehavior
diff --git a/spec/Entity/MediaSpec.php b/spec/Entity/MediaSpec.php
index 8d201f07c..354e84e12 100755
--- a/spec/Entity/MediaSpec.php
+++ b/spec/Entity/MediaSpec.php
@@ -10,12 +10,11 @@
namespace spec\BitBag\SyliusCmsPlugin\Entity;
+use BitBag\SyliusCmsPlugin\Entity\CollectionInterface;
use BitBag\SyliusCmsPlugin\Entity\Media;
use BitBag\SyliusCmsPlugin\Entity\MediaInterface;
-use BitBag\SyliusCmsPlugin\Entity\CollectionInterface;
use PhpSpec\ObjectBehavior;
use Sylius\Component\Core\Model\ChannelInterface;
-use Sylius\Component\Core\Model\ProductInterface;
use Sylius\Component\Resource\Model\ResourceInterface;
use Symfony\Component\HttpFoundation\File\UploadedFile;
diff --git a/spec/Entity/PageSpec.php b/spec/Entity/PageSpec.php
index 9c99677ba..bbc21792b 100755
--- a/spec/Entity/PageSpec.php
+++ b/spec/Entity/PageSpec.php
@@ -10,12 +10,11 @@
namespace spec\BitBag\SyliusCmsPlugin\Entity;
+use BitBag\SyliusCmsPlugin\Entity\CollectionInterface;
use BitBag\SyliusCmsPlugin\Entity\Page;
use BitBag\SyliusCmsPlugin\Entity\PageInterface;
-use BitBag\SyliusCmsPlugin\Entity\CollectionInterface;
use PhpSpec\ObjectBehavior;
use Sylius\Component\Core\Model\ChannelInterface;
-use Sylius\Component\Core\Model\ProductInterface;
use Sylius\Component\Resource\Model\ResourceInterface;
final class PageSpec extends ObjectBehavior
diff --git a/spec/EventListener/MediaUploadListenerSpec.php b/spec/EventListener/MediaUploadListenerSpec.php
index c2017ce8e..1b0a33ae2 100755
--- a/spec/EventListener/MediaUploadListenerSpec.php
+++ b/spec/EventListener/MediaUploadListenerSpec.php
@@ -33,7 +33,7 @@ public function it_is_initializable(): void
public function it_does_not_upload_if_not_media_instance(
ResourceControllerEvent $event,
MediaInterface $media,
- MediaProviderResolverInterface $mediaProviderResolver
+ MediaProviderResolverInterface $mediaProviderResolver,
): void {
$event->getSubject()->willReturn(Argument::any());
@@ -44,7 +44,7 @@ public function it_uploads_media(
ResourceControllerEvent $event,
MediaInterface $media,
MediaProviderResolverInterface $mediaProviderResolver,
- ProviderInterface $provider
+ ProviderInterface $provider,
): void {
$event->getSubject()->willReturn($media);
$mediaProviderResolver->resolveProvider($media)->willReturn($provider);
diff --git a/spec/Form/DataTransformer/MultipleMediaToCodesTransformerSpec.php b/spec/Form/DataTransformer/MultipleMediaToCodesTransformerSpec.php
index 78641d2bf..0d21b0e8a 100644
--- a/spec/Form/DataTransformer/MultipleMediaToCodesTransformerSpec.php
+++ b/spec/Form/DataTransformer/MultipleMediaToCodesTransformerSpec.php
@@ -43,9 +43,8 @@ public function it_transforms_empty_array_to_empty_collection(): void
public function it_transforms_non_empty_array_to_collection(
MediaRepositoryInterface $mediaRepository,
MediaInterface $media1,
- MediaInterface $media2
- ): void
- {
+ MediaInterface $media2,
+ ): void {
$mediaCodes = ['code1', 'code2'];
$mediaRepository->findBy(['code' => $mediaCodes])->willReturn([$media1, $media2]);
@@ -63,9 +62,8 @@ public function it_reverse_transforms_empty_collection_to_empty_array(): void
public function it_reverse_transforms_collection_to_array_of_media_codes(
MediaInterface $media1,
- MediaInterface $media2
- ): void
- {
+ MediaInterface $media2,
+ ): void {
$media1->getCode()->willReturn('code1');
$media2->getCode()->willReturn('code2');
diff --git a/spec/Importer/BlockImporterSpec.php b/spec/Importer/BlockImporterSpec.php
index 49a754908..098ac6bc3 100644
--- a/spec/Importer/BlockImporterSpec.php
+++ b/spec/Importer/BlockImporterSpec.php
@@ -14,12 +14,12 @@
use BitBag\SyliusCmsPlugin\Importer\BlockImporter;
use BitBag\SyliusCmsPlugin\Importer\BlockImporterInterface;
use BitBag\SyliusCmsPlugin\Repository\BlockRepositoryInterface;
-use BitBag\SyliusCmsPlugin\Resolver\ImporterChannelsResolverInterface;
-use BitBag\SyliusCmsPlugin\Resolver\ImporterLocalesResolverInterface;
-use BitBag\SyliusCmsPlugin\Resolver\ImporterProductsInTaxonsResolverInterface;
-use BitBag\SyliusCmsPlugin\Resolver\ImporterProductsResolverInterface;
-use BitBag\SyliusCmsPlugin\Resolver\ImporterCollectionsResolverInterface;
-use BitBag\SyliusCmsPlugin\Resolver\ImporterTaxonsResolverInterface;
+use BitBag\SyliusCmsPlugin\Resolver\Importer\ImporterChannelsResolverInterface;
+use BitBag\SyliusCmsPlugin\Resolver\Importer\ImporterCollectionsResolverInterface;
+use BitBag\SyliusCmsPlugin\Resolver\Importer\ImporterLocalesResolverInterface;
+use BitBag\SyliusCmsPlugin\Resolver\Importer\ImporterProductsInTaxonsResolverInterface;
+use BitBag\SyliusCmsPlugin\Resolver\Importer\ImporterProductsResolverInterface;
+use BitBag\SyliusCmsPlugin\Resolver\Importer\ImporterTaxonsResolverInterface;
use BitBag\SyliusCmsPlugin\Resolver\ResourceResolverInterface;
use PhpSpec\ObjectBehavior;
use Symfony\Component\Validator\ConstraintViolationList;
@@ -36,9 +36,8 @@ public function let(
ImporterTaxonsResolverInterface $importerTaxonsResolver,
ImporterProductsInTaxonsResolverInterface $importerProductsInTaxonsResolver,
ValidatorInterface $validator,
- BlockRepositoryInterface $blockRepository
- )
- {
+ BlockRepositoryInterface $blockRepository,
+ ) {
$this->beConstructedWith(
$blockResourceResolver,
$importerCollectionsResolver,
@@ -48,7 +47,7 @@ public function let(
$importerTaxonsResolver,
$importerProductsInTaxonsResolver,
$validator,
- $blockRepository
+ $blockRepository,
);
}
@@ -68,9 +67,8 @@ public function it_imports_block(
ImporterProductsInTaxonsResolverInterface $importerProductsInTaxonsResolver,
ValidatorInterface $validator,
BlockRepositoryInterface $blockRepository,
- BlockInterface $block
- )
- {
+ BlockInterface $block,
+ ) {
$row = ['name' => 'block_name', 'code' => 'block_code', 'enabled' => '1'];
$blockResourceResolver->getResource('block_code')->willReturn($block);
diff --git a/spec/Importer/MediaImporterSpec.php b/spec/Importer/MediaImporterSpec.php
index c97844c30..cb47011dd 100644
--- a/spec/Importer/MediaImporterSpec.php
+++ b/spec/Importer/MediaImporterSpec.php
@@ -12,8 +12,7 @@
use BitBag\SyliusCmsPlugin\Entity\MediaInterface;
use BitBag\SyliusCmsPlugin\Repository\MediaRepositoryInterface;
-use BitBag\SyliusCmsPlugin\Resolver\ImporterProductsResolverInterface;
-use BitBag\SyliusCmsPlugin\Resolver\ImporterCollectionsResolverInterface;
+use BitBag\SyliusCmsPlugin\Resolver\Importer\ImporterCollectionsResolverInterface;
use BitBag\SyliusCmsPlugin\Resolver\ResourceResolverInterface;
use PhpSpec\ObjectBehavior;
use Sylius\Component\Locale\Context\LocaleContextInterface;
@@ -27,7 +26,7 @@ public function let(
LocaleContextInterface $localeContext,
ImporterCollectionsResolverInterface $importerCollectionsResolver,
ValidatorInterface $validator,
- MediaRepositoryInterface $mediaRepository
+ MediaRepositoryInterface $mediaRepository,
) {
$this->beConstructedWith(
$mediaResourceResolver,
@@ -50,9 +49,8 @@ public function it_imports_media(
ImporterCollectionsResolverInterface $importerCollectionsResolver,
ValidatorInterface $validator,
MediaRepositoryInterface $mediaRepository,
- MediaInterface $media
- )
- {
+ MediaInterface $media,
+ ) {
$row = ['name_pl' => 'name', 'content_pl' => 'content', 'alt_pl' => 'alt', 'code' => 'media_code'];
$mediaResourceResolver->getResource('media_code')->willReturn($media);
diff --git a/spec/Importer/PageImporterSpec.php b/spec/Importer/PageImporterSpec.php
index 86f500c62..f7a583d8a 100644
--- a/spec/Importer/PageImporterSpec.php
+++ b/spec/Importer/PageImporterSpec.php
@@ -10,17 +10,13 @@
namespace spec\BitBag\SyliusCmsPlugin\Importer;
-use BitBag\SyliusCmsPlugin\Downloader\ImageDownloaderInterface;
use BitBag\SyliusCmsPlugin\Entity\PageInterface;
-use BitBag\SyliusCmsPlugin\Resolver\ImporterChannelsResolverInterface;
-use BitBag\SyliusCmsPlugin\Resolver\ImporterProductsResolverInterface;
-use BitBag\SyliusCmsPlugin\Resolver\ImporterCollectionsResolverInterface;
-use BitBag\SyliusCmsPlugin\Resolver\MediaProviderResolverInterface;
+use BitBag\SyliusCmsPlugin\Resolver\Importer\ImporterChannelsResolverInterface;
+use BitBag\SyliusCmsPlugin\Resolver\Importer\ImporterCollectionsResolverInterface;
use BitBag\SyliusCmsPlugin\Resolver\ResourceResolverInterface;
use Doctrine\ORM\EntityManagerInterface;
use PhpSpec\ObjectBehavior;
use Sylius\Component\Locale\Context\LocaleContextInterface;
-use Sylius\Component\Resource\Factory\FactoryInterface;
use Symfony\Component\Validator\ConstraintViolationList;
use Symfony\Component\Validator\Validator\ValidatorInterface;
@@ -32,7 +28,7 @@ public function let(
ImporterCollectionsResolverInterface $importerCollectionsResolver,
ImporterChannelsResolverInterface $importerChannelsResolver,
ValidatorInterface $validator,
- EntityManagerInterface $entityManager
+ EntityManagerInterface $entityManager,
) {
$this->beConstructedWith(
$pageResourceResolver,
@@ -58,8 +54,7 @@ public function it_imports_page_no_url(
ValidatorInterface $validator,
EntityManagerInterface $entityManager,
PageInterface $page,
- )
- {
+ ) {
$row = [
'code' => 'page_code',
'name' => 'page_name',
diff --git a/spec/MediaProvider/GenericProviderSpec.php b/spec/MediaProvider/GenericProviderSpec.php
index 098d51d65..987c61b03 100644
--- a/spec/MediaProvider/GenericProviderSpec.php
+++ b/spec/MediaProvider/GenericProviderSpec.php
@@ -21,7 +21,7 @@ final class GenericProviderSpec extends ObjectBehavior
{
public function let(
MediaUploaderInterface $uploader,
- Environment $twigEngine
+ Environment $twigEngine,
) {
$this->beConstructedWith($uploader, $twigEngine, '@Template', '/media/');
}
diff --git a/spec/Menu/ContentManagementMenuBuilderSpec.php b/spec/Menu/ContentManagementMenuBuilderSpec.php
index ba7b71882..51ca834c8 100755
--- a/spec/Menu/ContentManagementMenuBuilderSpec.php
+++ b/spec/Menu/ContentManagementMenuBuilderSpec.php
@@ -31,7 +31,7 @@ public function it_is_initializable(): void
public function it_build_menu(
MenuBuilderEvent $menuBuilderEvent,
ItemInterface $menu,
- ItemInterface $cmsRootMenuItem
+ ItemInterface $cmsRootMenuItem,
): void {
$menuBuilderEvent->getMenu()->willReturn($menu);
$menu->addChild('bitbag_cms')->willReturn($cmsRootMenuItem);
diff --git a/spec/Menu/MenuReorderSpec.php b/spec/Menu/MenuReorderSpec.php
index 3eaa8c8cd..6dc38e50b 100644
--- a/spec/Menu/MenuReorderSpec.php
+++ b/spec/Menu/MenuReorderSpec.php
@@ -32,13 +32,12 @@ public function it_reorders_menu_items(
ItemInterface $menu,
ItemInterface $item1,
ItemInterface $item2,
- ItemInterface $item3
- ): void
- {
+ ItemInterface $item3,
+ ): void {
$menu->getChildren()->willReturn([
'item1' => $item1,
'item2' => $item2,
- 'item3' => $item3
+ 'item3' => $item3,
]);
$menu->getChild('item2')->willReturn($item2);
@@ -46,7 +45,7 @@ public function it_reorders_menu_items(
$menu->setChildren([
'item1' => $item1,
'item3' => $item3,
- 'item2' => $item2
+ 'item2' => $item2,
])->shouldBeCalled();
$this->reorder($menu, 'item2', 'item3');
@@ -55,12 +54,11 @@ public function it_reorders_menu_items(
public function it_does_not_reorder_if_new_item_is_not_found(
ItemInterface $menu,
ItemInterface $item1,
- ItemInterface $item3
- ): void
- {
+ ItemInterface $item3,
+ ): void {
$menu->getChildren()->willReturn([
'item1' => $item1,
- 'item3' => $item3
+ 'item3' => $item3,
]);
$menu->getChild('item2')->willReturn(null);
@@ -72,12 +70,11 @@ public function it_does_not_reorder_if_new_item_is_not_found(
public function it_does_not_reorder_if_target_item_is_not_found(
ItemInterface $menu,
ItemInterface $item1,
- ItemInterface $item2
- ): void
- {
+ ItemInterface $item2,
+ ): void {
$menu->getChildren()->willReturn([
'item1' => $item1,
- 'item2' => $item2
+ 'item2' => $item2,
]);
$menu->getChild('item1')->willReturn($item1);
@@ -89,12 +86,11 @@ public function it_does_not_reorder_if_target_item_is_not_found(
public function it_does_not_modify_menu_when_no_reorder_is_needed(
ItemInterface $menu,
ItemInterface $item1,
- ItemInterface $item2
- ): void
- {
+ ItemInterface $item2,
+ ): void {
$menu->getChildren()->willReturn([
'item1' => $item1,
- 'item2' => $item2
+ 'item2' => $item2,
]);
$menu->getChild('item1')->willReturn($item1);
diff --git a/spec/Processor/ImportProcessorSpec.php b/spec/Processor/ImportProcessorSpec.php
index b1129d087..69bb443b8 100644
--- a/spec/Processor/ImportProcessorSpec.php
+++ b/spec/Processor/ImportProcessorSpec.php
@@ -24,7 +24,7 @@ class ImportProcessorSpec extends ObjectBehavior
public function let(
ImporterChainInterface $importerChain,
ReaderInterface $reader,
- EntityManagerInterface $entityManager
+ EntityManagerInterface $entityManager,
) {
$this->beConstructedWith($importerChain, $reader, $entityManager);
}
@@ -38,7 +38,7 @@ public function it_processes_import_data(
ImporterChainInterface $importerChain,
ReaderInterface $reader,
EntityManagerInterface $entityManager,
- ImporterInterface $importer
+ ImporterInterface $importer,
) {
$resourceCode = 'some_resource';
$filePath = 'path/to/file.csv';
@@ -65,7 +65,7 @@ public function it_throws_exception_when_import_fails(
ImporterChainInterface $importerChain,
ReaderInterface $reader,
EntityManagerInterface $entityManager,
- ImporterInterface $importer
+ ImporterInterface $importer,
) {
$resourceCode = 'some_resource';
$filePath = 'path/to/file.csv';
diff --git a/spec/Renderer/Collection/CollectionBlocksRendererSpec.php b/spec/Renderer/Collection/CollectionBlocksRendererSpec.php
index d131e1cbf..3ed27a690 100644
--- a/spec/Renderer/Collection/CollectionBlocksRendererSpec.php
+++ b/spec/Renderer/Collection/CollectionBlocksRendererSpec.php
@@ -39,9 +39,8 @@ public function it_renders_blocks_from_collection(
ContentElementRendererStrategyInterface $contentElementRendererStrategy,
CollectionInterface $collection,
BlockInterface $block1,
- BlockInterface $block2
- ): void
- {
+ BlockInterface $block2,
+ ): void {
$blocks = new ArrayCollection([$block1->getWrappedObject(), $block2->getWrappedObject()]);
$collection->getBlocks()->willReturn($blocks);
@@ -55,9 +54,8 @@ public function it_limits_number_of_rendered_blocks(
ContentElementRendererStrategyInterface $contentElementRendererStrategy,
CollectionInterface $collection,
BlockInterface $block1,
- BlockInterface $block2
- ): void
- {
+ BlockInterface $block2,
+ ): void {
$blocks = new ArrayCollection([$block1->getWrappedObject(), $block2->getWrappedObject()]);
$collection->getBlocks()->willReturn($blocks);
@@ -69,9 +67,8 @@ public function it_limits_number_of_rendered_blocks(
public function it_supports_collections_with_blocks(
CollectionInterface $collection,
- BlockInterface $block
- ): void
- {
+ BlockInterface $block,
+ ): void {
$blocks = new ArrayCollection([$block]);
$collection->getBlocks()->willReturn($blocks);
@@ -79,9 +76,8 @@ public function it_supports_collections_with_blocks(
}
public function it_does_not_support_empty_collections(
- CollectionInterface $collection
- ): void
- {
+ CollectionInterface $collection,
+ ): void {
$collection->getBlocks()->willReturn(new ArrayCollection());
$this->supports($collection)->shouldReturn(false);
@@ -89,9 +85,8 @@ public function it_does_not_support_empty_collections(
public function it_throws_exception_when_blocks_are_null(
ContentElementRendererStrategyInterface $contentElementRendererStrategy,
- CollectionInterface $collection
- ): void
- {
+ CollectionInterface $collection,
+ ): void {
$collection->getBlocks()->willReturn(null);
$this->shouldThrow(\InvalidArgumentException::class)
diff --git a/spec/Renderer/Collection/CollectionPagesRendererSpec.php b/spec/Renderer/Collection/CollectionPagesRendererSpec.php
index e5421f555..a62da0651 100644
--- a/spec/Renderer/Collection/CollectionPagesRendererSpec.php
+++ b/spec/Renderer/Collection/CollectionPagesRendererSpec.php
@@ -39,9 +39,8 @@ public function it_renders_pages_from_collection(
PageLinkRendererInterface $pageLinkRenderer,
CollectionInterface $collection,
PageInterface $page1,
- PageInterface $page2
- ): void
- {
+ PageInterface $page2,
+ ): void {
$page1->getId()->willReturn(2);
$page2->getId()->willReturn(1);
@@ -57,9 +56,8 @@ public function it_limits_number_of_rendered_pages(
PageLinkRendererInterface $pageLinkRenderer,
CollectionInterface $collection,
PageInterface $page1,
- PageInterface $page2
- ): void
- {
+ PageInterface $page2,
+ ): void {
$page1->getId()->willReturn(2);
$page2->getId()->willReturn(1);
@@ -73,18 +71,16 @@ public function it_limits_number_of_rendered_pages(
public function it_supports_collections_with_pages(
CollectionInterface $collection,
- PageInterface $page
- ): void
- {
+ PageInterface $page,
+ ): void {
$collection->getPages()->willReturn(new ArrayCollection([$page]));
$this->supports($collection)->shouldReturn(true);
}
public function it_does_not_support_empty_collections(
- CollectionInterface $collection
- ): void
- {
+ CollectionInterface $collection,
+ ): void {
$collection->getPages()->willReturn(new ArrayCollection());
$this->supports($collection)->shouldReturn(false);
diff --git a/spec/Renderer/CollectionRendererStrategySpec.php b/spec/Renderer/CollectionRendererStrategySpec.php
index 67aebde51..c36b781a9 100644
--- a/spec/Renderer/CollectionRendererStrategySpec.php
+++ b/spec/Renderer/CollectionRendererStrategySpec.php
@@ -36,9 +36,8 @@ public function it_implements_collection_renderer_strategy_interface(): void
public function it_renders_collection_using_supported_renderer(
CollectionRendererInterface $renderer1,
CollectionRendererInterface $renderer2,
- CollectionInterface $collection
- ): void
- {
+ CollectionInterface $collection,
+ ): void {
$renderer1->supports($collection)->willReturn(false);
$renderer2->supports($collection)->willReturn(true);
$renderer2->render($collection, null)->willReturn('rendered content');
@@ -49,9 +48,8 @@ public function it_renders_collection_using_supported_renderer(
public function it_renders_collection_with_count_to_render(
CollectionRendererInterface $renderer1,
CollectionRendererInterface $renderer2,
- CollectionInterface $collection
- ): void
- {
+ CollectionInterface $collection,
+ ): void {
$renderer1->supports($collection)->willReturn(false);
$renderer2->supports($collection)->willReturn(true);
$renderer2->render($collection, 5)->willReturn('rendered content with count');
@@ -62,9 +60,8 @@ public function it_renders_collection_with_count_to_render(
public function it_returns_empty_string_when_no_renderer_supports_collection(
CollectionRendererInterface $renderer1,
CollectionRendererInterface $renderer2,
- CollectionInterface $collection
- ): void
- {
+ CollectionInterface $collection,
+ ): void {
$renderer1->supports($collection)->willReturn(false);
$renderer2->supports($collection)->willReturn(false);
diff --git a/spec/Renderer/ContentElement/HeadingContentElementRendererSpec.php b/spec/Renderer/ContentElement/HeadingContentElementRendererSpec.php
index 33b4ecfd5..d312f8cba 100644
--- a/spec/Renderer/ContentElement/HeadingContentElementRendererSpec.php
+++ b/spec/Renderer/ContentElement/HeadingContentElementRendererSpec.php
@@ -50,7 +50,7 @@ public function it_renders_heading_content_element(Environment $twig, ContentCon
{
$contentConfiguration->getConfiguration()->willReturn([
'heading_type' => 'h1',
- 'heading' => 'Sample Heading'
+ 'heading' => 'Sample Heading',
]);
$twig->render('@BitBagSyliusCmsPlugin/Shop/ContentElement/index.html.twig', [
diff --git a/spec/Renderer/ContentElement/MultipleMediaContentElementRendererSpec.php b/spec/Renderer/ContentElement/MultipleMediaContentElementRendererSpec.php
index 2f53625d7..eb5950d34 100644
--- a/spec/Renderer/ContentElement/MultipleMediaContentElementRendererSpec.php
+++ b/spec/Renderer/ContentElement/MultipleMediaContentElementRendererSpec.php
@@ -25,9 +25,8 @@ final class MultipleMediaContentElementRendererSpec extends ObjectBehavior
public function let(
Environment $twig,
RenderMediaRuntimeInterface $renderMediaRuntime,
- MediaRepositoryInterface $mediaRepository
- ): void
- {
+ MediaRepositoryInterface $mediaRepository,
+ ): void {
$this->beConstructedWith($twig, $renderMediaRuntime, $mediaRepository);
}
@@ -59,11 +58,10 @@ public function it_renders_multiple_media_content_element(
MediaRepositoryInterface $mediaRepository,
ContentConfigurationInterface $contentConfiguration,
MediaInterface $media1,
- MediaInterface $media2
- ): void
- {
+ MediaInterface $media2,
+ ): void {
$contentConfiguration->getConfiguration()->willReturn([
- 'multiple_media' => ['code1', 'code2']
+ 'multiple_media' => ['code1', 'code2'],
]);
$mediaRepository->findBy(['code' => ['code1', 'code2']])->willReturn([$media1, $media2]);
diff --git a/spec/Renderer/ContentElement/PagesCollectionContentElementRendererSpec.php b/spec/Renderer/ContentElement/PagesCollectionContentElementRendererSpec.php
index 9810bd310..96bca9fea 100644
--- a/spec/Renderer/ContentElement/PagesCollectionContentElementRendererSpec.php
+++ b/spec/Renderer/ContentElement/PagesCollectionContentElementRendererSpec.php
@@ -12,7 +12,6 @@
use BitBag\SyliusCmsPlugin\Entity\CollectionInterface;
use BitBag\SyliusCmsPlugin\Entity\ContentConfigurationInterface;
-use BitBag\SyliusCmsPlugin\Entity\PageInterface;
use BitBag\SyliusCmsPlugin\Form\Type\ContentElements\PagesCollectionContentElementType;
use BitBag\SyliusCmsPlugin\Renderer\ContentElement\ContentElementRendererInterface;
use BitBag\SyliusCmsPlugin\Renderer\ContentElement\PagesCollectionContentElementRenderer;
@@ -55,10 +54,9 @@ public function it_renders_pages_collection_content_element(
CollectionRepositoryInterface $collectionRepository,
ContentConfigurationInterface $contentConfiguration,
CollectionInterface $collection,
- ): void
- {
+ ): void {
$contentConfiguration->getConfiguration()->willReturn([
- 'pages_collection' => 'collection_code'
+ 'pages_collection' => 'collection_code',
]);
$collectionRepository->findOneBy(['code' => 'collection_code'])->willReturn($collection);
@@ -68,7 +66,7 @@ public function it_renders_pages_collection_content_element(
$twig->render('@BitBagSyliusCmsPlugin/Shop/ContentElement/index.html.twig', [
'content_element' => '@BitBagSyliusCmsPlugin/Shop/ContentElement/_pages_collection.html.twig',
- 'collection' => $pagesCollection
+ 'collection' => $pagesCollection,
])->willReturn('rendered_output');
$this->render($contentConfiguration)->shouldReturn('rendered_output');
diff --git a/spec/Renderer/ContentElement/ProductsCarouselByTaxonContentElementRendererSpec.php b/spec/Renderer/ContentElement/ProductsCarouselByTaxonContentElementRendererSpec.php
index 0d453fcd0..04f5e98ba 100644
--- a/spec/Renderer/ContentElement/ProductsCarouselByTaxonContentElementRendererSpec.php
+++ b/spec/Renderer/ContentElement/ProductsCarouselByTaxonContentElementRendererSpec.php
@@ -57,11 +57,10 @@ public function it_renders_products_carousel_by_taxon_content_element(
ContentConfigurationInterface $contentConfiguration,
TaxonInterface $taxon,
Product $product1,
- Product $product2
- ): void
- {
+ Product $product2,
+ ): void {
$contentConfiguration->getConfiguration()->willReturn([
- 'products_carousel_by_taxon' => 'taxon_code'
+ 'products_carousel_by_taxon' => 'taxon_code',
]);
$taxonRepository->findOneBy(['code' => 'taxon_code'])->willReturn($taxon);
diff --git a/spec/Renderer/ContentElement/ProductsCarouselContentElementRendererSpec.php b/spec/Renderer/ContentElement/ProductsCarouselContentElementRendererSpec.php
index 38a67b1f5..b9081653d 100644
--- a/spec/Renderer/ContentElement/ProductsCarouselContentElementRendererSpec.php
+++ b/spec/Renderer/ContentElement/ProductsCarouselContentElementRendererSpec.php
@@ -53,11 +53,10 @@ public function it_renders_products_carousel_content_element(
ProductRepositoryInterface $productRepository,
ContentConfigurationInterface $contentConfiguration,
Product $product1,
- Product $product2
- ): void
- {
+ Product $product2,
+ ): void {
$contentConfiguration->getConfiguration()->willReturn([
- 'products_carousel' => ['products' => ['code1', 'code2']]
+ 'products_carousel' => ['products' => ['code1', 'code2']],
]);
$productRepository->findBy(['code' => ['code1', 'code2']])->willReturn([$product1, $product2]);
diff --git a/spec/Renderer/ContentElement/ProductsGridByTaxonContentElementRendererSpec.php b/spec/Renderer/ContentElement/ProductsGridByTaxonContentElementRendererSpec.php
index 3745ca5d4..55575bb87 100644
--- a/spec/Renderer/ContentElement/ProductsGridByTaxonContentElementRendererSpec.php
+++ b/spec/Renderer/ContentElement/ProductsGridByTaxonContentElementRendererSpec.php
@@ -57,11 +57,10 @@ public function it_renders_products_grid_by_taxon_content_element(
ContentConfigurationInterface $contentConfiguration,
TaxonInterface $taxon,
Product $product1,
- Product $product2
- ): void
- {
+ Product $product2,
+ ): void {
$contentConfiguration->getConfiguration()->willReturn([
- 'products_grid_by_taxon' => 'taxon_code'
+ 'products_grid_by_taxon' => 'taxon_code',
]);
$taxonRepository->findOneBy(['code' => 'taxon_code'])->willReturn($taxon);
diff --git a/spec/Renderer/ContentElement/ProductsGridContentElementRendererSpec.php b/spec/Renderer/ContentElement/ProductsGridContentElementRendererSpec.php
index f5f012033..049cc2269 100644
--- a/spec/Renderer/ContentElement/ProductsGridContentElementRendererSpec.php
+++ b/spec/Renderer/ContentElement/ProductsGridContentElementRendererSpec.php
@@ -53,11 +53,10 @@ public function it_renders_products_grid_content_element(
ProductRepositoryInterface $productRepository,
ContentConfigurationInterface $contentConfiguration,
Product $product1,
- Product $product2
- ): void
- {
+ Product $product2,
+ ): void {
$contentConfiguration->getConfiguration()->willReturn([
- 'products_grid' => ['products' => ['code1', 'code2']]
+ 'products_grid' => ['products' => ['code1', 'code2']],
]);
$productRepository->findBy(['code' => ['code1', 'code2']])->willReturn([$product1, $product2]);
diff --git a/spec/Renderer/ContentElement/SingleMediaContentElementRendererSpec.php b/spec/Renderer/ContentElement/SingleMediaContentElementRendererSpec.php
index 6b0d031e2..896feffea 100644
--- a/spec/Renderer/ContentElement/SingleMediaContentElementRendererSpec.php
+++ b/spec/Renderer/ContentElement/SingleMediaContentElementRendererSpec.php
@@ -54,11 +54,10 @@ public function it_renders_single_media_content_element(
RenderMediaRuntimeInterface $renderMediaRuntime,
MediaRepositoryInterface $mediaRepository,
ContentConfigurationInterface $contentConfiguration,
- MediaInterface $media
- ): void
- {
+ MediaInterface $media,
+ ): void {
$contentConfiguration->getConfiguration()->willReturn([
- 'single_media' => 'media_code'
+ 'single_media' => 'media_code',
]);
$renderMediaRuntime->renderMedia('media_code')->willReturn('rendered media');
diff --git a/spec/Renderer/ContentElement/TaxonsListContentElementRendererSpec.php b/spec/Renderer/ContentElement/TaxonsListContentElementRendererSpec.php
index 6257c257d..2f6d2dcc1 100644
--- a/spec/Renderer/ContentElement/TaxonsListContentElementRendererSpec.php
+++ b/spec/Renderer/ContentElement/TaxonsListContentElementRendererSpec.php
@@ -53,11 +53,10 @@ public function it_renders_taxons_list_content_element(
TaxonRepositoryInterface $taxonRepository,
ContentConfigurationInterface $contentConfiguration,
Taxon $taxon1,
- Taxon $taxon2
- ): void
- {
+ Taxon $taxon2,
+ ): void {
$contentConfiguration->getConfiguration()->willReturn([
- 'taxons_list' => ['taxons' => ['code1', 'code2']]
+ 'taxons_list' => ['taxons' => ['code1', 'code2']],
]);
$taxonRepository->findBy(['code' => ['code1', 'code2']])->willReturn([$taxon1, $taxon2]);
diff --git a/spec/Renderer/ContentElement/TextareaContentElementRendererSpec.php b/spec/Renderer/ContentElement/TextareaContentElementRendererSpec.php
index ba98eb1b8..c0ae8f376 100644
--- a/spec/Renderer/ContentElement/TextareaContentElementRendererSpec.php
+++ b/spec/Renderer/ContentElement/TextareaContentElementRendererSpec.php
@@ -48,11 +48,10 @@ public function it_does_not_support_other_content_element_types(ContentConfigura
public function it_renders_textarea_content_element(
Environment $twig,
- ContentConfigurationInterface $contentConfiguration
- ): void
- {
+ ContentConfigurationInterface $contentConfiguration,
+ ): void {
$contentConfiguration->getConfiguration()->willReturn([
- 'textarea' => 'Textarea content'
+ 'textarea' => 'Textarea content',
]);
$twig->render('@BitBagSyliusCmsPlugin/Shop/ContentElement/index.html.twig', [
diff --git a/spec/Renderer/ContentElementRendererStrategySpec.php b/spec/Renderer/ContentElementRendererStrategySpec.php
index 23883e1ae..8b9d93de1 100644
--- a/spec/Renderer/ContentElementRendererStrategySpec.php
+++ b/spec/Renderer/ContentElementRendererStrategySpec.php
@@ -10,24 +10,23 @@
namespace spec\BitBag\SyliusCmsPlugin\Renderer;
+use BitBag\SyliusCmsPlugin\Entity\BlockInterface;
use BitBag\SyliusCmsPlugin\Entity\ContentConfigurationInterface;
+use BitBag\SyliusCmsPlugin\Entity\PageInterface;
+use BitBag\SyliusCmsPlugin\Renderer\ContentElement\ContentElementRendererInterface;
use BitBag\SyliusCmsPlugin\Renderer\ContentElementRendererStrategy;
+use BitBag\SyliusCmsPlugin\Renderer\ContentElementRendererStrategyInterface;
+use BitBag\SyliusCmsPlugin\Twig\Parser\ContentParserInterface;
use Doctrine\Common\Collections\ArrayCollection;
use PhpSpec\ObjectBehavior;
-use BitBag\SyliusCmsPlugin\Twig\Parser\ContentParserInterface;
-use BitBag\SyliusCmsPlugin\Renderer\ContentElement\ContentElementRendererInterface;
-use BitBag\SyliusCmsPlugin\Renderer\ContentElementRendererStrategyInterface;
-use BitBag\SyliusCmsPlugin\Entity\BlockInterface;
-use BitBag\SyliusCmsPlugin\Entity\PageInterface;
final class ContentElementRendererStrategySpec extends ObjectBehavior
{
public function let(
ContentParserInterface $contentParser,
ContentElementRendererInterface $renderer1,
- ContentElementRendererInterface $renderer2
- ): void
- {
+ ContentElementRendererInterface $renderer2,
+ ): void {
$this->beConstructedWith($contentParser, [$renderer1, $renderer2]);
}
@@ -47,11 +46,10 @@ public function it_renders_content_elements_using_registered_renderers(
ContentElementRendererInterface $renderer2,
BlockInterface $block,
ContentConfigurationInterface $contentElement1,
- ContentConfigurationInterface $contentElement2
- ): void
- {
+ ContentConfigurationInterface $contentElement2,
+ ): void {
$block->getContentElements()->willReturn(
- new ArrayCollection([$contentElement1->getWrappedObject(), $contentElement2->getWrappedObject()])
+ new ArrayCollection([$contentElement1->getWrappedObject(), $contentElement2->getWrappedObject()]),
);
$renderer1->supports($contentElement1)->willReturn(true);
@@ -74,11 +72,10 @@ public function it_renders_content_elements_using_registered_renderers_for_page(
ContentElementRendererInterface $renderer2,
PageInterface $page,
ContentConfigurationInterface $contentElement1,
- ContentConfigurationInterface $contentElement2
- ): void
- {
+ ContentConfigurationInterface $contentElement2,
+ ): void {
$page->getContentElements()->willReturn(
- new ArrayCollection([$contentElement1->getWrappedObject(), $contentElement2->getWrappedObject()])
+ new ArrayCollection([$contentElement1->getWrappedObject(), $contentElement2->getWrappedObject()]),
);
$renderer1->supports($contentElement1)->willReturn(true);
diff --git a/spec/Renderer/PageLinkRendererSpec.php b/spec/Renderer/PageLinkRendererSpec.php
index 45fb7b5f9..0998dcdf8 100644
--- a/spec/Renderer/PageLinkRendererSpec.php
+++ b/spec/Renderer/PageLinkRendererSpec.php
@@ -21,7 +21,7 @@ final class PageLinkRendererSpec extends ObjectBehavior
{
public function let(
UrlGeneratorInterface $urlGenerator,
- Environment $twig
+ Environment $twig,
): void {
$this->beConstructedWith($urlGenerator, $twig);
}
@@ -39,7 +39,7 @@ public function it_implements_page_link_renderer_interface(): void
public function it_renders_page_link_with_default_template(
UrlGeneratorInterface $urlGenerator,
Environment $twig,
- PageInterface $page
+ PageInterface $page,
): void {
$page->getSlug()->willReturn('page-slug');
$page->getName()->willReturn('Page Name');
@@ -47,7 +47,7 @@ public function it_renders_page_link_with_default_template(
$urlGenerator->generate(
'bitbag_sylius_cms_plugin_shop_page_show',
['slug' => 'page-slug'],
- UrlGeneratorInterface::ABSOLUTE_URL
+ UrlGeneratorInterface::ABSOLUTE_URL,
)->willReturn('http://example.com/page-slug');
$twig->render(
@@ -55,7 +55,7 @@ public function it_renders_page_link_with_default_template(
[
'link' => 'http://example.com/page-slug',
'name' => 'Page Name',
- ]
+ ],
)->willReturn('Page Name');
$this->render($page)->shouldReturn('Page Name');
@@ -64,7 +64,7 @@ public function it_renders_page_link_with_default_template(
public function it_renders_page_link_with_custom_template(
UrlGeneratorInterface $urlGenerator,
Environment $twig,
- PageInterface $page
+ PageInterface $page,
): void {
$page->getSlug()->willReturn('page-slug');
$page->getName()->willReturn('Page Name');
@@ -72,7 +72,7 @@ public function it_renders_page_link_with_custom_template(
$urlGenerator->generate(
'bitbag_sylius_cms_plugin_shop_page_show',
['slug' => 'page-slug'],
- UrlGeneratorInterface::ABSOLUTE_URL
+ UrlGeneratorInterface::ABSOLUTE_URL,
)->willReturn('http://example.com/page-slug');
$twig->render(
@@ -80,7 +80,7 @@ public function it_renders_page_link_with_custom_template(
[
'link' => 'http://example.com/page-slug',
'name' => 'Page Name',
- ]
+ ],
)->willReturn('Page Name');
$this->render($page, 'custom_template.html.twig')->shouldReturn('Page Name');
diff --git a/spec/Resolver/BlockResourceResolverSpec.php b/spec/Resolver/BlockResourceResolverSpec.php
index 55931e0a6..b70282c39 100755
--- a/spec/Resolver/BlockResourceResolverSpec.php
+++ b/spec/Resolver/BlockResourceResolverSpec.php
@@ -49,7 +49,7 @@ public function it_logs_warning_if_block_was_not_found(
BlockRepositoryInterface $blockRepository,
LoggerInterface $logger,
ChannelContextInterface $channelContext,
- ChannelInterface $channel
+ ChannelInterface $channel,
) {
$channel->getCode()->willReturn('WEB');
$channelContext->getChannel()->willReturn($channel);
@@ -58,7 +58,7 @@ public function it_logs_warning_if_block_was_not_found(
$logger
->warning(sprintf(
'Block with "%s" code was not found in the database.',
- 'homepage_banner'
+ 'homepage_banner',
))
->shouldBeCalled()
;
@@ -74,7 +74,7 @@ public function it_logs_warning_if_block_was_found_but_it_does_not_have_locale(
LocaleContextInterface $localeContext,
LocaleInterface $locale,
RepositoryInterface $localeRepository,
- BlockInterface $block
+ BlockInterface $block,
) {
$channel->getCode()->willReturn('WEB');
$channelContext->getChannel()->willReturn($channel);
@@ -89,7 +89,7 @@ public function it_logs_warning_if_block_was_found_but_it_does_not_have_locale(
->warning(sprintf(
'Block with "%s" code was found in the database, but it does not have "%s" locale.',
'homepage_banner',
- 'en_US'
+ 'en_US',
))
->shouldBeCalled()
;
diff --git a/spec/Resolver/ImporterChannelsResolverSpec.php b/spec/Resolver/Importer/ImporterChannelsResolverSpec.php
similarity index 87%
rename from spec/Resolver/ImporterChannelsResolverSpec.php
rename to spec/Resolver/Importer/ImporterChannelsResolverSpec.php
index c4ac903af..4607c7bd6 100644
--- a/spec/Resolver/ImporterChannelsResolverSpec.php
+++ b/spec/Resolver/Importer/ImporterChannelsResolverSpec.php
@@ -8,10 +8,10 @@
declare(strict_types=1);
-namespace spec\BitBag\SyliusCmsPlugin\Resolver;
+namespace spec\BitBag\SyliusCmsPlugin\Resolver\Importer;
use BitBag\SyliusCmsPlugin\Assigner\ChannelsAssignerInterface;
-use BitBag\SyliusCmsPlugin\Resolver\ImporterChannelsResolver;
+use BitBag\SyliusCmsPlugin\Resolver\Importer\ImporterChannelsResolver;
use PhpSpec\ObjectBehavior;
use Prophecy\Argument;
use Sylius\Component\Channel\Model\ChannelsAwareInterface;
@@ -30,7 +30,7 @@ public function it_is_initializable()
public function it_resolves_channels_for_channels_aware(
ChannelsAssignerInterface $channelsAssigner,
- ChannelsAwareInterface $channelsAware
+ ChannelsAwareInterface $channelsAware,
) {
$channelsRow = 'channel1, channel2, channel3';
$channelsCodes = ['channel1', 'channel2', 'channel3'];
@@ -42,7 +42,7 @@ public function it_resolves_channels_for_channels_aware(
public function it_skips_resolution_when_channels_row_is_null(
ChannelsAssignerInterface $channelsAssigner,
- ChannelsAwareInterface $channelsAware
+ ChannelsAwareInterface $channelsAware,
) {
$channelsRow = null;
diff --git a/spec/Resolver/ImporterCollectionsResolverSpec.php b/spec/Resolver/Importer/ImporterCollectionsResolverSpec.php
similarity index 87%
rename from spec/Resolver/ImporterCollectionsResolverSpec.php
rename to spec/Resolver/Importer/ImporterCollectionsResolverSpec.php
index 50568efdb..19032d1da 100644
--- a/spec/Resolver/ImporterCollectionsResolverSpec.php
+++ b/spec/Resolver/Importer/ImporterCollectionsResolverSpec.php
@@ -8,11 +8,11 @@
declare(strict_types=1);
-namespace spec\BitBag\SyliusCmsPlugin\Resolver;
+namespace spec\BitBag\SyliusCmsPlugin\Resolver\Importer;
use BitBag\SyliusCmsPlugin\Assigner\CollectionsAssignerInterface;
use BitBag\SyliusCmsPlugin\Entity\CollectibleInterface;
-use BitBag\SyliusCmsPlugin\Resolver\ImporterCollectionsResolver;
+use BitBag\SyliusCmsPlugin\Resolver\Importer\ImporterCollectionsResolver;
use PhpSpec\ObjectBehavior;
use Prophecy\Argument;
@@ -30,7 +30,7 @@ public function it_is_initializable()
public function it_resolves_collections_for_collectionable_entity(
CollectionsAssignerInterface $collectionsAssigner,
- CollectibleInterface $collectionable
+ CollectibleInterface $collectionable,
) {
$collectionsRow = 'collection1, collection2, collection3';
$collectionsCodes = ['collection1', 'collection2', 'collection3'];
@@ -42,9 +42,8 @@ public function it_resolves_collections_for_collectionable_entity(
public function it_skips_resolution_when_collections_row_is_null(
CollectionsAssignerInterface $collectionsAssigner,
- CollectibleInterface $collectionable
- )
- {
+ CollectibleInterface $collectionable,
+ ) {
$collectionsRow = null;
$collectionsAssigner->assign($collectionable, Argument::any())->shouldNotBeCalled();
diff --git a/spec/Resolver/ImporterLocalesResolverSpec.php b/spec/Resolver/Importer/ImporterLocalesResolverSpec.php
similarity index 86%
rename from spec/Resolver/ImporterLocalesResolverSpec.php
rename to spec/Resolver/Importer/ImporterLocalesResolverSpec.php
index ed4b4e619..818e97ffb 100644
--- a/spec/Resolver/ImporterLocalesResolverSpec.php
+++ b/spec/Resolver/Importer/ImporterLocalesResolverSpec.php
@@ -8,11 +8,11 @@
declare(strict_types=1);
-namespace spec\BitBag\SyliusCmsPlugin\Resolver;
+namespace spec\BitBag\SyliusCmsPlugin\Resolver\Importer;
use BitBag\SyliusCmsPlugin\Assigner\LocalesAssignerInterface;
use BitBag\SyliusCmsPlugin\Entity\LocaleAwareInterface;
-use BitBag\SyliusCmsPlugin\Resolver\ImporterLocalesResolver;
+use BitBag\SyliusCmsPlugin\Resolver\Importer\ImporterLocalesResolver;
use PhpSpec\ObjectBehavior;
final class ImporterLocalesResolverSpec extends ObjectBehavior
@@ -29,7 +29,7 @@ public function it_is_initializable()
public function it_resolves_locales_for_locale_aware_entity(
LocalesAssignerInterface $localesAssigner,
- LocaleAwareInterface $localesAware
+ LocaleAwareInterface $localesAware,
) {
$localesRow = 'en_US, fr_FR';
$localesAssigner->assign($localesAware, ['en_US', 'fr_FR'])->shouldBeCalled();
@@ -39,7 +39,7 @@ public function it_resolves_locales_for_locale_aware_entity(
public function it_does_not_assign_locales_when_locales_row_is_empty(
LocalesAssignerInterface $localesAssigner,
- LocaleAwareInterface $localesAware
+ LocaleAwareInterface $localesAware,
) {
$localesAssigner->assign($localesAware, [])->shouldNotBeCalled();
diff --git a/spec/Resolver/ImporterProductsInTaxonsResolverSpec.php b/spec/Resolver/Importer/ImporterProductsInTaxonsResolverSpec.php
similarity index 85%
rename from spec/Resolver/ImporterProductsInTaxonsResolverSpec.php
rename to spec/Resolver/Importer/ImporterProductsInTaxonsResolverSpec.php
index c1ce51ab4..83f751f36 100644
--- a/spec/Resolver/ImporterProductsInTaxonsResolverSpec.php
+++ b/spec/Resolver/Importer/ImporterProductsInTaxonsResolverSpec.php
@@ -8,11 +8,11 @@
declare(strict_types=1);
-namespace spec\BitBag\SyliusCmsPlugin\Resolver;
+namespace spec\BitBag\SyliusCmsPlugin\Resolver\Importer;
use BitBag\SyliusCmsPlugin\Assigner\ProductsInTaxonsAssignerInterface;
use BitBag\SyliusCmsPlugin\Entity\ProductsInTaxonsAwareInterface;
-use BitBag\SyliusCmsPlugin\Resolver\ImporterProductsInTaxonsResolver;
+use BitBag\SyliusCmsPlugin\Resolver\Importer\ImporterProductsInTaxonsResolver;
use PhpSpec\ObjectBehavior;
final class ImporterProductsInTaxonsResolverSpec extends ObjectBehavior
@@ -29,7 +29,7 @@ public function it_is_initializable()
public function it_resolves_taxons_for_products_in_taxons_aware_entity(
ProductsInTaxonsAssignerInterface $productsInTaxonsAssigner,
- ProductsInTaxonsAwareInterface $productsInTaxonsAware
+ ProductsInTaxonsAwareInterface $productsInTaxonsAware,
) {
$taxonsRow = 'taxon_code_1, taxon_code_2';
$productsInTaxonsAssigner->assign($productsInTaxonsAware, ['taxon_code_1', 'taxon_code_2'])->shouldBeCalled();
@@ -39,7 +39,7 @@ public function it_resolves_taxons_for_products_in_taxons_aware_entity(
public function it_does_not_assign_taxons_when_taxons_row_is_null(
ProductsInTaxonsAssignerInterface $productsInTaxonsAssigner,
- ProductsInTaxonsAwareInterface $productsInTaxonsAware
+ ProductsInTaxonsAwareInterface $productsInTaxonsAware,
) {
$productsInTaxonsAssigner->assign($productsInTaxonsAware, [])->shouldNotBeCalled();
diff --git a/spec/Resolver/ImporterProductsResolverSpec.php b/spec/Resolver/Importer/ImporterProductsResolverSpec.php
similarity index 87%
rename from spec/Resolver/ImporterProductsResolverSpec.php
rename to spec/Resolver/Importer/ImporterProductsResolverSpec.php
index 3b3bd5b96..414fa1753 100644
--- a/spec/Resolver/ImporterProductsResolverSpec.php
+++ b/spec/Resolver/Importer/ImporterProductsResolverSpec.php
@@ -8,11 +8,11 @@
declare(strict_types=1);
-namespace spec\BitBag\SyliusCmsPlugin\Resolver;
+namespace spec\BitBag\SyliusCmsPlugin\Resolver\Importer;
use BitBag\SyliusCmsPlugin\Assigner\ProductsAssignerInterface;
use BitBag\SyliusCmsPlugin\Entity\ProductsAwareInterface;
-use BitBag\SyliusCmsPlugin\Resolver\ImporterProductsResolver;
+use BitBag\SyliusCmsPlugin\Resolver\Importer\ImporterProductsResolver;
use PhpSpec\ObjectBehavior;
use Prophecy\Argument;
@@ -30,7 +30,7 @@ public function it_is_initializable()
public function it_resolves_products_for_products_aware(
ProductsAssignerInterface $productsAssigner,
- ProductsAwareInterface $productsAware
+ ProductsAwareInterface $productsAware,
) {
$productsRow = 'product1, product2, product3';
$productsCodes = ['product1', 'product2', 'product3'];
@@ -42,7 +42,7 @@ public function it_resolves_products_for_products_aware(
public function it_skips_resolution_when_products_row_is_null(
ProductsAssignerInterface $productsAssigner,
- ProductsAwareInterface $productsAware
+ ProductsAwareInterface $productsAware,
) {
$productsRow = null;
diff --git a/spec/Resolver/ImporterTaxonsResolverSpec.php b/spec/Resolver/Importer/ImporterTaxonsResolverSpec.php
similarity index 86%
rename from spec/Resolver/ImporterTaxonsResolverSpec.php
rename to spec/Resolver/Importer/ImporterTaxonsResolverSpec.php
index 16bb30e4b..03480e847 100644
--- a/spec/Resolver/ImporterTaxonsResolverSpec.php
+++ b/spec/Resolver/Importer/ImporterTaxonsResolverSpec.php
@@ -8,11 +8,11 @@
declare(strict_types=1);
-namespace spec\BitBag\SyliusCmsPlugin\Resolver;
+namespace spec\BitBag\SyliusCmsPlugin\Resolver\Importer;
use BitBag\SyliusCmsPlugin\Assigner\TaxonsAssignerInterface;
use BitBag\SyliusCmsPlugin\Entity\TaxonAwareInterface;
-use BitBag\SyliusCmsPlugin\Resolver\ImporterTaxonsResolver;
+use BitBag\SyliusCmsPlugin\Resolver\Importer\ImporterTaxonsResolver;
use PhpSpec\ObjectBehavior;
final class ImporterTaxonsResolverSpec extends ObjectBehavior
@@ -29,7 +29,7 @@ public function it_is_initializable()
public function it_resolves_taxons_for_taxon_aware_entity(
TaxonsAssignerInterface $taxonsAssigner,
- TaxonAwareInterface $taxonsAware
+ TaxonAwareInterface $taxonsAware,
) {
$taxonsRow = 'taxon_code_1, taxon_code_2';
$taxonsAssigner->assign($taxonsAware, ['taxon_code_1', 'taxon_code_2'])->shouldBeCalled();
@@ -39,7 +39,7 @@ public function it_resolves_taxons_for_taxon_aware_entity(
public function it_does_not_assign_taxons_when_taxons_row_is_null(
TaxonsAssignerInterface $taxonsAssigner,
- TaxonAwareInterface $taxonsAware
+ TaxonAwareInterface $taxonsAware,
) {
$taxonsAssigner->assign($taxonsAware, [])->shouldNotBeCalled();
diff --git a/spec/Resolver/MediaProviderResolverSpec.php b/spec/Resolver/MediaProviderResolverSpec.php
index 5010793c9..7546e0136 100644
--- a/spec/Resolver/MediaProviderResolverSpec.php
+++ b/spec/Resolver/MediaProviderResolverSpec.php
@@ -34,7 +34,7 @@ public function it_is_initializable()
public function it_resolves_provider_for_media(
ServiceRegistryInterface $providerRegistry,
MediaInterface $media,
- ProviderInterface $provider
+ ProviderInterface $provider,
) {
$mediaType = 'image';
$media->getType()->willReturn($mediaType);
@@ -45,7 +45,7 @@ public function it_resolves_provider_for_media(
}
public function it_throws_exception_when_media_type_is_null(
- MediaInterface $media
+ MediaInterface $media,
) {
$media->getType()->willReturn(null);
diff --git a/spec/Resolver/MediaResourceResolverSpec.php b/spec/Resolver/MediaResourceResolverSpec.php
index aa1d4a3c2..7e1f95ea0 100644
--- a/spec/Resolver/MediaResourceResolverSpec.php
+++ b/spec/Resolver/MediaResourceResolverSpec.php
@@ -26,7 +26,7 @@ public function let(
MediaRepositoryInterface $mediaRepository,
ChannelContextInterface $channelContext,
LoggerInterface $logger,
- ) {
+ ) {
$this->beConstructedWith($mediaRepository, $channelContext, $logger);
}
@@ -45,7 +45,7 @@ public function it_returns_media_when_found(
ChannelContextInterface $channelContext,
MediaInterface $media,
ChannelInterface $channel,
- ) {
+ ) {
$code = 'media_code';
$channelCode = 'ecommerce';
@@ -62,7 +62,7 @@ public function it_logs_warning_and_returns_null_when_media_not_found(
ChannelContextInterface $channelContext,
LoggerInterface $logger,
ChannelInterface $channel,
- ) {
+ ) {
$code = 'non_existing_code';
$channelCode = 'ecommerce';
diff --git a/spec/Resolver/PageResourceResolverSpec.php b/spec/Resolver/PageResourceResolverSpec.php
index 8911c70c4..22342f17c 100755
--- a/spec/Resolver/PageResourceResolverSpec.php
+++ b/spec/Resolver/PageResourceResolverSpec.php
@@ -16,13 +16,12 @@
use BitBag\SyliusCmsPlugin\Resolver\PageResourceResolverInterface;
use PhpSpec\ObjectBehavior;
use Psr\Log\LoggerInterface;
-use Sylius\Component\Locale\Context\LocaleContextInterface;
final class PageResourceResolverSpec extends ObjectBehavior
{
public function let(
PageRepositoryInterface $pageRepository,
- LoggerInterface $logger
+ LoggerInterface $logger,
) {
$this->beConstructedWith($pageRepository, $logger);
}
@@ -39,14 +38,14 @@ public function it_implements_page_resource_resolver_interface(): void
public function it_logs_warning_if_page_was_not_found(
PageRepositoryInterface $pageRepository,
- LoggerInterface $logger
+ LoggerInterface $logger,
) {
$pageRepository->findOneEnabledByCode('homepage_banner')->willReturn(null);
$logger
->warning(sprintf(
'Page with "%s" code was not found in the database.',
- 'homepage_banner'
+ 'homepage_banner',
))
->shouldBeCalled()
;
@@ -56,7 +55,7 @@ public function it_logs_warning_if_page_was_not_found(
public function it_returns_page_if_found_in_database(
PageRepositoryInterface $pageRepository,
- PageInterface $page
+ PageInterface $page,
) {
$pageRepository->findOneEnabledByCode('homepage_banner')->willReturn($page);
diff --git a/spec/Resolver/ResourceResolverSpec.php b/spec/Resolver/ResourceResolverSpec.php
index 74817d9bf..419db3554 100644
--- a/spec/Resolver/ResourceResolverSpec.php
+++ b/spec/Resolver/ResourceResolverSpec.php
@@ -20,7 +20,7 @@ final class ResourceResolverSpec extends ObjectBehavior
{
public function let(
RepositoryInterface $repository,
- FactoryInterface $factory
+ FactoryInterface $factory,
) {
$this->beConstructedWith($repository, $factory, 'unique_column');
}
@@ -32,7 +32,7 @@ public function it_is_initializable()
public function it_returns_existing_resource_from_repository(
RepositoryInterface $repository,
- ResourceInterface $resource
+ ResourceInterface $resource,
) {
$identifier = 'resource_identifier';
@@ -44,7 +44,7 @@ public function it_returns_existing_resource_from_repository(
public function it_creates_new_resource_using_factory(
RepositoryInterface $repository,
FactoryInterface $factory,
- ResourceInterface $newResource
+ ResourceInterface $newResource,
) {
$identifier = 'resource_identifier';
$factoryMethod = 'createNew';
@@ -57,7 +57,7 @@ public function it_creates_new_resource_using_factory(
public function it_throws_exception_when_factory_method_not_callable(
RepositoryInterface $repository,
- FactoryInterface $factory
+ FactoryInterface $factory,
) {
$identifier = 'resource_identifier';
$factoryMethod = 'nonExistingMethod';
diff --git a/spec/Sorter/CollectionsSorterSpec.php b/spec/Sorter/CollectionsSorterSpec.php
index 2b0116db2..90db83a2b 100644
--- a/spec/Sorter/CollectionsSorterSpec.php
+++ b/spec/Sorter/CollectionsSorterSpec.php
@@ -12,8 +12,8 @@
namespace spec\BitBag\SyliusCmsPlugin\Sorter;
-use BitBag\SyliusCmsPlugin\Entity\PageInterface;
use BitBag\SyliusCmsPlugin\Entity\CollectionInterface;
+use BitBag\SyliusCmsPlugin\Entity\PageInterface;
use BitBag\SyliusCmsPlugin\Sorter\CollectionsSorter;
use BitBag\SyliusCmsPlugin\Sorter\CollectionsSorterInterface;
use Doctrine\Common\Collections\ArrayCollection;
@@ -33,7 +33,7 @@ public function it_implements_collections_sorter_interface(): void
public function it_sorts_collections_with_one_element(
PageInterface $page,
- CollectionInterface $collection
+ CollectionInterface $collection,
): void {
$collection->getCode()->willReturn('COLLECTION_CODE');
$page->getCollections()->willReturn(new ArrayCollection([$collection->getWrappedObject()]));
@@ -41,28 +41,28 @@ public function it_sorts_collections_with_one_element(
$this->sortByCollections([$page])->shouldReturn(
[
'COLLECTION_CODE' => ['collection' => $collection, 0 => $page],
- ]
+ ],
);
}
public function it_sorts_collections_with_more_elements(
- PageInterface $page1,
- PageInterface $page2,
- PageInterface $page3,
+ PageInterface $page1,
+ PageInterface $page2,
+ PageInterface $page3,
CollectionInterface $collection1,
CollectionInterface $collection2,
- CollectionInterface $collection3
+ CollectionInterface $collection3,
): void {
$collection1->getCode()->willReturn('COLLECTION_1_CODE');
$collection2->getCode()->willReturn('COLLECTION_2_CODE');
$collection3->getCode()->willReturn('COLLECTION_3_CODE');
$page1->getCollections()->willReturn(new ArrayCollection(
- [$collection1->getWrappedObject(), $collection3->getWrappedObject()]
+ [$collection1->getWrappedObject(), $collection3->getWrappedObject()],
));
$page2->getCollections()->willReturn(new ArrayCollection([$collection3->getWrappedObject()]));
$page3->getCollections()->willReturn(new ArrayCollection(
- [$collection2->getWrappedObject(), $collection1->getWrappedObject()]
+ [$collection2->getWrappedObject(), $collection1->getWrappedObject()],
));
$this->sortByCollections([$page1, $page2, $page3])->shouldReturn(
@@ -70,15 +70,15 @@ public function it_sorts_collections_with_more_elements(
'COLLECTION_1_CODE' => ['collection' => $collection1, 0 => $page1, 1 => $page3],
'COLLECTION_3_CODE' => ['collection' => $collection3, 0 => $page1, 1 => $page2],
'COLLECTION_2_CODE' => ['collection' => $collection2, 0 => $page3],
- ]
+ ],
);
}
public function it_sorts_collections_with_less_elements(
- PageInterface $page1,
- PageInterface $page2,
+ PageInterface $page1,
+ PageInterface $page2,
CollectionInterface $collection1,
- CollectionInterface $collection2
+ CollectionInterface $collection2,
): void {
$collection1->getCode()->willReturn('COLLECTION_1_CODE');
$collection2->getCode()->willReturn('COLLECTION_2_CODE');
@@ -90,7 +90,7 @@ public function it_sorts_collections_with_less_elements(
[
'COLLECTION_1_CODE' => ['collection' => $collection1, 0 => $page1],
'COLLECTION_2_CODE' => ['collection' => $collection2, 0 => $page2],
- ]
+ ],
);
}
}
diff --git a/spec/Twig/Parser/ContentParserSpec.php b/spec/Twig/Parser/ContentParserSpec.php
index 96e4fcdd9..bacd69ed2 100644
--- a/spec/Twig/Parser/ContentParserSpec.php
+++ b/spec/Twig/Parser/ContentParserSpec.php
@@ -30,11 +30,11 @@ public function it_implements_content_parser_interface(): void
public function it_parses_string_function(
Environment $twigEnvironment,
- RenderBlockRuntimeInterface $renderBlockRuntime
+ RenderBlockRuntimeInterface $renderBlockRuntime,
): void {
$twigFunctionName = 'bitbag_cms_render_block';
$twigEnvironment->getFunctions()->willReturn([
- $twigFunctionName => new TwigFunction($twigFunctionName, [$renderBlockRuntime->getWrappedObject(), 'renderBlock'])
+ $twigFunctionName => new TwigFunction($twigFunctionName, [$renderBlockRuntime->getWrappedObject(), 'renderBlock']),
]);
$input = "Let's render! {{ bitbag_cms_render_block('intro', '@BitBagSyliusCmsPlugin/Shop/Block/show.html.twig') }}";
@@ -46,12 +46,11 @@ public function it_parses_string_function(
public function it_parses_string_functions(
Environment $twigEnvironment,
- RenderBlockRuntimeInterface $renderBlockRuntime
+ RenderBlockRuntimeInterface $renderBlockRuntime,
): void {
-
$twigFunctionName = 'bitbag_cms_render_block';
$twigEnvironment->getFunctions()->willReturn([
- $twigFunctionName => new TwigFunction($twigFunctionName, [$renderBlockRuntime->getWrappedObject(), 'renderBlock'])
+ $twigFunctionName => new TwigFunction($twigFunctionName, [$renderBlockRuntime->getWrappedObject(), 'renderBlock']),
]);
$input = "Let's render! {{ bitbag_cms_render_block('intro', '@BitBagSyliusCmsPlugin/Shop/Block/show.html.twig') }}
diff --git a/spec/Twig/Runtime/RenderBlockRuntimeSpec.php b/spec/Twig/Runtime/RenderBlockRuntimeSpec.php
index 69c782e97..6440085d2 100644
--- a/spec/Twig/Runtime/RenderBlockRuntimeSpec.php
+++ b/spec/Twig/Runtime/RenderBlockRuntimeSpec.php
@@ -27,7 +27,7 @@ final class RenderBlockRuntimeSpec extends ObjectBehavior
public function let(
BlockResourceResolverInterface $blockResourceResolver,
Environment $templatingEngine,
- ContentElementRendererStrategyInterface $contentElementRendererStrategy
+ ContentElementRendererStrategyInterface $contentElementRendererStrategy,
): void {
$this->beConstructedWith($blockResourceResolver, $templatingEngine, $contentElementRendererStrategy);
}
@@ -52,7 +52,7 @@ public function it_returns_empty_string_when_block_not_found(BlockResourceResolv
public function it_returns_empty_string_when_block_not_displayable_for_taxon(
BlockResourceResolverInterface $blockResourceResolver,
BlockInterface $block,
- TaxonInterface $taxon
+ TaxonInterface $taxon,
): void {
$blockResourceResolver->findOrLog('code')->willReturn($block);
$block->canBeDisplayedForTaxon($taxon)->willReturn(false);
@@ -63,7 +63,7 @@ public function it_returns_empty_string_when_block_not_displayable_for_taxon(
public function it_returns_empty_string_when_block_not_displayable_for_product(
BlockResourceResolverInterface $blockResourceResolver,
BlockInterface $block,
- ProductInterface $product
+ ProductInterface $product,
): void {
$blockResourceResolver->findOrLog('code')->willReturn($block);
$block->canBeDisplayedForProduct($product)->willReturn(false);
@@ -76,7 +76,7 @@ public function it_renders_block_with_default_template(
BlockResourceResolverInterface $blockResourceResolver,
Environment $templatingEngine,
ContentElementRendererStrategyInterface $contentElementRendererStrategy,
- BlockInterface $block
+ BlockInterface $block,
): void {
$blockResourceResolver->findOrLog('code')->willReturn($block);
$contentElementRendererStrategy->render($block)->willReturn('rendered content');
@@ -93,7 +93,7 @@ public function it_renders_block_with_custom_template(
BlockResourceResolverInterface $blockResourceResolver,
Environment $templatingEngine,
ContentElementRendererStrategyInterface $contentElementRendererStrategy,
- BlockInterface $block
+ BlockInterface $block,
): void {
$blockResourceResolver->findOrLog('code')->willReturn($block);
$contentElementRendererStrategy->render($block)->willReturn('rendered content');
diff --git a/spec/Twig/Runtime/RenderContentRuntimeSpec.php b/spec/Twig/Runtime/RenderContentRuntimeSpec.php
index 300f3d3e5..34e187b5a 100644
--- a/spec/Twig/Runtime/RenderContentRuntimeSpec.php
+++ b/spec/Twig/Runtime/RenderContentRuntimeSpec.php
@@ -21,7 +21,7 @@
final class RenderContentRuntimeSpec extends ObjectBehavior
{
public function let(
- ContentParserInterface $contentParser
+ ContentParserInterface $contentParser,
): void {
$this->beConstructedWith($contentParser);
}
@@ -38,7 +38,7 @@ public function it_implements_render_content_runtime_interface(): void
public function it_renders_content(
ContentParserInterface $contentParser,
- ContentableInterface $contentableResource
+ ContentableInterface $contentableResource,
): void {
$contentParser->parse('content')->willReturn('content');
$contentableResource->getContent()->willReturn('content');
diff --git a/spec/Twig/Runtime/RenderMediaRuntimeSpec.php b/spec/Twig/Runtime/RenderMediaRuntimeSpec.php
index f699e23e1..59f75c457 100644
--- a/spec/Twig/Runtime/RenderMediaRuntimeSpec.php
+++ b/spec/Twig/Runtime/RenderMediaRuntimeSpec.php
@@ -24,7 +24,7 @@ final class RenderMediaRuntimeSpec extends ObjectBehavior
{
public function let(
MediaProviderResolverInterface $mediaProviderResolver,
- MediaResourceResolverInterface $mediaResourceResolver
+ MediaResourceResolverInterface $mediaResourceResolver,
): void {
$this->beConstructedWith($mediaProviderResolver, $mediaResourceResolver);
}
@@ -43,7 +43,7 @@ public function it_renders_media(
MediaResourceResolverInterface $mediaResourceResolver,
MediaProviderResolverInterface $mediaProviderResolver,
ProviderInterface $provider,
- MediaInterface $media
+ MediaInterface $media,
): void {
$mediaResourceResolver->findOrLog('bitbag')->willReturn($media);
$provider->render($media, null)->willReturn('content');
diff --git a/spec/Twig/Runtime/RenderPageLinkRuntimeSpec.php b/spec/Twig/Runtime/RenderPageLinkRuntimeSpec.php
index 39fce9a8c..40b1b4100 100644
--- a/spec/Twig/Runtime/RenderPageLinkRuntimeSpec.php
+++ b/spec/Twig/Runtime/RenderPageLinkRuntimeSpec.php
@@ -26,7 +26,7 @@ final class RenderPageLinkRuntimeSpec extends ObjectBehavior
{
public function let(
PageRepositoryInterface $pageRepository,
- RouterInterface $router
+ RouterInterface $router,
): void {
$this->beConstructedWith($pageRepository, $router, 'defaultTemplate');
}
@@ -63,7 +63,7 @@ public function it_renders_link_for_code(
public function it_gets_link_for_code(
RouterInterface $router,
PageRepositoryInterface $pageRepository,
- PageInterface $page
+ PageInterface $page,
): void {
$code = 'CODE';
$slug = 'SLUG';
@@ -78,7 +78,7 @@ public function it_gets_link_for_code(
}
public function it_returns_not_found_message_when_getting_link_for_code(
- LocaleContextInterface $localeContext
+ LocaleContextInterface $localeContext,
): void {
$localeContext->getLocaleCode()->willReturn('en_US');
diff --git a/src/Controller/Action/Admin/RetrievePackageInfoAction.php b/src/Controller/Action/Admin/RetrievePackageInfoAction.php
index 6c1e1410d..918370d2d 100644
--- a/src/Controller/Action/Admin/RetrievePackageInfoAction.php
+++ b/src/Controller/Action/Admin/RetrievePackageInfoAction.php
@@ -12,12 +12,12 @@ final class RetrievePackageInfoAction
public function __invoke(Request $request): Response
{
try {
- $contents = file_get_contents(\sprintf(
+ file_get_contents(\sprintf(
"https://intranet.bitbag.shop/retrieve-package-info?packageName='%s'&url='%s'",
'bitbag/cms-plugin',
\sprintf('%s://%s', $request->getScheme(), $request->getHttpHost()),
));
- } catch (\Exception $exception) {
+ } catch (\Exception) {
return new Response('', Response::HTTP_BAD_REQUEST);
}
diff --git a/src/Controller/Action/Admin/UploadEditorImageAction.php b/src/Controller/Action/Admin/UploadEditorImageAction.php
index d45b500b5..462fe130a 100644
--- a/src/Controller/Action/Admin/UploadEditorImageAction.php
+++ b/src/Controller/Action/Admin/UploadEditorImageAction.php
@@ -76,7 +76,7 @@ private function createMediaCode(string $name): string
do {
if (0 < $i) {
- $code = $code . '_image_' . (string) $i;
+ $code .= '_image_' . $i;
}
++$i;
diff --git a/src/Controller/MediaController.php b/src/Controller/MediaController.php
index 1963b8605..ae460f48b 100755
--- a/src/Controller/MediaController.php
+++ b/src/Controller/MediaController.php
@@ -28,11 +28,9 @@ final class MediaController extends ResourceController
use ResourceDataProcessingTrait;
use MediaPageControllersCommonDependencyInjectionsTrait;
- /** @var MediaResourceResolverInterface */
- private $mediaResourceResolver;
+ private MediaResourceResolverInterface $mediaResourceResolver;
- /** @var MediaProviderResolverInterface */
- private $mediaProviderResolver;
+ private MediaProviderResolverInterface $mediaProviderResolver;
public const FILTER = 'sylius_admin_product_original';
diff --git a/src/Controller/MediaPageControllersCommonDependencyInjectionsTrait.php b/src/Controller/MediaPageControllersCommonDependencyInjectionsTrait.php
index 9fe0e48a9..c72154c3c 100644
--- a/src/Controller/MediaPageControllersCommonDependencyInjectionsTrait.php
+++ b/src/Controller/MediaPageControllersCommonDependencyInjectionsTrait.php
@@ -10,14 +10,11 @@
trait MediaPageControllersCommonDependencyInjectionsTrait
{
- /** @var CacheManager */
- private $cacheManager;
+ private CacheManager $cacheManager;
- /** @var DataManager */
- private $dataManager;
+ private DataManager $dataManager;
- /** @var FormErrorsFlashHelperInterface */
- private $formErrorsFlashHelper;
+ private FormErrorsFlashHelperInterface $formErrorsFlashHelper;
public function setFormErrorsFlashHelper(FormErrorsFlashHelperInterface $formErrorsFlashHelper): void
{
diff --git a/src/Controller/PageController.php b/src/Controller/PageController.php
index 9db69140b..6aea5fe95 100755
--- a/src/Controller/PageController.php
+++ b/src/Controller/PageController.php
@@ -24,8 +24,7 @@ final class PageController extends ResourceController
use ResourceDataProcessingTrait;
use MediaPageControllersCommonDependencyInjectionsTrait;
- /** @var PageResourceResolverInterface */
- private $pageResourceResolver;
+ private PageResourceResolverInterface $pageResourceResolver;
public const FILTER = 'sylius_admin_product_original';
diff --git a/src/Controller/ResourceDataProcessingTrait.php b/src/Controller/ResourceDataProcessingTrait.php
index 39f84632c..a59c209d6 100644
--- a/src/Controller/ResourceDataProcessingTrait.php
+++ b/src/Controller/ResourceDataProcessingTrait.php
@@ -38,7 +38,7 @@ private function setResourceMediaPath(MediaInterface $media): void
}
Assert::notNull($media->getMimeType());
Assert::notNull($media->getType());
- if (1 === preg_match("/image\//", $media->getMimeType()) && 'image' === $media->getType()) {
+ if ('image' === $media->getType() && 1 === preg_match("/image\//", $media->getMimeType())) {
$this->setPathForImageMediaType($media);
} else {
$this->setPathForNonImageMediaType($media);
diff --git a/src/DependencyInjection/Compiler/MediaProviderPass.php b/src/DependencyInjection/Compiler/MediaProviderPass.php
index 5e8c80962..846ca1542 100644
--- a/src/DependencyInjection/Compiler/MediaProviderPass.php
+++ b/src/DependencyInjection/Compiler/MediaProviderPass.php
@@ -26,7 +26,7 @@ public function process(ContainerBuilder $container): void
$providers = [];
foreach ($container->findTaggedServiceIds('bitbag_sylius_cms_plugin.media_provider') as $id => $attributes) {
- if (!isset($attributes[0]['type']) || !isset($attributes[0]['label'])) {
+ if (!isset($attributes[0]['type'], $attributes[0]['label'])) {
throw new \InvalidArgumentException('Tagged media provider needs to have `type` and `label` attribute.');
}
diff --git a/src/Downloader/ImageDownloader.php b/src/Downloader/ImageDownloader.php
deleted file mode 100644
index 93743c481..000000000
--- a/src/Downloader/ImageDownloader.php
+++ /dev/null
@@ -1,39 +0,0 @@
-filesystem->dumpFile($path, $contents);
-
- return new UploadedFile($path, $originalName);
- }
-}
diff --git a/src/Downloader/ImageDownloaderInterface.php b/src/Downloader/ImageDownloaderInterface.php
deleted file mode 100644
index f483dbf69..000000000
--- a/src/Downloader/ImageDownloaderInterface.php
+++ /dev/null
@@ -1,18 +0,0 @@
-saveWithOriginalName = $saveWithOriginalName;
}
- /**
- * @return MediaTranslationInterface|TranslationInterface
- */
protected function getMediaTranslation(): TranslationInterface
{
return $this->getTranslation();
diff --git a/src/Entity/Page.php b/src/Entity/Page.php
index 54c24ff60..0e311b244 100755
--- a/src/Entity/Page.php
+++ b/src/Entity/Page.php
@@ -149,9 +149,6 @@ public function setPublishAt(?\DateTimeImmutable $publishAt): void
$this->publishAt = $publishAt;
}
- /**
- * @return PageTranslationInterface|TranslationInterface
- */
protected function getPageTranslation(): TranslationInterface
{
return $this->getTranslation();
diff --git a/src/Entity/ProductsAwareInterface.php b/src/Entity/ProductsAwareInterface.php
index 36073ca5b..922302d75 100755
--- a/src/Entity/ProductsAwareInterface.php
+++ b/src/Entity/ProductsAwareInterface.php
@@ -17,9 +17,6 @@ interface ProductsAwareInterface
{
public function initializeProductsCollection(): void;
- /**
- * @return Collection|ProductInterface[]
- */
public function getProducts(): Collection;
public function hasProduct(ProductInterface $product): bool;
diff --git a/src/Entity/ProductsInTaxonsAwareInterface.php b/src/Entity/ProductsInTaxonsAwareInterface.php
index 4a03c9939..ed65d837d 100755
--- a/src/Entity/ProductsInTaxonsAwareInterface.php
+++ b/src/Entity/ProductsInTaxonsAwareInterface.php
@@ -17,9 +17,6 @@ interface ProductsInTaxonsAwareInterface
{
public function initializeProductsInTaxonsCollection(): void;
- /**
- * @return Collection|TaxonInterface[]
- */
public function getProductsInTaxons(): Collection;
public function hasProductsInTaxon(TaxonInterface $taxon): bool;
diff --git a/src/Entity/TaxonAwareInterface.php b/src/Entity/TaxonAwareInterface.php
index 6dcea88ca..20e7ccb95 100755
--- a/src/Entity/TaxonAwareInterface.php
+++ b/src/Entity/TaxonAwareInterface.php
@@ -17,9 +17,6 @@ interface TaxonAwareInterface
{
public function initializeTaxonCollection(): void;
- /**
- * @return Collection|TaxonInterface[]
- */
public function getTaxons(): Collection;
public function hasTaxon(TaxonInterface $taxon): bool;
diff --git a/src/Entity/Trait/ChannelsAwareTrait.php b/src/Entity/Trait/ChannelsAwareTrait.php
index ae70db1e8..712a396f2 100755
--- a/src/Entity/Trait/ChannelsAwareTrait.php
+++ b/src/Entity/Trait/ChannelsAwareTrait.php
@@ -22,8 +22,7 @@
trait ChannelsAwareTrait
{
- /** @var Collection|ChannelInterface[] */
- protected $channels;
+ protected Collection $channels;
public function initializeChannelsCollection(): void
{
diff --git a/src/Entity/Trait/ProductsAwareTrait.php b/src/Entity/Trait/ProductsAwareTrait.php
index c91f80178..24c048497 100755
--- a/src/Entity/Trait/ProductsAwareTrait.php
+++ b/src/Entity/Trait/ProductsAwareTrait.php
@@ -16,7 +16,6 @@
trait ProductsAwareTrait
{
- /** @var Collection|ProductInterface[] */
protected Collection $products;
public function initializeProductsCollection(): void
diff --git a/src/Entity/Trait/ProductsInTaxonsAwareTrait.php b/src/Entity/Trait/ProductsInTaxonsAwareTrait.php
index 3374808f3..ae5b10185 100644
--- a/src/Entity/Trait/ProductsInTaxonsAwareTrait.php
+++ b/src/Entity/Trait/ProductsInTaxonsAwareTrait.php
@@ -17,7 +17,6 @@
trait ProductsInTaxonsAwareTrait
{
- /** @var Collection|TaxonInterface[] */
protected Collection $productsInTaxons;
public function initializeProductsInTaxonsCollection(): void
diff --git a/src/Entity/Trait/TaxonAwareTrait.php b/src/Entity/Trait/TaxonAwareTrait.php
index 2a5af43b8..214a3e3a7 100644
--- a/src/Entity/Trait/TaxonAwareTrait.php
+++ b/src/Entity/Trait/TaxonAwareTrait.php
@@ -16,7 +16,6 @@
trait TaxonAwareTrait
{
- /** @var Collection|TaxonInterface[] */
protected Collection $taxons;
public function initializeTaxonCollection(): void
diff --git a/src/EventListener/ResourceDeleteSubscriber.php b/src/EventListener/ResourceDeleteSubscriber.php
index cc28175f7..f212fb8ac 100644
--- a/src/EventListener/ResourceDeleteSubscriber.php
+++ b/src/EventListener/ResourceDeleteSubscriber.php
@@ -106,7 +106,7 @@ private function isMethodDelete(Request $request): bool
private function isProtectedRoute(string $route): bool
{
- return 0 === strpos($route, 'bitbag');
+ return str_starts_with($route, 'bitbag');
}
private function isAdminSection(array $syliusParameters): bool
diff --git a/src/Form/Type/MediaType.php b/src/Form/Type/MediaType.php
index 4672b2dd9..d0fb16a8b 100644
--- a/src/Form/Type/MediaType.php
+++ b/src/Form/Type/MediaType.php
@@ -22,8 +22,7 @@
final class MediaType extends AbstractResourceType
{
- /** @var array */
- private $providers;
+ private array $providers;
public function __construct(
string $dataClass,
diff --git a/src/Importer/AbstractImporter.php b/src/Importer/AbstractImporter.php
index 52147a013..50dc401cd 100755
--- a/src/Importer/AbstractImporter.php
+++ b/src/Importer/AbstractImporter.php
@@ -25,11 +25,7 @@ public function cleanup(): void
protected function getColumnValue(string $column, array $row)
{
- if (array_key_exists($column, $row)) {
- return $row[$column];
- }
-
- return null;
+ return $row[$column] ?? null;
}
protected function getTranslatableColumnValue(
@@ -39,11 +35,7 @@ protected function getTranslatableColumnValue(
) {
$column = str_replace('__locale__', '_' . $locale, $column);
- if (array_key_exists($column, $row)) {
- return $row[$column];
- }
-
- return null;
+ return $row[$column] ?? null;
}
protected function getAvailableLocales(array $translatableColumns, array $columns): array
@@ -54,7 +46,7 @@ protected function getAvailableLocales(array $translatableColumns, array $column
$translatableColumn = str_replace('__locale__', '_', $translatableColumn);
foreach ($columns as $column) {
- if (0 === strpos($column, $translatableColumn)) {
+ if (str_starts_with($column, $translatableColumn)) {
$locales[] = str_replace($translatableColumn, '', $column);
}
}
diff --git a/src/Importer/BlockImporter.php b/src/Importer/BlockImporter.php
index e41ed67d0..51bbd0846 100644
--- a/src/Importer/BlockImporter.php
+++ b/src/Importer/BlockImporter.php
@@ -12,12 +12,12 @@
use BitBag\SyliusCmsPlugin\Entity\BlockInterface;
use BitBag\SyliusCmsPlugin\Repository\BlockRepositoryInterface;
-use BitBag\SyliusCmsPlugin\Resolver\ImporterChannelsResolverInterface;
-use BitBag\SyliusCmsPlugin\Resolver\ImporterCollectionsResolverInterface;
-use BitBag\SyliusCmsPlugin\Resolver\ImporterLocalesResolverInterface;
-use BitBag\SyliusCmsPlugin\Resolver\ImporterProductsInTaxonsResolverInterface;
-use BitBag\SyliusCmsPlugin\Resolver\ImporterProductsResolverInterface;
-use BitBag\SyliusCmsPlugin\Resolver\ImporterTaxonsResolverInterface;
+use BitBag\SyliusCmsPlugin\Resolver\Importer\ImporterChannelsResolverInterface;
+use BitBag\SyliusCmsPlugin\Resolver\Importer\ImporterCollectionsResolverInterface;
+use BitBag\SyliusCmsPlugin\Resolver\Importer\ImporterLocalesResolverInterface;
+use BitBag\SyliusCmsPlugin\Resolver\Importer\ImporterProductsInTaxonsResolverInterface;
+use BitBag\SyliusCmsPlugin\Resolver\Importer\ImporterProductsResolverInterface;
+use BitBag\SyliusCmsPlugin\Resolver\Importer\ImporterTaxonsResolverInterface;
use BitBag\SyliusCmsPlugin\Resolver\ResourceResolverInterface;
use Symfony\Component\Validator\Validator\ValidatorInterface;
use Webmozart\Assert\Assert;
diff --git a/src/Importer/ImporterChain.php b/src/Importer/ImporterChain.php
index f6ee7bb33..b301f479d 100644
--- a/src/Importer/ImporterChain.php
+++ b/src/Importer/ImporterChain.php
@@ -13,7 +13,7 @@
final class ImporterChain implements ImporterChainInterface
{
/** @var ImporterInterface[] */
- private $importers = [];
+ private array $importers = [];
public function addImporter(ImporterInterface $importer): void
{
diff --git a/src/Importer/MediaImporter.php b/src/Importer/MediaImporter.php
index 81fdda169..8c0199831 100644
--- a/src/Importer/MediaImporter.php
+++ b/src/Importer/MediaImporter.php
@@ -12,7 +12,7 @@
use BitBag\SyliusCmsPlugin\Entity\MediaInterface;
use BitBag\SyliusCmsPlugin\Repository\MediaRepositoryInterface;
-use BitBag\SyliusCmsPlugin\Resolver\ImporterCollectionsResolverInterface;
+use BitBag\SyliusCmsPlugin\Resolver\Importer\ImporterCollectionsResolverInterface;
use BitBag\SyliusCmsPlugin\Resolver\ResourceResolverInterface;
use Sylius\Component\Locale\Context\LocaleContextInterface;
use Symfony\Component\Validator\Validator\ValidatorInterface;
diff --git a/src/Importer/PageImporter.php b/src/Importer/PageImporter.php
index 48531cdf4..44b4a48c2 100644
--- a/src/Importer/PageImporter.php
+++ b/src/Importer/PageImporter.php
@@ -11,8 +11,8 @@
namespace BitBag\SyliusCmsPlugin\Importer;
use BitBag\SyliusCmsPlugin\Entity\PageInterface;
-use BitBag\SyliusCmsPlugin\Resolver\ImporterChannelsResolverInterface;
-use BitBag\SyliusCmsPlugin\Resolver\ImporterCollectionsResolverInterface;
+use BitBag\SyliusCmsPlugin\Resolver\Importer\ImporterChannelsResolverInterface;
+use BitBag\SyliusCmsPlugin\Resolver\Importer\ImporterCollectionsResolverInterface;
use BitBag\SyliusCmsPlugin\Resolver\ResourceResolverInterface;
use Doctrine\ORM\EntityManagerInterface;
use Sylius\Component\Locale\Context\LocaleContextInterface;
diff --git a/src/Processor/ImportProcessor.php b/src/Processor/ImportProcessor.php
index 2b32379a9..64792f732 100644
--- a/src/Processor/ImportProcessor.php
+++ b/src/Processor/ImportProcessor.php
@@ -24,16 +24,16 @@ public function __construct(
) {
}
- public function process(string $resourceCode, string $filePath): void
+ public function process(string $resourceName, string $filePath): void
{
- $importer = $this->importerChain->getImporterForResource($resourceCode);
+ $importer = $this->importerChain->getImporterForResource($resourceName);
$data = $this->reader->read($filePath);
foreach ($data as $index => $row) {
try {
$importer->import($row);
} catch (\Exception $exception) {
- $index += 1;
+ ++$index;
throw new ImportFailedException($exception->getMessage(), $index);
}
diff --git a/src/Reader/CsvReader.php b/src/Reader/CsvReader.php
index ca2354abd..3dd70e2ee 100755
--- a/src/Reader/CsvReader.php
+++ b/src/Reader/CsvReader.php
@@ -16,6 +16,6 @@ final class CsvReader implements ReaderInterface
{
public function read(string $filePath): \Iterator
{
- return Reader::createFromPath($filePath, 'r')->setHeaderOffset(0)->getIterator();
+ return Reader::createFromPath($filePath)->setHeaderOffset(0)->getIterator();
}
}
diff --git a/src/Resolver/ImporterChannelsResolver.php b/src/Resolver/Importer/ImporterChannelsResolver.php
similarity index 88%
rename from src/Resolver/ImporterChannelsResolver.php
rename to src/Resolver/Importer/ImporterChannelsResolver.php
index 917d61d95..4ac4efc2a 100644
--- a/src/Resolver/ImporterChannelsResolver.php
+++ b/src/Resolver/Importer/ImporterChannelsResolver.php
@@ -8,7 +8,7 @@
declare(strict_types=1);
-namespace BitBag\SyliusCmsPlugin\Resolver;
+namespace BitBag\SyliusCmsPlugin\Resolver\Importer;
use BitBag\SyliusCmsPlugin\Assigner\ChannelsAssignerInterface;
use Sylius\Component\Channel\Model\ChannelsAwareInterface;
@@ -26,7 +26,7 @@ public function resolve(ChannelsAwareInterface $channelsAware, ?string $channels
}
$channelsCodes = explode(',', $channelsRow);
- $channelsCodes = array_map(function (string $element): string {
+ $channelsCodes = array_map(static function (string $element): string {
return trim($element);
}, $channelsCodes);
diff --git a/src/Resolver/ImporterChannelsResolverInterface.php b/src/Resolver/Importer/ImporterChannelsResolverInterface.php
similarity index 91%
rename from src/Resolver/ImporterChannelsResolverInterface.php
rename to src/Resolver/Importer/ImporterChannelsResolverInterface.php
index 3af81a723..5a4e3f860 100644
--- a/src/Resolver/ImporterChannelsResolverInterface.php
+++ b/src/Resolver/Importer/ImporterChannelsResolverInterface.php
@@ -8,7 +8,7 @@
declare(strict_types=1);
-namespace BitBag\SyliusCmsPlugin\Resolver;
+namespace BitBag\SyliusCmsPlugin\Resolver\Importer;
use Sylius\Component\Channel\Model\ChannelsAwareInterface;
diff --git a/src/Resolver/ImporterCollectionsResolver.php b/src/Resolver/Importer/ImporterCollectionsResolver.php
similarity index 88%
rename from src/Resolver/ImporterCollectionsResolver.php
rename to src/Resolver/Importer/ImporterCollectionsResolver.php
index 938555826..1850a09cd 100644
--- a/src/Resolver/ImporterCollectionsResolver.php
+++ b/src/Resolver/Importer/ImporterCollectionsResolver.php
@@ -8,7 +8,7 @@
declare(strict_types=1);
-namespace BitBag\SyliusCmsPlugin\Resolver;
+namespace BitBag\SyliusCmsPlugin\Resolver\Importer;
use BitBag\SyliusCmsPlugin\Assigner\CollectionsAssignerInterface;
use BitBag\SyliusCmsPlugin\Entity\CollectibleInterface;
@@ -26,7 +26,7 @@ public function resolve(CollectibleInterface $collectionable, ?string $collectio
}
$collectionCodes = explode(',', $collectionsRow);
- $collectionCodes = array_map(function (string $element): string {
+ $collectionCodes = array_map(static function (string $element): string {
return trim($element);
}, $collectionCodes);
diff --git a/src/Resolver/ImporterCollectionsResolverInterface.php b/src/Resolver/Importer/ImporterCollectionsResolverInterface.php
similarity index 91%
rename from src/Resolver/ImporterCollectionsResolverInterface.php
rename to src/Resolver/Importer/ImporterCollectionsResolverInterface.php
index 23c931e95..09799ec83 100644
--- a/src/Resolver/ImporterCollectionsResolverInterface.php
+++ b/src/Resolver/Importer/ImporterCollectionsResolverInterface.php
@@ -8,7 +8,7 @@
declare(strict_types=1);
-namespace BitBag\SyliusCmsPlugin\Resolver;
+namespace BitBag\SyliusCmsPlugin\Resolver\Importer;
use BitBag\SyliusCmsPlugin\Entity\CollectibleInterface;
diff --git a/src/Resolver/ImporterLocalesResolver.php b/src/Resolver/Importer/ImporterLocalesResolver.php
similarity index 95%
rename from src/Resolver/ImporterLocalesResolver.php
rename to src/Resolver/Importer/ImporterLocalesResolver.php
index 450832d53..ee4c068db 100644
--- a/src/Resolver/ImporterLocalesResolver.php
+++ b/src/Resolver/Importer/ImporterLocalesResolver.php
@@ -8,7 +8,7 @@
declare(strict_types=1);
-namespace BitBag\SyliusCmsPlugin\Resolver;
+namespace BitBag\SyliusCmsPlugin\Resolver\Importer;
use BitBag\SyliusCmsPlugin\Assigner\LocalesAssignerInterface;
use BitBag\SyliusCmsPlugin\Entity\LocaleAwareInterface;
diff --git a/src/Resolver/ImporterLocalesResolverInterface.php b/src/Resolver/Importer/ImporterLocalesResolverInterface.php
similarity index 91%
rename from src/Resolver/ImporterLocalesResolverInterface.php
rename to src/Resolver/Importer/ImporterLocalesResolverInterface.php
index 45864042b..90cb0b253 100644
--- a/src/Resolver/ImporterLocalesResolverInterface.php
+++ b/src/Resolver/Importer/ImporterLocalesResolverInterface.php
@@ -8,7 +8,7 @@
declare(strict_types=1);
-namespace BitBag\SyliusCmsPlugin\Resolver;
+namespace BitBag\SyliusCmsPlugin\Resolver\Importer;
use BitBag\SyliusCmsPlugin\Entity\LocaleAwareInterface;
diff --git a/src/Resolver/ImporterProductsInTaxonsResolver.php b/src/Resolver/Importer/ImporterProductsInTaxonsResolver.php
similarity index 95%
rename from src/Resolver/ImporterProductsInTaxonsResolver.php
rename to src/Resolver/Importer/ImporterProductsInTaxonsResolver.php
index f476fffc5..d16608983 100644
--- a/src/Resolver/ImporterProductsInTaxonsResolver.php
+++ b/src/Resolver/Importer/ImporterProductsInTaxonsResolver.php
@@ -8,7 +8,7 @@
declare(strict_types=1);
-namespace BitBag\SyliusCmsPlugin\Resolver;
+namespace BitBag\SyliusCmsPlugin\Resolver\Importer;
use BitBag\SyliusCmsPlugin\Assigner\ProductsInTaxonsAssignerInterface;
use BitBag\SyliusCmsPlugin\Entity\ProductsInTaxonsAwareInterface;
diff --git a/src/Resolver/ImporterProductsInTaxonsResolverInterface.php b/src/Resolver/Importer/ImporterProductsInTaxonsResolverInterface.php
similarity index 91%
rename from src/Resolver/ImporterProductsInTaxonsResolverInterface.php
rename to src/Resolver/Importer/ImporterProductsInTaxonsResolverInterface.php
index ddb07a222..566a2400a 100644
--- a/src/Resolver/ImporterProductsInTaxonsResolverInterface.php
+++ b/src/Resolver/Importer/ImporterProductsInTaxonsResolverInterface.php
@@ -8,7 +8,7 @@
declare(strict_types=1);
-namespace BitBag\SyliusCmsPlugin\Resolver;
+namespace BitBag\SyliusCmsPlugin\Resolver\Importer;
use BitBag\SyliusCmsPlugin\Entity\ProductsInTaxonsAwareInterface;
diff --git a/src/Resolver/ImporterProductsResolver.php b/src/Resolver/Importer/ImporterProductsResolver.php
similarity index 88%
rename from src/Resolver/ImporterProductsResolver.php
rename to src/Resolver/Importer/ImporterProductsResolver.php
index c9ab83e21..3068854a4 100644
--- a/src/Resolver/ImporterProductsResolver.php
+++ b/src/Resolver/Importer/ImporterProductsResolver.php
@@ -8,7 +8,7 @@
declare(strict_types=1);
-namespace BitBag\SyliusCmsPlugin\Resolver;
+namespace BitBag\SyliusCmsPlugin\Resolver\Importer;
use BitBag\SyliusCmsPlugin\Assigner\ProductsAssignerInterface;
use BitBag\SyliusCmsPlugin\Entity\ProductsAwareInterface;
@@ -26,7 +26,7 @@ public function resolve(ProductsAwareInterface $productsAware, ?string $products
}
$productsCodes = explode(',', $productsRow);
- $productsCodes = array_map(function (string $element): string {
+ $productsCodes = array_map(static function (string $element): string {
return trim($element);
}, $productsCodes);
diff --git a/src/Resolver/ImporterProductsResolverInterface.php b/src/Resolver/Importer/ImporterProductsResolverInterface.php
similarity index 91%
rename from src/Resolver/ImporterProductsResolverInterface.php
rename to src/Resolver/Importer/ImporterProductsResolverInterface.php
index b70471a90..325235e22 100644
--- a/src/Resolver/ImporterProductsResolverInterface.php
+++ b/src/Resolver/Importer/ImporterProductsResolverInterface.php
@@ -8,7 +8,7 @@
declare(strict_types=1);
-namespace BitBag\SyliusCmsPlugin\Resolver;
+namespace BitBag\SyliusCmsPlugin\Resolver\Importer;
use BitBag\SyliusCmsPlugin\Entity\ProductsAwareInterface;
diff --git a/src/Resolver/ImporterTaxonsResolver.php b/src/Resolver/Importer/ImporterTaxonsResolver.php
similarity index 95%
rename from src/Resolver/ImporterTaxonsResolver.php
rename to src/Resolver/Importer/ImporterTaxonsResolver.php
index f687c4e95..2ae3bad50 100644
--- a/src/Resolver/ImporterTaxonsResolver.php
+++ b/src/Resolver/Importer/ImporterTaxonsResolver.php
@@ -8,7 +8,7 @@
declare(strict_types=1);
-namespace BitBag\SyliusCmsPlugin\Resolver;
+namespace BitBag\SyliusCmsPlugin\Resolver\Importer;
use BitBag\SyliusCmsPlugin\Assigner\TaxonsAssignerInterface;
use BitBag\SyliusCmsPlugin\Entity\TaxonAwareInterface;
diff --git a/src/Resolver/ImporterTaxonsResolverInterface.php b/src/Resolver/Importer/ImporterTaxonsResolverInterface.php
similarity index 91%
rename from src/Resolver/ImporterTaxonsResolverInterface.php
rename to src/Resolver/Importer/ImporterTaxonsResolverInterface.php
index e828e87c3..98e8f74ee 100644
--- a/src/Resolver/ImporterTaxonsResolverInterface.php
+++ b/src/Resolver/Importer/ImporterTaxonsResolverInterface.php
@@ -8,7 +8,7 @@
declare(strict_types=1);
-namespace BitBag\SyliusCmsPlugin\Resolver;
+namespace BitBag\SyliusCmsPlugin\Resolver\Importer;
use BitBag\SyliusCmsPlugin\Entity\TaxonAwareInterface;
diff --git a/src/Resolver/ResourceResolver.php b/src/Resolver/ResourceResolver.php
index 2076d55ad..dd54a5776 100644
--- a/src/Resolver/ResourceResolver.php
+++ b/src/Resolver/ResourceResolver.php
@@ -37,7 +37,7 @@ public function getResource(string $identifier, string $factoryMethod = 'createN
$callback = [$this->factory, $factoryMethod];
if (is_callable($callback) && method_exists($this->factory, $factoryMethod)) {
- return call_user_func($callback);
+ return $callback();
}
throw new BadFunctionCallException('Provided method' . $factoryMethod . ' is not callable');
diff --git a/src/Resources/config/services.xml b/src/Resources/config/services.xml
index 25bcef1cb..2ee965e17 100644
--- a/src/Resources/config/services.xml
+++ b/src/Resources/config/services.xml
@@ -24,10 +24,6 @@
-
-
-
-
%bitbag_sylius_cms_plugin.media_provider.interface%
Media provider
diff --git a/src/Resources/config/services/resolver.xml b/src/Resources/config/services/resolver.xml
index 3c0b800a0..7299fca21 100644
--- a/src/Resources/config/services/resolver.xml
+++ b/src/Resources/config/services/resolver.xml
@@ -56,27 +56,27 @@
-
+
-
+
-
+
-
+
-
+
-
+
diff --git a/src/Twig/Parser/ContentParser.php b/src/Twig/Parser/ContentParser.php
index 0104a4171..b2ed30dff 100644
--- a/src/Twig/Parser/ContentParser.php
+++ b/src/Twig/Parser/ContentParser.php
@@ -35,7 +35,7 @@ public function parse(string $input): string
if (null !== $arguments = $this->getFunctionArguments($function, $call)) {
try {
$functionResult = $this->callFunction($functions, $function, $arguments);
- } catch (\Exception $exception) {
+ } catch (\Exception) {
$functionResult = '';
}
@@ -57,7 +57,7 @@ private function getFunctionArguments(string $functionName, string $input): ?arr
$functionParts = explode($end, $functionParts[1]);
$arguments = explode(',', $functionParts[0]);
- return array_map(function (string $element): string {
+ return array_map(static function (string $element): string {
return trim(trim($element), '\'');
}, $arguments);
}
diff --git a/src/Validator/Constraint/FileMatchesType.php b/src/Validator/Constraint/FileMatchesType.php
index 4da982581..5dbb9b30c 100644
--- a/src/Validator/Constraint/FileMatchesType.php
+++ b/src/Validator/Constraint/FileMatchesType.php
@@ -15,14 +15,11 @@
final class FileMatchesType extends Constraint
{
- /** @var string */
- public $messageImage = 'This file cannot be uploaded as an image';
+ public string $messageImage = 'This file cannot be uploaded as an image';
- /** @var string */
- public $messageVideo = 'This file cannot be uploaded as an video';
+ public string $messageVideo = 'This file cannot be uploaded as an video';
- /** @var string */
- public $field;
+ public string $field;
public function getTargets(): string
{