Skip to content

Commit

Permalink
SonarCloud fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
markus-moser committed May 22, 2024
1 parent 07ab6a3 commit 77f47fc
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ private function checkArgumentInstanceOf(
|| in_array($classOrInterface, class_implements($type->getName()), true)
);

} catch(Exception) {
} catch (Exception) {
return false;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Repository/IndexQueueRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function dispatchableItemExists(): bool
->getOneOrNullResult();

return $result !== null;
} catch(NonUniqueResultException) {
} catch (NonUniqueResultException) {
return true;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,13 +121,11 @@ protected function validateArray(array $value): void

protected function getSearchFilterFieldPath(AssetMetaDataFilter|AssetMetaDataAggregation $filter): string
{
return implode('.',
[
return implode('.', [
FieldCategory::STANDARD_FIELDS->value,
$filter->getName(),
$filter->getLanguage() ?? MappingProperty::NOT_LOCALIZED_KEY,
]
);
]);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/SearchIndexAdapter/OpenSearch/IndexStatsService.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ private function countIndexQueueEntries(): int
{
try {
return $this->indexQueueRepository->countIndexQueueEntries();
} catch(Exception $e) {
} catch (Exception $e) {
$this->logger->error('Error while counting index queue entries: '. $e->getMessage());
}

Expand Down
4 changes: 2 additions & 2 deletions src/SearchIndexAdapter/OpenSearch/PathService.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ public function rewriteChildrenIndexPaths(ElementInterface $element): void

if ($countResult > $this->searchIndexConfigService->getMaxSynchronousChildrenRenameLimit()) {
$msg = sprintf(
'Direct rewrite of children paths in OpenSearch was skipped as more than %s
items need an update (%s items).
'Direct rewrite of children paths in OpenSearch was skipped as more than %s
items need an update (%s items).
The index will be updated asynchronously via index update queue command cronjob.',
$this->searchIndexConfigService->getMaxSynchronousChildrenRenameLimit(),
$countResult
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public function processSubQueries(
$subQuery->getTargetQuery(),
$indexEntity,
);
} catch(ParsingException $e) {
} catch (ParsingException $e) {
throw new ParsingException(
$originalQuery,
$e->getExpected(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,16 @@ public function executeSearch(AdapterSearchInterface $search, string $indexName)
throw new ResultWindowTooLargeException(
$searchInformation,
'Result window too large: ' . $e->getMessage(),
$e->getCode(), $e
$e->getCode(),
$e
);
}

throw new SearchFailedException(
$searchInformation,
'Search failed: ' . $e->getMessage(),
$e->getCode(), $e
$e->getCode(),
$e
);
}

Expand Down
2 changes: 1 addition & 1 deletion src/Service/SearchIndex/IndexQueue/QueueMessageService.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function handleMessage(
int $entriesCount,
int $maxBatchSize
): void {
while(true) {
while (true) {
$entries = $this->indexQueueRepository->getUnhandledIndexQueueEntries(
true,
$maxBatchSize
Expand Down
3 changes: 2 additions & 1 deletion src/Traits/ElementNormalizerTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ private function getTagsByElement(ElementInterface $element): array
$tag = new Tag();

return $tag->getDao()->getTagsForElement(
Service::getElementType($element), $element->getId()
Service::getElementType($element),
$element->getId()
);

}
Expand Down

0 comments on commit 77f47fc

Please sign in to comment.