Add support for Sylius 1.12 and Symfony 6

This commit is contained in:
Michał Pysiak
2022-12-06 07:49:48 +01:00
parent 07502b4ec0
commit bf3c60e885
173 changed files with 1163 additions and 1470 deletions

View File

@@ -21,23 +21,15 @@ jobs:
strategy:
fail-fast: false
matrix:
php: ["7.4", "8.0"]
symfony: ["^4.4", "^5.2"]
sylius: ["~1.9.0", "~1.10.0", "~1.11.0"]
php: ["8.0"]
symfony: ["^5.4", "^6.0"]
sylius: ["~1.11.0", "~1.12.0"]
node: ["14.x"]
mysql: ["8.0"]
exclude:
- sylius: ~1.9.0
php: 8.0
- sylius: ~1.10.0
symfony: ^4.4
# friendsofsymfony/elastica-bundle - package is locking php 7.x
- sylius: ~1.11.0
php: 7.4
symfony: "^6.0"
env:
APP_ENV: test
DATABASE_URL: "mysql://root:root@127.0.0.1/sylius?serverVersion=${{ matrix.mysql }}"
@@ -147,6 +139,11 @@ jobs:
restore-keys: |
${{ runner.os }}-node-${{ matrix.node }}-yarn-
-
name: Copy package.json.dist to package.json
if: matrix.sylius != ''
run: (cd tests/Application && cp package.json.\${{ matrix.sylius }}.dist package.json)
-
name: Install JS dependencies
run: (cd tests/Application && yarn install)

View File

@@ -5,15 +5,15 @@
"license": "MIT",
"require": {
"ext-json": "*",
"php": "^7.4 || ^8.0",
"sylius/sylius": "~1.9.0 || ~1.10.0 || ~1.11.0",
"php": "^8.0",
"sylius/sylius": "~1.11.0 || ~1.12.0",
"friendsofsymfony/elastica-bundle": "^6.0",
"symfony/property-access": "^4.4 || ^5.2",
"symfony/webpack-encore-bundle": "^1.13",
"symfony/proxy-manager-bridge": "^4.4 || ^5.4"
"symfony/property-access": "^5.4 || ^6.0",
"symfony/webpack-encore-bundle": "^1.16",
"symfony/proxy-manager-bridge": "^5.4 || ^6.0"
},
"require-dev": {
"behat/behat": "^3.6.1",
"behat/behat": "^3.7",
"behat/mink-selenium2-driver": "^1.4",
"dmore/behat-chrome-extension": "^1.3",
"dmore/chrome-mink-driver": "^2.7",
@@ -25,7 +25,6 @@
"friends-of-behat/suite-settings-extension": "^1.0",
"friends-of-behat/symfony-extension": "^2.1",
"friends-of-behat/variadic-extension": "^1.3",
"friendsofsymfony/oauth-server-bundle": "^1.6 || >2.0.0-alpha.0 ^2.0@dev",
"phpspec/phpspec": "^7.0",
"phpstan/extension-installer": "^1.0",
"phpstan/phpstan": "0.12.82",
@@ -33,17 +32,20 @@
"phpstan/phpstan-strict-rules": "^0.12.0",
"phpstan/phpstan-webmozart-assert": "0.12.12",
"phpunit/phpunit": "^9.5",
"sensiolabs/security-checker": "^6.0",
"sylius-labs/coding-standard": "^4.0",
"symfony/browser-kit": "^4.4 || ^5.2",
"symfony/debug-bundle": "^4.4 || ^5.2",
"symfony/dotenv": "^4.4 || ^5.2",
"symfony/intl": "^4.4 || ^5.2",
"symfony/web-profiler-bundle": "^4.4 || ^5.2",
"vimeo/psalm": "4.7.1",
"symfony/browser-kit": "^5.4 || ^6.0",
"symfony/debug-bundle": "^5.4 || ^6.0",
"symfony/dotenv": "^5.4 || ^6.0",
"symfony/intl": "^5.4 || ^6.0",
"symfony/web-profiler-bundle": "^5.4 || ^6.0",
"vimeo/psalm": "4.27.0",
"bitbag/coding-standard": "^1.0.1",
"league/flysystem-bundle": "2.4.0",
"polishsymfonycommunity/symfony-mocker-container": "^1.0",
"lchrusciel/api-test-case": "^5.2"
"lchrusciel/api-test-case": "^5.2",
"symfony/mailer": "^5.4 || ^6.0",
"sylius/mailer-bundle": "^1.8 || ^2.0@beta",
"twig/extra-bundle": "^3.4"
},
"conflict": {
"symfony/form": "4.4.11 || 4.4.12"

View File

@@ -70,11 +70,10 @@ final class ListProductsActionSpec extends ObjectBehavior
): void {
$form->getData()->willReturn([]);
$form->isValid()->willReturn(true);
$form->handleRequest($request)->shouldBeCalled();
$form->handleRequest($request)->willReturn($form);
$form->createView()->willReturn($formView);
$formFactory->create(ShopProductsFilterType::class)->willReturn($form);
$request->query = $queryParameters;
$queryParameters->all()->willReturn([]);

View File

@@ -12,6 +12,7 @@ namespace spec\BitBag\SyliusElasticsearchPlugin\Twig\Extension;
use BitBag\SyliusElasticsearchPlugin\Twig\Extension\UnsetArrayElementsExtension;
use PhpSpec\ObjectBehavior;
use Twig\Extension\AbstractExtension;
final class UnsetArrayElementsExtensionSpec extends ObjectBehavior
{
@@ -22,7 +23,7 @@ final class UnsetArrayElementsExtensionSpec extends ObjectBehavior
function it_is_a_twig_extension(): void
{
$this->shouldHaveType(\Twig_Extension::class);
$this->shouldHaveType(AbstractExtension::class);
}
function it_unset_elments(): void

View File

@@ -1,10 +1,12 @@
<?php
/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* another great project.
* You can find more information about us on https://bitbag.io and write us
* an email on hello@bitbag.io.
*/
declare(strict_types=1);
@@ -20,17 +22,13 @@ use Symfony\Component\Routing\RouterInterface;
final class SearchFormEventListener
{
/** @var string */
private $template;
private string $template;
/** @var FormFactoryInterface */
private $formFactory;
private FormFactoryInterface $formFactory;
/** @var RouterInterface */
private $router;
private RouterInterface $router;
/** @var FormInterface */
private $form;
private ?FormInterface $form = null;
public function __construct(
string $template,
@@ -67,7 +65,11 @@ final class SearchFormEventListener
$search = new Search();
}
$this->form = $this->formFactory
->create(SearchType::class, $search, ['action' => $this->router->generate('bitbag_sylius_elasticsearch_plugin_shop_search')]);
->create(
SearchType::class,
$search,
['action' => $this->router->generate('bitbag_sylius_elasticsearch_plugin_shop_search')]
);
}
return $this->form;

View File

@@ -1,12 +1,13 @@
<?php
/*
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* another great project.
* You can find more information about us on https://bitbag.io and write us
* an email on hello@bitbag.io.
*/
This file was created by developers working at BitBag
Do you need more information about us and what we do? Visit our website!
We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
declare(strict_types=1);
namespace BitBag\SyliusElasticsearchPlugin\CompilerPass;

View File

@@ -1,10 +1,12 @@
<?php
/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* another great project.
* You can find more information about us on https://bitbag.io and write us
* an email on hello@bitbag.io.
*/
declare(strict_types=1);
@@ -14,11 +16,9 @@ use BitBag\SyliusElasticsearchPlugin\Finder\ProductAttributesFinderInterface;
final class ProductAttributesContext implements ProductAttributesContextInterface
{
/** @var TaxonContextInterface */
private $taxonContext;
private TaxonContextInterface $taxonContext;
/** @var ProductAttributesFinderInterface */
private $attributesFinder;
private ProductAttributesFinderInterface $attributesFinder;
public function __construct(
TaxonContextInterface $taxonContext,
@@ -31,8 +31,7 @@ final class ProductAttributesContext implements ProductAttributesContextInterfac
public function getAttributes(): ?array
{
$taxon = $this->taxonContext->getTaxon();
$attributes = $this->attributesFinder->findByTaxon($taxon);
return $attributes;
return $this->attributesFinder->findByTaxon($taxon);
}
}

View File

@@ -1,10 +1,12 @@
<?php
/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* another great project.
* You can find more information about us on https://bitbag.io and write us
* an email on hello@bitbag.io.
*/
declare(strict_types=1);

View File

@@ -1,10 +1,12 @@
<?php
/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* another great project.
* You can find more information about us on https://bitbag.io and write us
* an email on hello@bitbag.io.
*/
declare(strict_types=1);
@@ -14,11 +16,9 @@ use BitBag\SyliusElasticsearchPlugin\Finder\ProductOptionsFinderInterface;
final class ProductOptionsContext implements ProductOptionsContextInterface
{
/** @var TaxonContextInterface */
private $taxonContext;
private TaxonContextInterface $taxonContext;
/** @var ProductOptionsFinderInterface */
private $optionsFinder;
private ProductOptionsFinderInterface $optionsFinder;
public function __construct(
TaxonContextInterface $taxonContext,
@@ -31,8 +31,7 @@ final class ProductOptionsContext implements ProductOptionsContextInterface
public function getOptions(): ?array
{
$taxon = $this->taxonContext->getTaxon();
$options = $this->optionsFinder->findByTaxon($taxon);
return $options;
return $this->optionsFinder->findByTaxon($taxon);
}
}

View File

@@ -1,10 +1,12 @@
<?php
/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* another great project.
* You can find more information about us on https://bitbag.io and write us
* an email on hello@bitbag.io.
*/
declare(strict_types=1);

View File

@@ -1,10 +1,12 @@
<?php
/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* another great project.
* You can find more information about us on https://bitbag.io and write us
* an email on hello@bitbag.io.
*/
declare(strict_types=1);
@@ -31,8 +33,7 @@ final class ProductProductAttributesContext implements ProductAttributesContextI
public function getAttributes(): ?array
{
$taxon = $this->taxonContext->getTaxon();
$attributes = $this->attributesFinder->findByTaxon($taxon);
return $attributes;
return $this->attributesFinder->findByTaxon($taxon);
}
}

View File

@@ -1,10 +1,12 @@
<?php
/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* another great project.
* You can find more information about us on https://bitbag.io and write us
* an email on hello@bitbag.io.
*/
declare(strict_types=1);
@@ -18,14 +20,11 @@ use Symfony\Component\HttpFoundation\RequestStack;
final class TaxonContext implements TaxonContextInterface
{
/** @var RequestStack */
private $requestStack;
private RequestStack $requestStack;
/** @var TaxonRepositoryInterface */
private $taxonRepository;
private TaxonRepositoryInterface $taxonRepository;
/** @var LocaleContextInterface */
private $localeContext;
private LocaleContextInterface $localeContext;
public function __construct(
RequestStack $requestStack,

View File

@@ -1,10 +1,12 @@
<?php
/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* another great project.
* You can find more information about us on https://bitbag.io and write us
* an email on hello@bitbag.io.
*/
declare(strict_types=1);

View File

@@ -1,10 +1,12 @@
<?php
/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* another great project.
* You can find more information about us on https://bitbag.io and write us
* an email on hello@bitbag.io.
*/
declare(strict_types=1);
@@ -21,17 +23,13 @@ use Symfony\Component\HttpFoundation\Response;
final class ListProductsByPartialNameAction
{
/** @var NamedProductsFinderInterface */
private $namedProductsFinder;
private NamedProductsFinderInterface $namedProductsFinder;
/** @var TransformerInterface */
private $productSlugTransformer;
private TransformerInterface $productSlugTransformer;
/** @var TransformerInterface */
private $productChannelPriceTransformer;
private TransformerInterface $productChannelPriceTransformer;
/** @var TransformerInterface */
private $productImageTransformer;
private TransformerInterface $productImageTransformer;
public function __construct(
NamedProductsFinderInterface $namedProductsFinder,
@@ -50,7 +48,7 @@ final class ListProductsByPartialNameAction
$itemsResponse = ItemsResponse::createEmpty();
if (null === $request->query->get('query')) {
return JsonResponse::create($itemsResponse->toArray());
return new JsonResponse($itemsResponse->toArray());
}
$products = $this->namedProductsFinder->findByNamePart($request->query->get('query'));
@@ -71,6 +69,6 @@ final class ListProductsByPartialNameAction
));
}
return JsonResponse::create($itemsResponse->toArray());
return new JsonResponse($itemsResponse->toArray());
}
}

View File

@@ -1,10 +1,12 @@
<?php
/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* another great project.
* You can find more information about us on https://bitbag.io and write us
* an email on hello@bitbag.io.
*/
declare(strict_types=1);
@@ -24,23 +26,17 @@ use Twig\Environment;
final class ListProductsAction
{
/** @var FormFactoryInterface */
private $formFactory;
private FormFactoryInterface $formFactory;
/** @var DataHandlerInterface */
private $shopProductListDataHandler;
private DataHandlerInterface $shopProductListDataHandler;
/** @var SortDataHandlerInterface */
private $shopProductsSortDataHandler;
private SortDataHandlerInterface $shopProductsSortDataHandler;
/** @var PaginationDataHandlerInterface */
private $paginationDataHandler;
private PaginationDataHandlerInterface $paginationDataHandler;
/** @var ShopProductsFinderInterface */
private $shopProductsFinder;
private ShopProductsFinderInterface $shopProductsFinder;
/** @var Environment */
private $twig;
private Environment $twig;
public function __construct(
FormFactoryInterface $formFactory,
@@ -91,7 +87,7 @@ final class ListProductsAction
private function clearInvalidEntries(FormInterface $form, array $requestData): array
{
$propertyAccessor = PropertyAccess::createPropertyAccessor();
foreach ($form->getErrors(true, true) as $error) {
foreach ($form->getErrors(true) as $error) {
$errorOrigin = $error->getOrigin();
$propertyAccessor->setValue(
$requestData,

View File

@@ -1,10 +1,12 @@
<?php
/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* another great project.
* You can find more information about us on https://bitbag.io and write us
* an email on hello@bitbag.io.
*/
declare(strict_types=1);
@@ -23,23 +25,17 @@ use Twig\Environment;
final class SearchAction
{
/** @var Environment */
private $twig;
private Environment $twig;
/** @var PaginatedFinderInterface */
private $finder;
private PaginatedFinderInterface $finder;
/** @var SearchFormEventListener */
private $searchFormEventListener;
private SearchFormEventListener $searchFormEventListener;
/** @var RegistryInterface */
private $facetRegistry;
private RegistryInterface $facetRegistry;
/** @var QueryBuilderInterface */
private $searchProductsQueryBuilder;
private QueryBuilderInterface $searchProductsQueryBuilder;
/** @var PaginationDataHandlerInterface */
private $paginationDataHandler;
private PaginationDataHandlerInterface $paginationDataHandler;
public function __construct(
Environment $twig,

View File

@@ -1,10 +1,12 @@
<?php
/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* another great project.
* You can find more information about us on https://bitbag.io and write us
* an email on hello@bitbag.io.
*/
declare(strict_types=1);

View File

@@ -1,10 +1,12 @@
<?php
/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* another great project.
* You can find more information about us on https://bitbag.io and write us
* an email on hello@bitbag.io.
*/
declare(strict_types=1);
@@ -12,8 +14,7 @@ namespace BitBag\SyliusElasticsearchPlugin\Controller\RequestDataHandler;
final class PaginationDataHandler implements PaginationDataHandlerInterface
{
/** @var int */
private $defaultLimit;
private int $defaultLimit;
public function __construct(int $defaultLimit)
{

View File

@@ -1,10 +1,12 @@
<?php
/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* another great project.
* You can find more information about us on https://bitbag.io and write us
* an email on hello@bitbag.io.
*/
declare(strict_types=1);

View File

@@ -1,10 +1,12 @@
<?php
/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* another great project.
* You can find more information about us on https://bitbag.io and write us
* an email on hello@bitbag.io.
*/
declare(strict_types=1);
@@ -20,26 +22,19 @@ use Sylius\Component\Taxonomy\Repository\TaxonRepositoryInterface;
final class ShopProductListDataHandler implements DataHandlerInterface
{
/** @var TaxonRepositoryInterface */
private $taxonRepository;
private TaxonRepositoryInterface $taxonRepository;
/** @var LocaleContextInterface */
private $localeContext;
private LocaleContextInterface $localeContext;
/** @var ProductAttributesFinderInterface */
private $attributesFinder;
private ProductAttributesFinderInterface $attributesFinder;
/** @var string */
private $namePropertyPrefix;
private string $namePropertyPrefix;
/** @var string */
private $taxonsProperty;
private string $taxonsProperty;
/** @var string */
private $optionPropertyPrefix;
private string $optionPropertyPrefix;
/** @var string */
private $attributePropertyPrefix;
private string $attributePropertyPrefix;
public function __construct(
TaxonRepositoryInterface $taxonRepository,

View File

@@ -1,10 +1,12 @@
<?php
/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* another great project.
* You can find more information about us on https://bitbag.io and write us
* an email on hello@bitbag.io.
*/
declare(strict_types=1);
@@ -13,29 +15,23 @@ namespace BitBag\SyliusElasticsearchPlugin\Controller\RequestDataHandler;
use BitBag\SyliusElasticsearchPlugin\Context\TaxonContextInterface;
use BitBag\SyliusElasticsearchPlugin\PropertyNameResolver\ConcatedNameResolverInterface;
use Sylius\Component\Channel\Context\ChannelContextInterface;
use UnexpectedValueException;
final class ShopProductsSortDataHandler implements SortDataHandlerInterface
{
/** @var ConcatedNameResolverInterface */
private $channelPricingNameResolver;
private ConcatedNameResolverInterface $channelPricingNameResolver;
/** @var ChannelContextInterface */
private $channelContext;
private ChannelContextInterface $channelContext;
/** @var TaxonContextInterface */
private $taxonContext;
private TaxonContextInterface $taxonContext;
/** @var ConcatedNameResolverInterface */
private $taxonPositionNameResolver;
private ConcatedNameResolverInterface $taxonPositionNameResolver;
/** @var string */
private $soldUnitsProperty;
private string $soldUnitsProperty;
/** @var string */
private $createdAtProperty;
private string $createdAtProperty;
/** @var string */
private $pricePropertyPrefix;
private string $pricePropertyPrefix;
public function __construct(
ConcatedNameResolverInterface $channelPricingNameResolver,
@@ -67,7 +63,7 @@ final class ShopProductsSortDataHandler implements SortDataHandlerInterface
$availableSorting = [self::SORT_ASC_INDEX, self::SORT_DESC_INDEX];
if (!in_array($orderBy, $availableSorters) || !in_array($sort, $availableSorting)) {
throw new \UnexpectedValueException();
throw new UnexpectedValueException();
}
if ($this->pricePropertyPrefix === $orderBy) {

View File

@@ -1,10 +1,12 @@
<?php
/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* another great project.
* You can find more information about us on https://bitbag.io and write us
* an email on hello@bitbag.io.
*/
declare(strict_types=1);

View File

@@ -1,10 +1,12 @@
<?php
/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* another great project.
* You can find more information about us on https://bitbag.io and write us
* an email on hello@bitbag.io.
*/
declare(strict_types=1);
@@ -12,23 +14,17 @@ namespace BitBag\SyliusElasticsearchPlugin\Controller\Response\DTO;
final class Item
{
/** @var string */
private $taxonName;
private string $taxonName;
/** @var string */
private $name;
private string $name;
/** @var string */
private $description;
private ?string $description;
/** @var string */
private $slug;
private string $slug;
/** @var string */
private $price;
private ?string $price;
/** @var string */
private $image;
private ?string $image;
public function __construct(
string $taxonName,

View File

@@ -1,10 +1,12 @@
<?php
/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* another great project.
* You can find more information about us on https://bitbag.io and write us
* an email on hello@bitbag.io.
*/
declare(strict_types=1);
@@ -15,7 +17,7 @@ use BitBag\SyliusElasticsearchPlugin\Controller\Response\DTO\Item;
final class ItemsResponse
{
/** @var array|Item[] */
private $items;
private array $items;
private function __construct(array $itemsList)
{

View File

@@ -1,10 +1,12 @@
<?php
/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* another great project.
* You can find more information about us on https://bitbag.io and write us
* an email on hello@bitbag.io.
*/
declare(strict_types=1);

View File

@@ -1,17 +1,14 @@
<?php
/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* another great project.
* You can find more information about us on https://bitbag.io and write us
* an email on hello@bitbag.io.
*/
declare(strict_types=1);
/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
namespace BitBag\SyliusElasticsearchPlugin\EventListener;
@@ -24,14 +21,14 @@ use Webmozart\Assert\Assert;
final class OrderProductsListener
{
/** @var ResourceRefresherInterface */
private $resourceRefresher;
private ResourceRefresherInterface $resourceRefresher;
/** @var ObjectPersisterInterface */
private $productPersister;
private ObjectPersisterInterface $productPersister;
public function __construct(ResourceRefresherInterface $resourceRefresher, ObjectPersisterInterface $productPersister)
{
public function __construct(
ResourceRefresherInterface $resourceRefresher,
ObjectPersisterInterface $productPersister
) {
$this->resourceRefresher = $resourceRefresher;
$this->productPersister = $productPersister;
}

View File

@@ -1,10 +1,12 @@
<?php
/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* another great project.
* You can find more information about us on https://bitbag.io and write us
* an email on hello@bitbag.io.
*/
declare(strict_types=1);
@@ -16,14 +18,14 @@ use Sylius\Component\Core\Model\ProductTaxonInterface;
final class ProductTaxonIndexListener
{
/** @var ResourceRefresherInterface */
private $resourceRefresher;
private ResourceRefresherInterface $resourceRefresher;
/** @var ObjectPersisterInterface */
private $objectPersister;
private ObjectPersisterInterface $objectPersister;
public function __construct(ResourceRefresherInterface $resourceRefresher, ObjectPersisterInterface $objectPersister)
{
public function __construct(
ResourceRefresherInterface $resourceRefresher,
ObjectPersisterInterface $objectPersister
) {
$this->resourceRefresher = $resourceRefresher;
$this->objectPersister = $objectPersister;
}

View File

@@ -1,10 +1,12 @@
<?php
/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* another great project.
* You can find more information about us on https://bitbag.io and write us
* an email on hello@bitbag.io.
*/
declare(strict_types=1);
@@ -20,14 +22,11 @@ use Webmozart\Assert\Assert;
final class ResourceIndexListener implements ResourceIndexListenerInterface
{
/** @var ResourceRefresherInterface */
private $resourceRefresher;
private ResourceRefresherInterface $resourceRefresher;
/** @var array */
private $persistersMap;
private array $persistersMap;
/** @var RepositoryInterface */
private $attributeRepository;
private RepositoryInterface $attributeRepository;
public function __construct(
ResourceRefresherInterface $resourceRefresher,

View File

@@ -1,10 +1,12 @@
<?php
/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* another great project.
* You can find more information about us on https://bitbag.io and write us
* an email on hello@bitbag.io.
*/
declare(strict_types=1);

View File

@@ -1,10 +1,12 @@
<?php
/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* another great project.
* You can find more information about us on https://bitbag.io and write us
* an email on hello@bitbag.io.
*/
declare(strict_types=1);

View File

@@ -1,10 +1,12 @@
<?php
/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* another great project.
* You can find more information about us on https://bitbag.io and write us
* an email on hello@bitbag.io.
*/
declare(strict_types=1);
@@ -15,23 +17,21 @@ use Elastica\Aggregation\AbstractAggregation;
use Elastica\Aggregation\Terms;
use Elastica\Query\AbstractQuery;
use Elastica\Query\Terms as TermsQuery;
use RuntimeException;
use function sprintf;
use Sylius\Component\Attribute\Model\AttributeInterface;
use Sylius\Component\Locale\Context\LocaleContextInterface;
use Sylius\Component\Resource\Repository\RepositoryInterface;
final class AttributeFacet implements FacetInterface
{
/** @var ConcatedNameResolverInterface */
private $attributeNameResolver;
private ConcatedNameResolverInterface $attributeNameResolver;
/** @var RepositoryInterface */
private $productAttributeRepository;
private RepositoryInterface $productAttributeRepository;
/** @var string */
private $attributeCode;
private string $attributeCode;
/** @var LocaleContextInterface */
private $localeContext;
private LocaleContextInterface $localeContext;
public function __construct(
ConcatedNameResolverInterface $attributeNameResolver,
@@ -72,7 +72,7 @@ final class AttributeFacet implements FacetInterface
private function getFieldName(): string
{
return \sprintf(
return sprintf(
'%s_%s.keyword',
$this->attributeNameResolver->resolvePropertyName($this->attributeCode),
$this->localeContext->getLocaleCode()
@@ -83,7 +83,7 @@ final class AttributeFacet implements FacetInterface
{
$attribute = $this->productAttributeRepository->findOneBy(['code' => $this->attributeCode]);
if (!$attribute instanceof AttributeInterface) {
throw new \RuntimeException(sprintf('Cannot find attribute with code "%s"', $this->attributeCode));
throw new RuntimeException(sprintf('Cannot find attribute with code "%s"', $this->attributeCode));
}
return $attribute;

View File

@@ -1,10 +1,12 @@
<?php
/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* another great project.
* You can find more information about us on https://bitbag.io and write us
* an email on hello@bitbag.io.
*/
declare(strict_types=1);

View File

@@ -1,10 +1,12 @@
<?php
/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* another great project.
* You can find more information about us on https://bitbag.io and write us
* an email on hello@bitbag.io.
*/
declare(strict_types=1);

View File

@@ -1,10 +1,12 @@
<?php
/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* another great project.
* You can find more information about us on https://bitbag.io and write us
* an email on hello@bitbag.io.
*/
declare(strict_types=1);
@@ -15,19 +17,17 @@ use Elastica\Aggregation\AbstractAggregation;
use Elastica\Aggregation\Terms;
use Elastica\Query\AbstractQuery;
use Elastica\Query\Terms as TermsQuery;
use RuntimeException;
use Sylius\Component\Product\Model\ProductOptionInterface;
use Sylius\Component\Resource\Repository\RepositoryInterface;
final class OptionFacet implements FacetInterface
{
/** @var ConcatedNameResolverInterface */
private $optionNameResolver;
private ConcatedNameResolverInterface $optionNameResolver;
/** @var RepositoryInterface */
private $productOptionRepository;
private RepositoryInterface $productOptionRepository;
/** @var string */
private $productOptionCode;
private string $productOptionCode;
public function __construct(
ConcatedNameResolverInterface $optionNameResolver,
@@ -63,7 +63,7 @@ final class OptionFacet implements FacetInterface
{
$productOption = $this->productOptionRepository->findOneBy(['code' => $this->productOptionCode]);
if (!$productOption instanceof ProductOptionInterface) {
throw new \RuntimeException(sprintf('Cannot find product option with code "%s"', $this->productOptionCode));
throw new RuntimeException(sprintf('Cannot find product option with code "%s"', $this->productOptionCode));
}
return $productOption->getName();

View File

@@ -1,10 +1,12 @@
<?php
/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* another great project.
* You can find more information about us on https://bitbag.io and write us
* an email on hello@bitbag.io.
*/
declare(strict_types=1);
@@ -23,17 +25,13 @@ final class PriceFacet implements FacetInterface
{
public const FACET_ID = 'price';
/** @var ConcatedNameResolverInterface */
private $channelPricingNameResolver;
private ConcatedNameResolverInterface $channelPricingNameResolver;
/** @var MoneyFormatterInterface */
private $moneyFormatter;
private MoneyFormatterInterface $moneyFormatter;
/** @var ShopperContextInterface */
private $shopperContext;
private ShopperContextInterface $shopperContext;
/** @var int */
private $interval;
private int $interval;
public function __construct(
ConcatedNameResolverInterface $channelPricingNameResolver,

View File

@@ -1,10 +1,12 @@
<?php
/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* another great project.
* You can find more information about us on https://bitbag.io and write us
* an email on hello@bitbag.io.
*/
declare(strict_types=1);
@@ -13,7 +15,7 @@ namespace BitBag\SyliusElasticsearchPlugin\Facet;
final class Registry implements RegistryInterface
{
/** @var FacetInterface[] */
private $facets = [];
private array $facets = [];
public function addFacet(string $facetId, FacetInterface $facet): void
{

View File

@@ -1,10 +1,12 @@
<?php
/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* another great project.
* You can find more information about us on https://bitbag.io and write us
* an email on hello@bitbag.io.
*/
declare(strict_types=1);

View File

@@ -1,10 +1,12 @@
<?php
/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* another great project.
* You can find more information about us on https://bitbag.io and write us
* an email on hello@bitbag.io.
*/
declare(strict_types=1);
@@ -21,11 +23,9 @@ final class TaxonFacet implements FacetInterface
{
public const FACET_ID = 'taxon';
/** @var string */
private $taxonsPropertyName;
private string $taxonsPropertyName;
/** @var TaxonRepositoryInterface */
private $taxonRepository;
private TaxonRepositoryInterface $taxonRepository;
public function __construct(TaxonRepositoryInterface $taxonRepository, string $taxonsPropertyName)
{

View File

@@ -1,10 +1,12 @@
<?php
/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* another great project.
* You can find more information about us on https://bitbag.io and write us
* an email on hello@bitbag.io.
*/
declare(strict_types=1);
@@ -15,11 +17,9 @@ use FOS\ElasticaBundle\Finder\FinderInterface;
final class NamedProductsFinder implements NamedProductsFinderInterface
{
/** @var QueryBuilderInterface */
private $productsByPartialNameQueryBuilder;
private QueryBuilderInterface $productsByPartialNameQueryBuilder;
/** @var FinderInterface */
private $productsFinder;
private FinderInterface $productsFinder;
public function __construct(
QueryBuilderInterface $productsByPartialNameQueryBuilder,

View File

@@ -1,10 +1,12 @@
<?php
/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* another great project.
* You can find more information about us on https://bitbag.io and write us
* an email on hello@bitbag.io.
*/
declare(strict_types=1);

View File

@@ -1,10 +1,12 @@
<?php
/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* another great project.
* You can find more information about us on https://bitbag.io and write us
* an email on hello@bitbag.io.
*/
declare(strict_types=1);
@@ -16,14 +18,11 @@ use Sylius\Component\Core\Model\TaxonInterface;
final class ProductAttributesFinder implements ProductAttributesFinderInterface
{
/** @var FinderInterface */
private $attributesFinder;
private FinderInterface $attributesFinder;
/** @var QueryBuilderInterface */
private $attributesByTaxonQueryBuilder;
private QueryBuilderInterface $attributesByTaxonQueryBuilder;
/** @var string */
private $taxonsProperty;
private string $taxonsProperty;
public function __construct(
FinderInterface $attributesFinder,

View File

@@ -1,10 +1,12 @@
<?php
/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* another great project.
* You can find more information about us on https://bitbag.io and write us
* an email on hello@bitbag.io.
*/
declare(strict_types=1);

View File

@@ -1,10 +1,12 @@
<?php
/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* another great project.
* You can find more information about us on https://bitbag.io and write us
* an email on hello@bitbag.io.
*/
declare(strict_types=1);
@@ -16,14 +18,11 @@ use Sylius\Component\Core\Model\TaxonInterface;
final class ProductOptionsFinder implements ProductOptionsFinderInterface
{
/** @var FinderInterface */
private $optionsFinder;
private FinderInterface $optionsFinder;
/** @var QueryBuilderInterface */
private $productOptionsByTaxonQueryBuilder;
private QueryBuilderInterface $productOptionsByTaxonQueryBuilder;
/** @var string */
private $taxonsProperty;
private string $taxonsProperty;
public function __construct(
FinderInterface $optionsFinder,

View File

@@ -1,10 +1,12 @@
<?php
/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* another great project.
* You can find more information about us on https://bitbag.io and write us
* an email on hello@bitbag.io.
*/
declare(strict_types=1);

View File

@@ -1,10 +1,12 @@
<?php
/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* another great project.
* You can find more information about us on https://bitbag.io and write us
* an email on hello@bitbag.io.
*/
declare(strict_types=1);
@@ -19,11 +21,9 @@ use Pagerfanta\Pagerfanta;
final class ShopProductsFinder implements ShopProductsFinderInterface
{
/** @var QueryBuilderInterface */
private $shopProductsQueryBuilder;
private QueryBuilderInterface $shopProductsQueryBuilder;
/** @var PaginatedFinderInterface */
private $productFinder;
private PaginatedFinderInterface $productFinder;
public function __construct(
QueryBuilderInterface $shopProductsQueryBuilder,
@@ -41,8 +41,12 @@ final class ShopProductsFinder implements ShopProductsFinderInterface
$query->addSort($data[SortDataHandlerInterface::SORT_INDEX]);
$products = $this->productFinder->findPaginated($query);
$products->setMaxPerPage($data[PaginationDataHandlerInterface::LIMIT_INDEX]);
$products->setCurrentPage($data[PaginationDataHandlerInterface::PAGE_INDEX]);
if (null !== $data[PaginationDataHandlerInterface::LIMIT_INDEX]) {
$products->setMaxPerPage($data[PaginationDataHandlerInterface::LIMIT_INDEX]);
}
if (null !== $data[PaginationDataHandlerInterface::PAGE_INDEX]) {
$products->setCurrentPage($data[PaginationDataHandlerInterface::PAGE_INDEX]);
}
return $products;
}

View File

@@ -1,10 +1,12 @@
<?php
/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* another great project.
* You can find more information about us on https://bitbag.io and write us
* an email on hello@bitbag.io.
*/
declare(strict_types=1);

View File

@@ -1,10 +1,12 @@
<?php
/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* another great project.
* You can find more information about us on https://bitbag.io and write us
* an email on hello@bitbag.io.
*/
declare(strict_types=1);

View File

@@ -1,10 +1,12 @@
<?php
/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* another great project.
* You can find more information about us on https://bitbag.io and write us
* an email on hello@bitbag.io.
*/
declare(strict_types=1);
@@ -20,20 +22,16 @@ use Sylius\Component\Product\Model\ProductAttributeInterface;
final class ProductAttributesMapper implements ProductAttributesMapperInterface
{
/** @var ProductAttributeValueRepositoryInterface */
private $productAttributeValueRepository;
private ProductAttributeValueRepositoryInterface $productAttributeValueRepository;
/** @var LocaleContextInterface */
private $localeContext;
private LocaleContextInterface $localeContext;
/** @var StringFormatterInterface */
private $stringFormatter;
private StringFormatterInterface $stringFormatter;
/** @var TaxonContextInterface */
private $taxonContext;
private TaxonContextInterface $taxonContext;
/** @var AttributesMapperCollectorInterface[] */
private $attributeMapper;
private iterable $attributeMapper;
public function __construct(
ProductAttributeValueRepositoryInterface $productAttributeValueRepository,

View File

@@ -1,10 +1,12 @@
<?php
/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* another great project.
* You can find more information about us on https://bitbag.io and write us
* an email on hello@bitbag.io.
*/
declare(strict_types=1);

View File

@@ -1,10 +1,12 @@
<?php
/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* another great project.
* You can find more information about us on https://bitbag.io and write us
* an email on hello@bitbag.io.
*/
declare(strict_types=1);
@@ -16,8 +18,7 @@ use Sylius\Component\Product\Model\ProductOptionValueInterface;
final class ProductOptionsMapper implements ProductOptionsMapperInterface
{
/** @var StringFormatterInterface */
private $stringFormatter;
private StringFormatterInterface $stringFormatter;
public function __construct(StringFormatterInterface $stringFormatter)
{
@@ -29,10 +30,13 @@ final class ProductOptionsMapper implements ProductOptionsMapperInterface
$productOptionValues = $productOption->getValues()->toArray();
$choices = [];
array_walk($productOptionValues, function (ProductOptionValueInterface $productOptionValue) use (&$choices): void {
$value = $productOptionValue->getValue();
$choices[$value] = $this->stringFormatter->formatToLowercaseWithoutSpaces($value);
});
array_walk(
$productOptionValues,
function (ProductOptionValueInterface $productOptionValue) use (&$choices): void {
$value = $productOptionValue->getValue();
$choices[$value] = $this->stringFormatter->formatToLowercaseWithoutSpaces($value);
}
);
return $choices;
}

View File

@@ -1,10 +1,12 @@
<?php
/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* another great project.
* You can find more information about us on https://bitbag.io and write us
* an email on hello@bitbag.io.
*/
declare(strict_types=1);

View File

@@ -1,10 +1,12 @@
<?php
/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* another great project.
* You can find more information about us on https://bitbag.io and write us
* an email on hello@bitbag.io.
*/
declare(strict_types=1);

View File

@@ -1,10 +1,12 @@
<?php
/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* another great project.
* You can find more information about us on https://bitbag.io and write us
* an email on hello@bitbag.io.
*/
declare(strict_types=1);
@@ -21,14 +23,14 @@ use Symfony\Component\Validator\Constraints\Type;
final class PriceFilterType extends AbstractFilterType
{
/** @var PriceNameResolverInterface */
private $priceNameResolver;
private PriceNameResolverInterface $priceNameResolver;
/** @var CurrencyContextInterface */
private $currencyContext;
private CurrencyContextInterface $currencyContext;
public function __construct(PriceNameResolverInterface $priceNameResolver, CurrencyContextInterface $currencyContext)
{
public function __construct(
PriceNameResolverInterface $priceNameResolver,
CurrencyContextInterface $currencyContext
) {
$this->priceNameResolver = $priceNameResolver;
$this->currencyContext = $currencyContext;
}

View File

@@ -1,10 +1,12 @@
<?php
/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* another great project.
* You can find more information about us on https://bitbag.io and write us
* an email on hello@bitbag.io.
*/
declare(strict_types=1);
@@ -18,17 +20,13 @@ use Symfony\Component\Form\FormBuilderInterface;
final class ProductAttributesFilterType extends AbstractFilterType
{
/** @var ProductAttributesContextInterface */
private $productAttributesContext;
private ProductAttributesContextInterface $productAttributesContext;
/** @var ConcatedNameResolverInterface */
private $attributeNameResolver;
private ConcatedNameResolverInterface $attributeNameResolver;
/** @var ProductAttributesMapperInterface */
private $productAttributesMapper;
private ProductAttributesMapperInterface $productAttributesMapper;
/** @var array */
protected $excludedAttributes;
protected array $excludedAttributes;
public function __construct(
ProductAttributesContextInterface $productAttributesContext,

View File

@@ -1,10 +1,12 @@
<?php
/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* another great project.
* You can find more information about us on https://bitbag.io and write us
* an email on hello@bitbag.io.
*/
declare(strict_types=1);
@@ -18,14 +20,11 @@ use Symfony\Component\Form\FormBuilderInterface;
final class ProductOptionsFilterType extends AbstractFilterType
{
/** @var ProductOptionsContextInterface */
private $productOptionsContext;
private ProductOptionsContextInterface $productOptionsContext;
/** @var ConcatedNameResolverInterface */
private $optionNameResolver;
private ConcatedNameResolverInterface $optionNameResolver;
/** @var ProductOptionsMapperInterface */
private $productOptionsMapper;
private ProductOptionsMapperInterface $productOptionsMapper;
public function __construct(
ProductOptionsContextInterface $productOptionsContext,

View File

@@ -1,10 +1,12 @@
<?php
/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* another great project.
* You can find more information about us on https://bitbag.io and write us
* an email on hello@bitbag.io.
*/
declare(strict_types=1);

View File

@@ -1,10 +1,12 @@
<?php
/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* another great project.
* You can find more information about us on https://bitbag.io and write us
* an email on hello@bitbag.io.
*/
declare(strict_types=1);
@@ -19,8 +21,7 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
final class SearchFacetsType extends AbstractType
{
/** @var RegistryInterface */
private $facetRegistry;
private RegistryInterface $facetRegistry;
public function __construct(RegistryInterface $facetRegistry)
{

View File

@@ -1,10 +1,12 @@
<?php
/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* another great project.
* You can find more information about us on https://bitbag.io and write us
* an email on hello@bitbag.io.
*/
declare(strict_types=1);
@@ -27,14 +29,11 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
final class SearchType extends AbstractType
{
/** @var PaginatedFinderInterface */
private $finder;
private PaginatedFinderInterface $finder;
/** @var RegistryInterface */
private $facetRegistry;
private RegistryInterface $facetRegistry;
/** @var QueryBuilderInterface */
private $searchProductsQueryBuilder;
private QueryBuilderInterface $searchProductsQueryBuilder;
public function __construct(
PaginatedFinderInterface $finder,

View File

@@ -1,10 +1,12 @@
<?php
/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* another great project.
* You can find more information about us on https://bitbag.io and write us
* an email on hello@bitbag.io.
*/
declare(strict_types=1);
@@ -14,8 +16,7 @@ use Symfony\Component\Form\FormBuilderInterface;
final class ShopProductsFilterType extends AbstractFilterType
{
/** @var string */
private $namePropertyPrefix;
private string $namePropertyPrefix;
public function __construct(string $namePropertyPrefix)
{

View File

@@ -1,10 +1,12 @@
<?php
/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* another great project.
* You can find more information about us on https://bitbag.io and write us
* an email on hello@bitbag.io.
*/
declare(strict_types=1);

View File

@@ -1,10 +1,12 @@
<?php
/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* another great project.
* You can find more information about us on https://bitbag.io and write us
* an email on hello@bitbag.io.
*/
declare(strict_types=1);

View File

@@ -1,10 +1,12 @@
<?php
/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* another great project.
* You can find more information about us on https://bitbag.io and write us
* an email on hello@bitbag.io.
*/
declare(strict_types=1);

View File

@@ -1,10 +1,12 @@
<?php
/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* another great project.
* You can find more information about us on https://bitbag.io and write us
* an email on hello@bitbag.io.
*/
declare(strict_types=1);

View File

@@ -1,10 +1,12 @@
<?php
/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* another great project.
* You can find more information about us on https://bitbag.io and write us
* an email on hello@bitbag.io.
*/
declare(strict_types=1);
@@ -12,11 +14,9 @@ namespace BitBag\SyliusElasticsearchPlugin\Model;
class Search
{
/** @var SearchBox|null */
private $box;
private ?SearchBox $box;
/** @var SearchFacets|null */
private $facets;
private ?SearchFacets $facets;
public function __construct()
{

View File

@@ -1,10 +1,12 @@
<?php
/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* another great project.
* You can find more information about us on https://bitbag.io and write us
* an email on hello@bitbag.io.
*/
declare(strict_types=1);
@@ -12,8 +14,7 @@ namespace BitBag\SyliusElasticsearchPlugin\Model;
class SearchBox
{
/** @var string|null */
private $query;
private ?string $query = null;
public function getQuery(): ?string
{

View File

@@ -1,19 +1,22 @@
<?php
/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* another great project.
* You can find more information about us on https://bitbag.io and write us
* an email on hello@bitbag.io.
*/
declare(strict_types=1);
namespace BitBag\SyliusElasticsearchPlugin\Model;
class SearchFacets implements \Iterator
use Iterator;
class SearchFacets implements Iterator
{
/** @var array[] */
private $selectedBuckets = [];
private array $selectedBuckets = [];
public function __get(string $facetId)
{
@@ -61,7 +64,7 @@ class SearchFacets implements \Iterator
/**
* @inheritdoc
*/
public function valid()
public function valid(): bool
{
$key = key($this->selectedBuckets);

View File

@@ -1,10 +1,12 @@
<?php
/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* another great project.
* You can find more information about us on https://bitbag.io and write us
* an email on hello@bitbag.io.
*/
declare(strict_types=1);

View File

@@ -1,10 +1,12 @@
<?php
/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* another great project.
* You can find more information about us on https://bitbag.io and write us
* an email on hello@bitbag.io.
*/
declare(strict_types=1);
@@ -14,17 +16,16 @@ use BitBag\SyliusElasticsearchPlugin\Formatter\StringFormatterInterface;
use BitBag\SyliusElasticsearchPlugin\PropertyNameResolver\ConcatedNameResolverInterface;
use Elastica\Document;
use FOS\ElasticaBundle\Event\PostTransformEvent;
use function sprintf;
use Sylius\Component\Attribute\Model\AttributeInterface;
use Sylius\Component\Core\Model\ProductInterface;
use Sylius\Component\Product\Model\ProductAttributeValue;
final class AttributeBuilder extends AbstractBuilder
{
/** @var ConcatedNameResolverInterface */
private $attributeNameResolver;
private ConcatedNameResolverInterface $attributeNameResolver;
/** @var StringFormatterInterface */
private $stringFormatter;
private StringFormatterInterface $stringFormatter;
public function __construct(
ConcatedNameResolverInterface $attributeNameResolver,
@@ -79,7 +80,8 @@ final class AttributeBuilder extends AbstractBuilder
$attributes[] = $this->stringFormatter->formatToLowercaseWithoutSpaces((string) $singleElement);
}
} else {
$attributeValue = is_string($attributeValue) ? $this->stringFormatter->formatToLowercaseWithoutSpaces($attributeValue) : $attributeValue;
$attributeValue = is_string($attributeValue)
? $this->stringFormatter->formatToLowercaseWithoutSpaces($attributeValue) : $attributeValue;
$attributes[] = $attributeValue;
}
@@ -96,7 +98,7 @@ final class AttributeBuilder extends AbstractBuilder
$value = $productAttribute->getValue();
$documentKey = $this->attributeNameResolver->resolvePropertyName($attributeCode);
$code = \sprintf('%s_%s', $documentKey, $productAttribute->getLocaleCode());
$code = sprintf('%s_%s', $documentKey, $productAttribute->getLocaleCode());
$values = $this->resolveProductAttribute(
$attributeConfiguration,

View File

@@ -1,10 +1,12 @@
<?php
/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* another great project.
* You can find more information about us on https://bitbag.io and write us
* an email on hello@bitbag.io.
*/
declare(strict_types=1);
@@ -18,17 +20,13 @@ use Sylius\Component\Product\Model\ProductAttributeInterface;
final class AttributeTaxonsBuilder extends AbstractBuilder
{
/** @var TaxonRepositoryInterface */
protected $taxonRepository;
protected TaxonRepositoryInterface $taxonRepository;
/** @var string */
private $taxonsProperty;
private string $taxonsProperty;
/** @var array */
private $excludedAttributes;
private array $excludedAttributes;
/** @var bool */
private $includeAllDescendants;
private bool $includeAllDescendants;
public function __construct(
TaxonRepositoryInterface $taxonRepository,

View File

@@ -1,10 +1,12 @@
<?php
/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* another great project.
* You can find more information about us on https://bitbag.io and write us
* an email on hello@bitbag.io.
*/
declare(strict_types=1);
@@ -18,8 +20,7 @@ use Sylius\Component\Core\Model\ProductVariantInterface;
final class ChannelPricingBuilder extends AbstractBuilder
{
/** @var ConcatedNameResolverInterface */
private $channelPricingNameResolver;
private ConcatedNameResolverInterface $channelPricingNameResolver;
public function __construct(ConcatedNameResolverInterface $channelPricingNameResolver)
{
@@ -40,7 +41,8 @@ final class ChannelPricingBuilder extends AbstractBuilder
$productVariant = $product->getVariants()->first();
foreach ($productVariant->getChannelPricings() as $channelPricing) {
$propertyName = $this->channelPricingNameResolver->resolvePropertyName($channelPricing->getChannelCode());
$propertyName = $this->channelPricingNameResolver
->resolvePropertyName($channelPricing->getChannelCode());
$document->set($propertyName, $channelPricing->getPrice());
}

View File

@@ -1,10 +1,12 @@
<?php
/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* another great project.
* You can find more information about us on https://bitbag.io and write us
* an email on hello@bitbag.io.
*/
declare(strict_types=1);
@@ -16,8 +18,7 @@ use Sylius\Component\Core\Model\ProductInterface;
final class ChannelsBuilder extends AbstractBuilder
{
/** @var string */
private $channelsProperty;
private string $channelsProperty;
public function __construct(string $channelsProperty)
{

View File

@@ -1,10 +1,12 @@
<?php
/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* another great project.
* You can find more information about us on https://bitbag.io and write us
* an email on hello@bitbag.io.
*/
declare(strict_types=1);
@@ -14,8 +16,7 @@ use Sylius\Component\Core\Model\ProductInterface;
final class ProductTaxonsMapper implements ProductTaxonsMapperInterface
{
/** @var bool */
private $includeAllDescendants;
private bool $includeAllDescendants;
public function __construct(bool $includeAllDescendants)
{

View File

@@ -1,10 +1,12 @@
<?php
/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* another great project.
* You can find more information about us on https://bitbag.io and write us
* an email on hello@bitbag.io.
*/
declare(strict_types=1);

View File

@@ -1,10 +1,12 @@
<?php
/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* another great project.
* You can find more information about us on https://bitbag.io and write us
* an email on hello@bitbag.io.
*/
declare(strict_types=1);
@@ -18,14 +20,14 @@ use Sylius\Component\Core\Model\ProductInterface;
final class OptionBuilder extends AbstractBuilder
{
/** @var ConcatedNameResolverInterface */
private $optionNameResolver;
private ConcatedNameResolverInterface $optionNameResolver;
/** @var StringFormatterInterface */
private $stringFormatter;
private StringFormatterInterface $stringFormatter;
public function __construct(ConcatedNameResolverInterface $optionNameResolver, StringFormatterInterface $stringFormatter)
{
public function __construct(
ConcatedNameResolverInterface $optionNameResolver,
StringFormatterInterface $stringFormatter
) {
$this->optionNameResolver = $optionNameResolver;
$this->stringFormatter = $stringFormatter;
}

View File

@@ -1,10 +1,12 @@
<?php
/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* another great project.
* You can find more information about us on https://bitbag.io and write us
* an email on hello@bitbag.io.
*/
declare(strict_types=1);
@@ -20,20 +22,15 @@ use Sylius\Component\Resource\Repository\RepositoryInterface;
final class OptionTaxonsBuilder extends AbstractBuilder
{
/** @var RepositoryInterface */
private $productOptionValueRepository;
private RepositoryInterface $productOptionValueRepository;
/** @var ProductVariantRepositoryInterface */
private $productVariantRepository;
private ProductVariantRepositoryInterface $productVariantRepository;
/** @var ProductTaxonsMapperInterface */
private $productTaxonsMapper;
private ProductTaxonsMapperInterface $productTaxonsMapper;
/** @var string */
private $taxonsProperty;
private string $taxonsProperty;
/** @var array */
private $excludedOptions;
private array $excludedOptions;
public function __construct(
RepositoryInterface $productOptionValueRepository,

View File

@@ -1,10 +1,12 @@
<?php
/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* another great project.
* You can find more information about us on https://bitbag.io and write us
* an email on hello@bitbag.io.
*/
declare(strict_types=1);

View File

@@ -1,10 +1,12 @@
<?php
/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* another great project.
* You can find more information about us on https://bitbag.io and write us
* an email on hello@bitbag.io.
*/
declare(strict_types=1);
@@ -16,8 +18,7 @@ use Sylius\Component\Core\Model\ProductInterface;
final class ProductCreatedAtPropertyBuilder extends AbstractBuilder
{
/** @var string */
private $createdAtProperty;
private string $createdAtProperty;
public function __construct(string $createdAtProperty)
{

View File

@@ -1,10 +1,12 @@
<?php
/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* another great project.
* You can find more information about us on https://bitbag.io and write us
* an email on hello@bitbag.io.
*/
declare(strict_types=1);
@@ -18,8 +20,7 @@ use Sylius\Component\Core\Model\ProductTranslationInterface;
final class ProductDescriptionBuilder extends AbstractBuilder
{
/** @var ConcatedNameResolverInterface */
private $productDescriptionNameResolver;
private ConcatedNameResolverInterface $productDescriptionNameResolver;
public function __construct(ConcatedNameResolverInterface $productDescriptionNameResolver)
{

View File

@@ -1,10 +1,12 @@
<?php
/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* another great project.
* You can find more information about us on https://bitbag.io and write us
* an email on hello@bitbag.io.
*/
declare(strict_types=1);
@@ -18,8 +20,7 @@ use Sylius\Component\Core\Model\ProductTranslationInterface;
final class ProductNameBuilder extends AbstractBuilder
{
/** @var ConcatedNameResolverInterface */
private $productNameNameResolver;
private ConcatedNameResolverInterface $productNameNameResolver;
public function __construct(ConcatedNameResolverInterface $productNameNameResolver)
{
@@ -34,7 +35,8 @@ final class ProductNameBuilder extends AbstractBuilder
function (ProductInterface $product, Document $document): void {
/** @var ProductTranslationInterface $productTranslation */
foreach ($product->getTranslations() as $productTranslation) {
$propertyName = $this->productNameNameResolver->resolvePropertyName($productTranslation->getLocale());
$propertyName = $this->productNameNameResolver
->resolvePropertyName($productTranslation->getLocale());
$document->set($propertyName, $productTranslation->getName());
}

View File

@@ -1,10 +1,12 @@
<?php
/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* another great project.
* You can find more information about us on https://bitbag.io and write us
* an email on hello@bitbag.io.
*/
declare(strict_types=1);
@@ -18,8 +20,7 @@ use Sylius\Component\Core\Model\ProductTranslationInterface;
final class ProductShortDescriptionBuilder extends AbstractBuilder
{
/** @var ConcatedNameResolverInterface */
private $productShortDescriptionNameResolver;
private ConcatedNameResolverInterface $productShortDescriptionNameResolver;
public function __construct(ConcatedNameResolverInterface $productShortDescriptionNameResolver)
{

View File

@@ -1,10 +1,12 @@
<?php
/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* another great project.
* You can find more information about us on https://bitbag.io and write us
* an email on hello@bitbag.io.
*/
declare(strict_types=1);
@@ -17,8 +19,7 @@ use Sylius\Component\Core\Model\ProductInterface;
final class ProductTaxonPositionPropertyBuilder extends AbstractBuilder
{
/** @var ConcatedNameResolverInterface */
private $taxonPositionNameResolver;
private ConcatedNameResolverInterface $taxonPositionNameResolver;
public function __construct(ConcatedNameResolverInterface $taxonPositionNameResolver)
{

View File

@@ -1,10 +1,12 @@
<?php
/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* another great project.
* You can find more information about us on https://bitbag.io and write us
* an email on hello@bitbag.io.
*/
declare(strict_types=1);
@@ -17,11 +19,9 @@ use Sylius\Component\Core\Model\ProductInterface;
final class ProductTaxonsBuilder extends AbstractBuilder
{
/** @var ProductTaxonsMapperInterface */
private $productTaxonsMapper;
private ProductTaxonsMapperInterface $productTaxonsMapper;
/** @var string */
private $taxonsProperty;
private string $taxonsProperty;
public function __construct(ProductTaxonsMapperInterface $productTaxonsMapper, string $taxonsProperty)
{

View File

@@ -1,10 +1,12 @@
<?php
/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* another great project.
* You can find more information about us on https://bitbag.io and write us
* an email on hello@bitbag.io.
*/
declare(strict_types=1);

View File

@@ -1,10 +1,12 @@
<?php
/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* another great project.
* You can find more information about us on https://bitbag.io and write us
* an email on hello@bitbag.io.
*/
declare(strict_types=1);
@@ -17,11 +19,9 @@ use Sylius\Component\Core\Model\ProductInterface;
final class SoldUnitsPropertyBuilder extends AbstractBuilder
{
/** @var OrderItemRepositoryInterface */
private $orderItemRepository;
private OrderItemRepositoryInterface $orderItemRepository;
/** @var string */
private $soldUnitsProperty;
private string $soldUnitsProperty;
public function __construct(OrderItemRepositoryInterface $orderItemRepository, string $soldUnitsProperty)
{

View File

@@ -1,10 +1,12 @@
<?php
/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* another great project.
* You can find more information about us on https://bitbag.io and write us
* an email on hello@bitbag.io.
*/
declare(strict_types=1);
@@ -12,8 +14,7 @@ namespace BitBag\SyliusElasticsearchPlugin\PropertyNameResolver;
final class ConcatedNameResolver implements ConcatedNameResolverInterface
{
/** @var string */
private $propertyPrefix;
private string $propertyPrefix;
public function __construct(string $propertyPrefix)
{

View File

@@ -1,10 +1,12 @@
<?php
/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* another great project.
* You can find more information about us on https://bitbag.io and write us
* an email on hello@bitbag.io.
*/
declare(strict_types=1);

View File

@@ -1,10 +1,12 @@
<?php
/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* another great project.
* You can find more information about us on https://bitbag.io and write us
* an email on hello@bitbag.io.
*/
declare(strict_types=1);
@@ -12,8 +14,7 @@ namespace BitBag\SyliusElasticsearchPlugin\PropertyNameResolver;
final class PriceNameResolver implements PriceNameResolverInterface
{
/** @var string */
private $pricePropertyPrefix;
private string $pricePropertyPrefix;
public function __construct(string $pricePropertyPrefix)
{

View File

@@ -1,10 +1,12 @@
<?php
/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* another great project.
* You can find more information about us on https://bitbag.io and write us
* an email on hello@bitbag.io.
*/
declare(strict_types=1);

View File

@@ -1,10 +1,12 @@
<?php
/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* another great project.
* You can find more information about us on https://bitbag.io and write us
* an email on hello@bitbag.io.
*/
declare(strict_types=1);
@@ -13,7 +15,7 @@ namespace BitBag\SyliusElasticsearchPlugin\PropertyNameResolver;
final class SearchPropertyNameResolverRegistry implements SearchPropertyNameResolverRegistryInterface
{
/** @var ConcatedNameResolverInterface[] */
private $propertyNameResolvers = [];
private array $propertyNameResolvers = [];
public function addPropertyNameResolver(ConcatedNameResolverInterface $propertyNameResolver): void
{

View File

@@ -1,10 +1,12 @@
<?php
/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* another great project.
* You can find more information about us on https://bitbag.io and write us
* an email on hello@bitbag.io.
*/
declare(strict_types=1);

View File

@@ -13,6 +13,7 @@ namespace BitBag\SyliusElasticsearchPlugin\QueryBuilder\AttributesQueryBuilder;
use Elastica\Query\BoolQuery;
use Elastica\Query\Term;
use function sprintf;
class AttributesTypeDateQueryBuilder implements AttributesQueryBuilderCollectorInterface
{
@@ -32,7 +33,7 @@ class AttributesTypeDateQueryBuilder implements AttributesQueryBuilderCollectorI
foreach ((array) $data['attribute_values'] as $attributeValue) {
$termQuery = new Term();
$attribute = \sprintf('%s_%s.date.keyword', $data['attribute'], $localCode);
$attribute = sprintf('%s_%s.date.keyword', $data['attribute'], $localCode);
$termQuery->setTerm($attribute, $attributeValue);
$attributeQuery->addShould($termQuery);
}

View File

@@ -13,6 +13,7 @@ namespace BitBag\SyliusElasticsearchPlugin\QueryBuilder\AttributesQueryBuilder;
use Elastica\Query\BoolQuery;
use Elastica\Query\Term;
use function sprintf;
class AttributesTypeNumberQueryBuilder implements AttributesQueryBuilderCollectorInterface
{
@@ -33,7 +34,7 @@ class AttributesTypeNumberQueryBuilder implements AttributesQueryBuilderCollecto
foreach ((array) $data['attribute_values'] as $attributeValue) {
$termQuery = new Term();
$attribute = \sprintf('%s_%s', $data['attribute'], $localCode);
$attribute = sprintf('%s_%s', $data['attribute'], $localCode);
$termQuery->setTerm($attribute, $attributeValue);
$attributeQuery->addShould($termQuery);
}

View File

@@ -13,6 +13,7 @@ namespace BitBag\SyliusElasticsearchPlugin\QueryBuilder\AttributesQueryBuilder;
use Elastica\Query\BoolQuery;
use Elastica\Query\Term;
use function sprintf;
class AttributesTypeTextQueryBuilder implements AttributesQueryBuilderCollectorInterface
{
@@ -33,7 +34,7 @@ class AttributesTypeTextQueryBuilder implements AttributesQueryBuilderCollectorI
foreach ((array) $data['attribute_values'] as $attributeValue) {
$termQuery = new Term();
$attribute = \sprintf('%s_%s.keyword', $data['attribute'], $localCode);
$attribute = sprintf('%s_%s.keyword', $data['attribute'], $localCode);
$termQuery->setTerm($attribute, $attributeValue);
$attributeQuery->addShould($termQuery);
}

View File

@@ -1,10 +1,12 @@
<?php
/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* another great project.
* You can find more information about us on https://bitbag.io and write us
* an email on hello@bitbag.io.
*/
declare(strict_types=1);
@@ -17,14 +19,11 @@ use Sylius\Component\Locale\Context\LocaleContextInterface;
final class ContainsNameQueryBuilder implements QueryBuilderInterface
{
/** @var LocaleContextInterface */
private $localeContext;
private LocaleContextInterface $localeContext;
/** @var ConcatedNameResolverInterface */
private $productNameNameResolver;
private ConcatedNameResolverInterface $productNameNameResolver;
/** @var string */
private $namePropertyPrefix;
private string $namePropertyPrefix;
public function __construct(
LocaleContextInterface $localeContext,

View File

@@ -1,10 +1,12 @@
<?php
/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* another great project.
* You can find more information about us on https://bitbag.io and write us
* an email on hello@bitbag.io.
*/
declare(strict_types=1);
@@ -17,13 +19,12 @@ use Sylius\Component\Locale\Context\LocaleContextInterface;
final class HasAttributesQueryBuilder implements QueryBuilderInterface
{
private $localeContext;
private LocaleContextInterface $localeContext;
/** @var ProductAttributeRepositoryInterface */
private $productAttributeRepository;
private ProductAttributeRepositoryInterface $productAttributeRepository;
/** @var AttributesQueryBuilderCollectorInterface[] */
private $attributeDriver;
private iterable $attributeDriver;
public function __construct(
LocaleContextInterface $localeContext,

View File

@@ -1,10 +1,12 @@
<?php
/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* another great project.
* You can find more information about us on https://bitbag.io and write us
* an email on hello@bitbag.io.
*/
declare(strict_types=1);
@@ -16,11 +18,9 @@ use Sylius\Component\Channel\Context\ChannelContextInterface;
final class HasChannelQueryBuilder implements QueryBuilderInterface
{
/** @var ChannelContextInterface */
private $channelContext;
private ChannelContextInterface $channelContext;
/** @var string */
private $channelsProperty;
private string $channelsProperty;
public function __construct(ChannelContextInterface $channelContext, string $channelsProperty)
{

View File

@@ -1,10 +1,12 @@
<?php
/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* another great project.
* You can find more information about us on https://bitbag.io and write us
* an email on hello@bitbag.io.
*/
declare(strict_types=1);

View File

@@ -1,10 +1,12 @@
<?php
/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* another great project.
* You can find more information about us on https://bitbag.io and write us
* an email on hello@bitbag.io.
*/
declare(strict_types=1);
@@ -14,6 +16,7 @@ use BitBag\SyliusElasticsearchPlugin\PropertyNameResolver\ConcatedNameResolverIn
use BitBag\SyliusElasticsearchPlugin\PropertyNameResolver\PriceNameResolverInterface;
use Elastica\Query\AbstractQuery;
use Elastica\Query\Range;
use NumberFormatter;
use Sylius\Bundle\MoneyBundle\Form\DataTransformer\SyliusMoneyTransformer;
use Sylius\Component\Channel\Context\ChannelContextInterface;
use Sylius\Component\Core\Model\ChannelInterface;
@@ -22,20 +25,15 @@ use Sylius\Component\Currency\Converter\CurrencyConverterInterface;
final class HasPriceBetweenQueryBuilder implements QueryBuilderInterface
{
/** @var ConcatedNameResolverInterface */
private $channelPricingNameResolver;
private ConcatedNameResolverInterface $channelPricingNameResolver;
/** @var PriceNameResolverInterface */
private $priceNameResolver;
private PriceNameResolverInterface $priceNameResolver;
/** @var ChannelContextInterface */
private $channelContext;
private ChannelContextInterface $channelContext;
/** @var CurrencyContextInterface */
private $currencyContext;
private CurrencyContextInterface $currencyContext;
/** @var CurrencyConverterInterface */
private $currencyConverter;
private CurrencyConverterInterface $currencyConverter;
public function __construct(
PriceNameResolverInterface $priceNameResolver,
@@ -91,7 +89,7 @@ final class HasPriceBetweenQueryBuilder implements QueryBuilderInterface
private function convertFromString(string $price): int
{
$transformer = new SyliusMoneyTransformer(2, false, SyliusMoneyTransformer::ROUND_HALF_UP, 100);
$transformer = new SyliusMoneyTransformer(2, false, NumberFormatter::ROUND_HALFUP, 100);
return $transformer->reverseTransform($price);
}

View File

@@ -1,10 +1,12 @@
<?php
/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* another great project.
* You can find more information about us on https://bitbag.io and write us
* an email on hello@bitbag.io.
*/
declare(strict_types=1);
@@ -15,8 +17,7 @@ use Elastica\Query\Terms;
final class HasTaxonQueryBuilder implements QueryBuilderInterface
{
/** @var string */
private $taxonsProperty;
private string $taxonsProperty;
public function __construct(string $taxonsProperty)
{

View File

@@ -1,10 +1,12 @@
<?php
/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* another great project.
* You can find more information about us on https://bitbag.io and write us
* an email on hello@bitbag.io.
*/
declare(strict_types=1);
@@ -15,8 +17,7 @@ use Elastica\Query\Term;
final class IsEnabledQueryBuilder implements QueryBuilderInterface
{
/** @var string */
private $enabledProperty;
private string $enabledProperty;
public function __construct(string $enabledProperty)
{

Some files were not shown because too many files have changed in this diff Show More