Skip to content

Commit

Permalink
chore: fix code style due to core dependency updates
Browse files Browse the repository at this point in the history
  • Loading branch information
mitelg committed Sep 21, 2023
1 parent 03d33c1 commit 40792cf
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 13 deletions.
15 changes: 8 additions & 7 deletions Components/DbAdapters/Products/ConfiguratorWriter.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,16 +156,15 @@ private function getSetIdBySetName(string $name): ?int
return $this->sets[$name] ? (int) $this->sets[$name] : null;
}

/**
* @return int
*/
private function getGroupIdByGroupName(string $name): ?int
{
$sql = 'SELECT `id`
FROM s_article_configurator_groups
WHERE `name` = ?';

return (int) $this->connection->fetchOne($sql, [$name]) ?: null;
$id = $this->connection->fetchOne($sql, [$name]);

return $id ? (int) $id : null;
}

private function getOptionIdByOptionNameAndGroupId(string $optionName, int $groupId): ?int
Expand All @@ -174,7 +173,9 @@ private function getOptionIdByOptionNameAndGroupId(string $optionName, int $grou
FROM s_article_configurator_options
WHERE `name` = ? AND `group_id` = ?';

return (int) $this->db->fetchOne($sql, [$optionName, $groupId]) ?: null;
$id = $this->db->fetchOne($sql, [$optionName, $groupId]);

return $id ? (int) $id : null;
}

/**
Expand Down Expand Up @@ -231,9 +232,9 @@ private function getSets(): array

private function getConfiguratorSetIdByProductId(int $productId): ?int
{
$result = $this->connection->fetchOne('SELECT configurator_set_id FROM s_articles WHERE id = ?', [$productId]);
$id = $this->connection->fetchOne('SELECT configurator_set_id FROM s_articles WHERE id = ?', [$productId]);

return $result ? (int) $result : null;
return $id ? (int) $id : null;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion Components/DbAdapters/Products/RelationWriter.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ private function getRelationIdByOrderNumber(string $orderNumber): ?int
[$orderNumber]
);

return (int) $relationId ?: null;
return $relationId ? (int) $relationId : null;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion Components/Factories/ProfileFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public function loadHiddenProfile(string $type): Profile

private function getDefaultTreeByBaseProfile(int $baseProfileId): string
{
return $this->modelManager
return (string) $this->modelManager
->getRepository(ProfileEntity::class)
->createQueryBuilder('p')
->select('p.tree')
Expand Down
4 changes: 0 additions & 4 deletions Components/Transformers/FlattenTransformer.php
Original file line number Diff line number Diff line change
Expand Up @@ -948,8 +948,6 @@ private function collectIterationData(array $node, ?string $path = null): void
* Returns price node by price group
*
* @param array<string|int, mixed> $node
*
* @return array
*/
private function findNodeByPriceGroup(array $node, string $groupKey, array $mapper): ?array
{
Expand Down Expand Up @@ -1370,8 +1368,6 @@ private function getTaxRates(): array
*
* @param array<string|int, mixed> $node
* @param array<string, string> $mapper
*
* @return array
*/
private function findNodeByTaxRate(array $node, float $taxRate, array $mapper): ?array
{
Expand Down

0 comments on commit 40792cf

Please sign in to comment.