Skip to content

Commit

Permalink
making changes to the edited code during refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
patryk authored and christopherhero committed Aug 22, 2022
1 parent 6c3d333 commit 4394ca4
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/Checker/Rule/Elasticsearch/AttributeRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ public function __construct(
$this->attributeNameResolver = $attributeNameResolver;
}

/* @phpstan-ignore-next-line Elastica\Query\Term Class extended by Elastica\Query\AbstractQuery*/
public function createSubquery(array $configuration): AbstractQuery
{
/** @var AttributeInterface $attribute */
Expand All @@ -51,6 +50,7 @@ public function createSubquery(array $configuration): AbstractQuery
$term = new Term();
$term->setTerm($paramName, $value);

/* @phpstan-ignore-next-line Elastica\Query\Term Class extended by Elastica\Query\AbstractQuery*/
return $term;
}
}
2 changes: 1 addition & 1 deletion src/Checker/Rule/Elasticsearch/PriceRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ public function __construct(
$this->propertyNameResolver = $propertyNameResolver;
}

/* @phpstan-ignore-next-line Elastica\Query\Range Class extended by Elastica\Query\AbstractQuery*/
public function createSubquery(array $configuration): AbstractQuery
{
/** @var string|null $currentChannel */
Expand Down Expand Up @@ -68,6 +67,7 @@ public function createSubquery(array $configuration): AbstractQuery
'lte' => $maxPrice,
]);

/* @phpstan-ignore-next-line Elastica\Query\Range Class extended by Elastica\Query\AbstractQuery*/
return $rangeQuery;
}
}
2 changes: 1 addition & 1 deletion src/Checker/Rule/Elasticsearch/ProductNameRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ public function __construct(
$this->productNameNameResolver = $productNameNameResolver;
}

/* @phpstan-ignore-next-line Elastica\Query\MatchQuery Class extended by Elastica\Query\AbstractQuery*/
public function createSubquery(array $configuration): AbstractQuery
{
$name = $configuration['catalogName'];
Expand All @@ -39,6 +38,7 @@ public function createSubquery(array $configuration): AbstractQuery
$nameQuery = new MatchQuery($propertyName, $name);
$nameQuery->setFieldQuery($propertyName, $name);

/* @phpstan-ignore-next-line Elastica\Query\MatchQuery Class extended by Elastica\Query\AbstractQuery*/
return $nameQuery;
}
}
2 changes: 1 addition & 1 deletion src/Checker/Rule/Elasticsearch/TaxonRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ public function __construct(string $taxonsProperty)
$this->taxonsProperty = $taxonsProperty;
}

/* @phpstan-ignore-next-line Elastica\Query\Terms Class extended by Elastica\Query\AbstractQuery*/
public function createSubquery(array $configuration): AbstractQuery
{
$taxonsCodes = array_map(
Expand All @@ -33,6 +32,7 @@ function (Taxon $taxon) {
$configuration['taxons']->toArray()
);

/* @phpstan-ignore-next-line Elastica\Query\Terms Class extended by Elastica\Query\AbstractQuery*/
return new Terms($this->taxonsProperty, $taxonsCodes);
}
}
6 changes: 3 additions & 3 deletions src/Fixture/Factory/CatalogFixtureFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,15 @@ private function createCatalog(string $code, array $catalogData): void
$catalog = $this->catalogFactory->createNew();
$catalog->setCode($code);

if (0 !== count($catalogData['starts_at'])) {
if (0 !== strlen(trim($catalogData['starts_at']))) {
$catalog->setStartDate(new \DateTime($catalogData['starts_at']));
}

if (0 !== count($catalogData['ends_at'])) {
if (0 !== strlen(trim($catalogData['ends_at']))) {
$catalog->setEndDate(new \DateTime($catalogData['ends_at']));
}

if (0 !== count($catalogData['template'])) {
if (0 !== strlen(trim($catalogData['template']))) {
$catalog->setTemplate($catalogData['template']);
}

Expand Down
3 changes: 1 addition & 2 deletions src/Resolver/CatalogsForProductResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ public function resolveProductCatalogs(ProductInterface $product, \DateTimeImmut
/** @var Collection<int, CatalogRuleInterface> $rules */
$rules = $activeCatalog->getProductAssociationRules();

/** @var QueryBuilder $qb */
$qb = $this->productRepository->createQueryBuilder('p')
$qb = $this->productRepository->createQueryBuilder('p') /** @phpstan-ignore-line ProductRepository inherits the createQueryBuilder method from EntityRepository*/
->select('count(p.code)')
->leftJoin('p.translations', 'name')
->leftJoin('p.variants', 'variant')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public function findMatchingProducts(CatalogInterface $catalog): array
}

if ((bool) $catalog->getRules()->count()) {
/** @var BoolQuery $query */
$query = $this->productQueryBuilder->findMatchingProductsQuery($catalog->getConnectingRules(), $catalog->getRules());
}

Expand Down

0 comments on commit 4394ca4

Please sign in to comment.