Skip to content

Commit

Permalink
Fix PHP CS
Browse files Browse the repository at this point in the history
  • Loading branch information
maximehuran committed Jul 13, 2024
1 parent e0b0352 commit eeb1ed9
Show file tree
Hide file tree
Showing 22 changed files with 22 additions and 34 deletions.
4 changes: 2 additions & 2 deletions dist/src/Search/Automapper/TaxonMapperConfiguration.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,9 @@ private function getRealTaxonEntity(TaxonInterface $taxon): TaxonInterface
{
if ($taxon instanceof Proxy) {
// Clear the entity manager to detach the proxy object
$this->entityManager->clear(\get_class($taxon));
$this->entityManager->clear($taxon::class);
// Retrieve the original class name
$entityClassName = ClassUtils::getRealClass(\get_class($taxon));
$entityClassName = ClassUtils::getRealClass($taxon::class);
// Find the object in repository from the ID
/** @var ?TaxonInterface $taxon */
$taxon = $this->entityManager->find($entityClassName, $taxon->getId());
Expand Down
2 changes: 0 additions & 2 deletions generated/Normalizer/ChannelDTONormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@
class ChannelDTONormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface
{
use CheckArray;

use DenormalizerAwareTrait;

use NormalizerAwareTrait;

public function supportsDenormalization($data, $type, $format = null)
Expand Down
2 changes: 0 additions & 2 deletions generated/Normalizer/ImageDTONormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@
class ImageDTONormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface
{
use CheckArray;

use DenormalizerAwareTrait;

use NormalizerAwareTrait;

public function supportsDenormalization($data, $type, $format = null)
Expand Down
6 changes: 2 additions & 4 deletions generated/Normalizer/JaneObjectNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@
class JaneObjectNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface
{
use CheckArray;

use DenormalizerAwareTrait;

use NormalizerAwareTrait;

protected $normalizers = ['MonsieurBiz\\SyliusSearchPlugin\\Generated\\Model\\ImageDTO' => 'MonsieurBiz\\SyliusSearchPlugin\\Generated\\Normalizer\\ImageDTONormalizer', 'MonsieurBiz\\SyliusSearchPlugin\\Generated\\Model\\ChannelDTO' => 'MonsieurBiz\\SyliusSearchPlugin\\Generated\\Normalizer\\ChannelDTONormalizer', 'MonsieurBiz\\SyliusSearchPlugin\\Generated\\Model\\ProductTaxonDTO' => 'MonsieurBiz\\SyliusSearchPlugin\\Generated\\Normalizer\\ProductTaxonDTONormalizer', 'MonsieurBiz\\SyliusSearchPlugin\\Generated\\Model\\TaxonDTO' => 'MonsieurBiz\\SyliusSearchPlugin\\Generated\\Normalizer\\TaxonDTONormalizer', 'MonsieurBiz\\SyliusSearchPlugin\\Generated\\Model\\ProductAttributeDTO' => 'MonsieurBiz\\SyliusSearchPlugin\\Generated\\Normalizer\\ProductAttributeDTONormalizer', 'MonsieurBiz\\SyliusSearchPlugin\\Generated\\Model\\PricingDTO' => 'MonsieurBiz\\SyliusSearchPlugin\\Generated\\Normalizer\\PricingDTONormalizer', '\\Jane\\Component\\JsonSchemaRuntime\\Reference' => '\\MonsieurBiz\\SyliusSearchPlugin\\Generated\\Runtime\\Normalizer\\ReferenceNormalizer'];
Expand All @@ -40,12 +38,12 @@ public function supportsDenormalization($data, $type, $format = null)

public function supportsNormalization($data, $format = null)
{
return \is_object($data) && \array_key_exists(\get_class($data), $this->normalizers);
return \is_object($data) && \array_key_exists($data::class, $this->normalizers);
}

public function normalize($object, $format = null, array $context = [])
{
$normalizerClass = $this->normalizers[\get_class($object)];
$normalizerClass = $this->normalizers[$object::class];
$normalizer = $this->getNormalizer($normalizerClass);

return $normalizer->normalize($object, $format, $context);
Expand Down
2 changes: 0 additions & 2 deletions generated/Normalizer/PricingDTONormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@
class PricingDTONormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface
{
use CheckArray;

use DenormalizerAwareTrait;

use NormalizerAwareTrait;

public function supportsDenormalization($data, $type, $format = null)
Expand Down
2 changes: 0 additions & 2 deletions generated/Normalizer/ProductAttributeDTONormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@
class ProductAttributeDTONormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface
{
use CheckArray;

use DenormalizerAwareTrait;

use NormalizerAwareTrait;

public function supportsDenormalization($data, $type, $format = null)
Expand Down
2 changes: 0 additions & 2 deletions generated/Normalizer/ProductTaxonDTONormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@
class ProductTaxonDTONormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface
{
use CheckArray;

use DenormalizerAwareTrait;

use NormalizerAwareTrait;

public function supportsDenormalization($data, $type, $format = null)
Expand Down
2 changes: 0 additions & 2 deletions generated/Normalizer/TaxonDTONormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@
class TaxonDTONormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface
{
use CheckArray;

use DenormalizerAwareTrait;

use NormalizerAwareTrait;

public function supportsDenormalization($data, $type, $format = null)
Expand Down
3 changes: 2 additions & 1 deletion src/AutoMapper/ProductAttributeValueConfiguration.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
use Psr\Log\NullLogger;
use RuntimeException;
use Sylius\Component\Product\Model\ProductAttributeValueInterface;
use Traversable;

final class ProductAttributeValueConfiguration implements MapperConfigurationInterface, LoggerAwareInterface
{
Expand All @@ -38,7 +39,7 @@ public function __construct(ConfigurationInterface $configuration, iterable $pro
{
$this->logger = new NullLogger();
$this->configuration = $configuration;
$this->productAttributeValueReaders = $productAttributeValueReaders instanceof \Traversable
$this->productAttributeValueReaders = $productAttributeValueReaders instanceof Traversable
? iterator_to_array($productAttributeValueReaders)
: $productAttributeValueReaders;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

namespace MonsieurBiz\SyliusSearchPlugin\AutoMapper\ProductAttributeValueReader;

use DateTime;
use Sylius\Component\Product\Model\ProductAttributeValueInterface;

class DateTimeReader implements ReaderInterface
Expand All @@ -26,7 +27,7 @@ public function getValue(ProductAttributeValueInterface $productAttribute)
}

$productAttributeValue = $productAttribute->getValue();
if ($productAttributeValue instanceof \DateTime) {
if ($productAttributeValue instanceof DateTime) {
$productAttributeValue = $productAttributeValue->format($this->defaultFormat);
}

Expand Down
3 changes: 2 additions & 1 deletion src/Checker/ElasticsearchChecker.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

namespace MonsieurBiz\SyliusSearchPlugin\Checker;

use Exception;
use JoliCode\Elastically\Factory;

class ElasticsearchChecker implements ElasticsearchCheckerInterface
Expand All @@ -34,7 +35,7 @@ public function check(): bool
// Check client response
try {
$client->getStatus()->getResponse();
} catch (\Exception $e) {
} catch (Exception $e) {
$this->isAvailable = false;

return $this->isAvailable;
Expand Down
5 changes: 3 additions & 2 deletions src/Index/Indexer.php
Original file line number Diff line number Diff line change
Expand Up @@ -221,9 +221,10 @@ private function getRealEntity($entity)
}

// Clear the entity manager to detach the proxy object
$this->entityManager->clear(\get_class($entity)); /** @phpstan-ignore-line */
$this->entityManager->clear($entity::class); /** @phpstan-ignore-line */
// Retrieve the original class name
$entityClassName = $this->entityManager->getClassMetadata(\get_class($entity))->rootEntityName;
$entityClassName = $this->entityManager->getClassMetadata($entity::class)->rootEntityName;

// Find the object in repository from the ID
return $this->entityManager->find($entityClassName, $entity->getId());
}
Expand Down
2 changes: 1 addition & 1 deletion src/Message/ProductReindexFromTaxon.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

class ProductReindexFromTaxon
{
//todo rename to ProductReindexFromTaxonId
// todo rename to ProductReindexFromTaxonId

private int $taxonId;

Expand Down
2 changes: 1 addition & 1 deletion src/MessageHandler/ProductReindexFromTaxonHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function __invoke(ProductReindexFromTaxon $message): void
->innerJoin('o.productTaxons', 'productTaxon')
->andWhere('productTaxon.taxon = :taxonId')
->setParameter('taxonId', $message->getTaxonId())->getQuery()->getResult()
;
;

$this->indexer->indexByDocuments(
$documentable,
Expand Down
1 change: 0 additions & 1 deletion src/Model/Documentable/Documentable.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
class Documentable implements PrefixedDocumentableInterface
{
use DocumentableDatasourceTrait;

use DocumentableMappingProviderTrait;

private string $indexCode;
Expand Down
1 change: 0 additions & 1 deletion src/Normalizer/Product/ProductDTONormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
final class ProductDTONormalizer extends ObjectNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface
{
use DenormalizerAwareTrait;

use NormalizerAwareTrait;

private Configuration $automapperConfiguration;
Expand Down
2 changes: 1 addition & 1 deletion src/Repository/ProductAttributeRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@ public function findIsSearchableOrFilterable(): array
->orWhere('o.filterable = true')
->getQuery()
->getResult()
;
;
}
}
2 changes: 1 addition & 1 deletion src/Repository/ProductOptionRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@ public function findIsSearchableOrFilterable(): array
->orWhere('o.filterable = true')
->getQuery()
->getResult()
;
;
}
}
2 changes: 1 addition & 1 deletion src/Search/Request/Aggregation/MainTaxonAggregation.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public function build($aggregation, array $filters)
)
)
)
;
;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Search/Request/Aggregation/PriceAggregation.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public function build($aggregation, array $filters)
)
)
)
;
;
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/Search/Request/Aggregation/ProductOptionAggregation.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ public function build($aggregation, array $filters)

$filters = array_filter($filters, function (AbstractQuery $filter) use ($aggregation): bool {
return !$filter->hasParam('path') || (
false !== strpos($filter->getParam('path'), 'options.')
false !== strpos($filter->getParam('path'), 'options.')
&& 'options.' . $aggregation->getCode() . '.values' !== $filter->getParam('path')
);
);
});

$filterQuery = $qb->query()->bool();
Expand Down
2 changes: 1 addition & 1 deletion src/Search/Request/Aggregation/TaxonsAggregation.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public function build($aggregation, array $filters)
)
)
)
;
;
}

/**
Expand Down

0 comments on commit eeb1ed9

Please sign in to comment.