From 40792cf8dd31a18144275a24a27c64bc49756877 Mon Sep 17 00:00:00 2001 From: Michael Telgmann Date: Thu, 21 Sep 2023 08:53:38 +0200 Subject: [PATCH] chore: fix code style due to core dependency updates --- .../DbAdapters/Products/ConfiguratorWriter.php | 15 ++++++++------- Components/DbAdapters/Products/RelationWriter.php | 2 +- Components/Factories/ProfileFactory.php | 2 +- Components/Transformers/FlattenTransformer.php | 4 ---- 4 files changed, 10 insertions(+), 13 deletions(-) diff --git a/Components/DbAdapters/Products/ConfiguratorWriter.php b/Components/DbAdapters/Products/ConfiguratorWriter.php index 5507738a..ab1495c8 100644 --- a/Components/DbAdapters/Products/ConfiguratorWriter.php +++ b/Components/DbAdapters/Products/ConfiguratorWriter.php @@ -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 @@ -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; } /** @@ -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; } /** diff --git a/Components/DbAdapters/Products/RelationWriter.php b/Components/DbAdapters/Products/RelationWriter.php index fcb89b02..599d5ceb 100644 --- a/Components/DbAdapters/Products/RelationWriter.php +++ b/Components/DbAdapters/Products/RelationWriter.php @@ -161,7 +161,7 @@ private function getRelationIdByOrderNumber(string $orderNumber): ?int [$orderNumber] ); - return (int) $relationId ?: null; + return $relationId ? (int) $relationId : null; } /** diff --git a/Components/Factories/ProfileFactory.php b/Components/Factories/ProfileFactory.php index 5022e7e4..bd0534a8 100644 --- a/Components/Factories/ProfileFactory.php +++ b/Components/Factories/ProfileFactory.php @@ -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') diff --git a/Components/Transformers/FlattenTransformer.php b/Components/Transformers/FlattenTransformer.php index c207c2f1..a083b989 100644 --- a/Components/Transformers/FlattenTransformer.php +++ b/Components/Transformers/FlattenTransformer.php @@ -948,8 +948,6 @@ private function collectIterationData(array $node, ?string $path = null): void * Returns price node by price group * * @param array $node - * - * @return array */ private function findNodeByPriceGroup(array $node, string $groupKey, array $mapper): ?array { @@ -1370,8 +1368,6 @@ private function getTaxRates(): array * * @param array $node * @param array $mapper - * - * @return array */ private function findNodeByTaxRate(array $node, float $taxRate, array $mapper): ?array {