diff --git a/Classes/Access/Rootline.php b/Classes/Access/Rootline.php index 4b49a83b83..06cccef757 100644 --- a/Classes/Access/Rootline.php +++ b/Classes/Access/Rootline.php @@ -97,7 +97,7 @@ public function __construct(string $accessRootline = null) * * @param RootlineElement $rootlineElement Element to add. */ - public function push(RootlineElement $rootlineElement) + public function push(RootlineElement $rootlineElement): void { $lastElementIndex = max(0, (count($this->rootlineElements) - 1)); diff --git a/Classes/Backend/CoreSelectorField.php b/Classes/Backend/CoreSelectorField.php index dd2151d449..9e83d21b1a 100644 --- a/Classes/Backend/CoreSelectorField.php +++ b/Classes/Backend/CoreSelectorField.php @@ -64,7 +64,7 @@ public function __construct(Site $site) * * @param string $formElementName Form element name */ - public function setFormElementName(string $formElementName) + public function setFormElementName(string $formElementName): void { $this->formElementName = $formElementName; } @@ -84,7 +84,7 @@ public function getFormElementName(): string * * @param array $selectedValues */ - public function setSelectedValues(array $selectedValues) + public function setSelectedValues(array $selectedValues): void { $this->selectedValues = $selectedValues; } diff --git a/Classes/Backend/IndexingConfigurationSelectorField.php b/Classes/Backend/IndexingConfigurationSelectorField.php index 8c6b3b7869..1463771a19 100644 --- a/Classes/Backend/IndexingConfigurationSelectorField.php +++ b/Classes/Backend/IndexingConfigurationSelectorField.php @@ -66,7 +66,7 @@ public function __construct(Site $site) * * @param string $formElementName Form element name */ - public function setFormElementName(string $formElementName) + public function setFormElementName(string $formElementName): void { $this->formElementName = $formElementName; } diff --git a/Classes/Backend/SettingsPreviewOnPlugins.php b/Classes/Backend/SettingsPreviewOnPlugins.php index 6927a25898..ed2f457e2f 100644 --- a/Classes/Backend/SettingsPreviewOnPlugins.php +++ b/Classes/Backend/SettingsPreviewOnPlugins.php @@ -32,7 +32,6 @@ class SettingsPreviewOnPlugins { protected array $pluginsTtContentRecord; private array $flexformData; - protected array $settings = []; public function __construct( @@ -102,10 +101,6 @@ protected function addTargetPage(): void } } - /** - * @param string $settingName - * @param string $flexFormField - */ protected function addSettingFromFlexForm(string $settingName, string $flexFormField): void { $value = $this->getFieldFromFlexform($flexFormField); @@ -117,10 +112,6 @@ protected function addSettingFromFlexForm(string $settingName, string $flexFormF $this->addSettingIfNotEmpty($settingName, (string)$value); } - /** - * @param string $settingName - * @param array $values - */ protected function addSettingFromFlexFormArray(string $settingName, array $values): void { foreach ($values as $item) { @@ -136,10 +127,6 @@ protected function addSettingFromFlexFormArray(string $settingName, array $value } } - /** - * @param string $settingName - * @param string $value - */ protected function addSettingIfNotEmpty(string $settingName, string $value): void { if (!empty($value)) { @@ -161,8 +148,6 @@ protected function getFieldFromFlexform(string $path): mixed /** * Returns the plugin label - * - * @return string */ protected function getPluginLabel(): string { @@ -176,11 +161,6 @@ protected function getPluginLabel(): string return $label; } - /** - * Returns the language service - * - * @return LanguageService - */ protected function getLanguageService(): LanguageService { return $GLOBALS['LANG']; diff --git a/Classes/ConnectionManager.php b/Classes/ConnectionManager.php index 4e98d8c9b5..4b8381635f 100644 --- a/Classes/ConnectionManager.php +++ b/Classes/ConnectionManager.php @@ -103,8 +103,8 @@ public function getConnectionFromConfiguration(array $config) * Gets a Solr connection for a page ID. * * @param int $pageId A page ID. - * @param ?int $language The language ID to get the connection for as the path may differ. Optional, defaults to 0. - * @param ?string $mount Comma list of MountPoint parameters + * @param int $language The language ID to get the connection for as the path may differ. Optional, defaults to 0. + * @param string $mount Comma list of MountPoint parameters * @return SolrConnection A solr connection. * @throws DBALDriverException * @throws NoSolrConnectionFoundException diff --git a/Classes/ContentObject/Classification.php b/Classes/ContentObject/Classification.php index c5c91bc976..4c610e5dc1 100644 --- a/Classes/ContentObject/Classification.php +++ b/Classes/ContentObject/Classification.php @@ -91,7 +91,7 @@ protected function buildClassificationsFromConfiguration(array $configuredMapped // @todo deprecate patterns configuration $patterns = empty($class['patterns']) ? [] : GeneralUtility::trimExplode(',', $class['patterns']); $matchPatterns = empty($class['matchPatterns']) ? [] : GeneralUtility::trimExplode(',', $class['matchPatterns']); - $matchPatterns = $matchPatterns + $patterns; + $matchPatterns += $patterns; $unMatchPatters = empty($class['unmatchPatterns']) ? [] : GeneralUtility::trimExplode(',', $class['unmatchPatterns']); $className = $class['class']; diff --git a/Classes/Controller/AbstractBaseController.php b/Classes/Controller/AbstractBaseController.php index ecafa751cc..5cad1ae981 100644 --- a/Classes/Controller/AbstractBaseController.php +++ b/Classes/Controller/AbstractBaseController.php @@ -184,7 +184,7 @@ protected function initializeSettings() // Make sure plugin.tx_solr.settings are available in the view as {settings} $this->settings = $typoScriptService->convertTypoScriptArrayToPlainArray( - $this->typoScriptConfiguration->getObjectByPathOrDefault('plugin.tx_solr.settings.', []) + $this->typoScriptConfiguration->getObjectByPathOrDefault('plugin.tx_solr.settings.') ); } diff --git a/Classes/Controller/Backend/Search/IndexAdministrationModuleController.php b/Classes/Controller/Backend/Search/IndexAdministrationModuleController.php index bf9c8cd7ec..d785b80f6d 100644 --- a/Classes/Controller/Backend/Search/IndexAdministrationModuleController.php +++ b/Classes/Controller/Backend/Search/IndexAdministrationModuleController.php @@ -56,7 +56,7 @@ public function emptyIndexAction(): ResponseInterface $writeService = $solrServer->getWriteService(); /* @var SolrConnection $solrServer */ $writeService->deleteByQuery('siteHash:' . $siteHash); - $writeService->commit(false, false, false); + $writeService->commit(false, false); $affectedCores[] = $writeService->getPrimaryEndpoint()->getCore(); } $message = LocalizationUtility::translate('solr.backend.index_administration.index_emptied_all', 'Solr', [$this->selectedSite->getLabel(), implode(', ', $affectedCores)]); diff --git a/Classes/Controller/SearchController.php b/Classes/Controller/SearchController.php index 4b49c77597..9251364aad 100644 --- a/Classes/Controller/SearchController.php +++ b/Classes/Controller/SearchController.php @@ -128,10 +128,10 @@ public function resultsAction(): ResponseInterface $currentPage = 1; } - $itemsPerPage = ($searchResultSet->getUsedResultsPerPage() ?: $this->typoScriptConfiguration->getSearchResultsPerPage(10)); + $itemsPerPage = ($searchResultSet->getUsedResultsPerPage() ?: $this->typoScriptConfiguration->getSearchResultsPerPage()); $paginator = GeneralUtility::makeInstance(ResultsPaginator::class, $searchResultSet, $currentPage, $itemsPerPage); $pagination = GeneralUtility::makeInstance(ResultsPagination::class, $paginator); - $pagination->setMaxPageNumbers((int)$this->typoScriptConfiguration->getMaxPaginatorLinks(0)); + $pagination->setMaxPageNumbers($this->typoScriptConfiguration->getMaxPaginatorLinks()); /* @var AfterSearchEvent $afterSearchEvent */ $afterSearchEvent = $this->eventDispatcher->dispatch( diff --git a/Classes/Domain/Index/Queue/GarbageRemover/StrategyFactory.php b/Classes/Domain/Index/Queue/GarbageRemover/StrategyFactory.php index 6dc425f8b0..c5a28308ef 100644 --- a/Classes/Domain/Index/Queue/GarbageRemover/StrategyFactory.php +++ b/Classes/Domain/Index/Queue/GarbageRemover/StrategyFactory.php @@ -25,7 +25,6 @@ class StrategyFactory { /** - * @param string $table * @return PageStrategy|RecordStrategy */ public static function getByTable(string $table): AbstractStrategy diff --git a/Classes/Domain/Index/Queue/QueueItemRepository.php b/Classes/Domain/Index/Queue/QueueItemRepository.php index 9a19a138a5..19e841546c 100644 --- a/Classes/Domain/Index/Queue/QueueItemRepository.php +++ b/Classes/Domain/Index/Queue/QueueItemRepository.php @@ -138,7 +138,7 @@ public function flushAllErrors(): int public function flushErrorsBySite(Site $site): int { $queryBuilder = $this->getQueryBuilder(); - return (int)$this->getPreparedFlushErrorQuery($queryBuilder) + return $this->getPreparedFlushErrorQuery($queryBuilder) ->andWhere( /** @scrutinizer ignore-type */ $queryBuilder->expr()->eq('root', $site->getRootPageId()) @@ -157,7 +157,7 @@ public function flushErrorsBySite(Site $site): int public function flushErrorByItem(Item $item): int { $queryBuilder = $this->getQueryBuilder(); - return (int)$this->getPreparedFlushErrorQuery($queryBuilder) + return $this->getPreparedFlushErrorQuery($queryBuilder) ->andWhere( /** @scrutinizer ignore-type */ $queryBuilder->expr()->eq('uid', $item->getIndexQueueUid()) @@ -222,7 +222,7 @@ public function updateExistingItemByItemTypeAndItemUidAndRootPageId( $queryBuilder->set('indexing_configuration', $indexingConfiguration); } - return (int)$queryBuilder->executeStatement(); + return $queryBuilder->executeStatement(); } /** @@ -249,7 +249,7 @@ public function add( int $indexingPriority = 0 ): int { $queryBuilder = $this->getQueryBuilder(); - return (int)$queryBuilder + return $queryBuilder ->insert($this->table) ->values([ 'root' => $rootPageId, @@ -983,7 +983,7 @@ public function markItemAsFailed($item, string $errorMessage = ''): int $errorMessage = empty($errorMessage) ? '1' : $errorMessage; $queryBuilder = $this->getQueryBuilder(); - return (int)$queryBuilder + return $queryBuilder ->update($this->table) ->set('errors', $errorMessage) ->where($queryBuilder->expr()->eq('uid', $itemUid)) @@ -1001,7 +1001,7 @@ public function markItemAsFailed($item, string $errorMessage = ''): int public function updateIndexTimeByItem(Item $item): int { $queryBuilder = $this->getQueryBuilder(); - return (int)$queryBuilder + return $queryBuilder ->update($this->table) ->set('indexed', time()) ->where($queryBuilder->expr()->eq('uid', $item->getIndexQueueUid())) @@ -1020,7 +1020,7 @@ public function updateIndexTimeByItem(Item $item): int public function updateChangedTimeByItem(Item $item, int $changedTime = 0): int { $queryBuilder = $this->getQueryBuilder(); - return (int)$queryBuilder + return $queryBuilder ->update($this->table) ->set('changed', $changedTime) ->where($queryBuilder->expr()->eq('uid', $item->getIndexQueueUid())) @@ -1121,7 +1121,7 @@ public function findAllIndexQueueItemsByRootPidAndMountIdentifierAndMountedPids( public function updateHasIndexingPropertiesFlagByItemUid(int $itemUid, bool $hasIndexingPropertiesFlag): int { $queryBuilder = $this->getQueryBuilder(); - return (int)$queryBuilder + return $queryBuilder ->update($this->table) ->where( /** @scrutinizer ignore-type */ diff --git a/Classes/Domain/Search/ApacheSolrDocument/Builder.php b/Classes/Domain/Search/ApacheSolrDocument/Builder.php index abdcf9e896..bb5ee47f7e 100644 --- a/Classes/Domain/Search/ApacheSolrDocument/Builder.php +++ b/Classes/Domain/Search/ApacheSolrDocument/Builder.php @@ -59,7 +59,6 @@ public function __construct(IdBuilder $variantIdBuilder = null) * @param string $url * @param Rootline $pageAccessRootline * @param string $mountPointParameter - * @return Document|object * @throws AspectNotFoundException * @throws DBALDriverException */ diff --git a/Classes/Domain/Search/Query/AbstractQueryBuilder.php b/Classes/Domain/Search/Query/AbstractQueryBuilder.php index 91547a127c..7e163f1fe6 100644 --- a/Classes/Domain/Search/Query/AbstractQueryBuilder.php +++ b/Classes/Domain/Search/Query/AbstractQueryBuilder.php @@ -45,28 +45,17 @@ abstract class AbstractQueryBuilder */ protected ?SolariumQuery $queryToBuild; - /** - * @param SolariumQuery $query - * @return $this - */ public function startFrom(SolariumQuery $query): AbstractQueryBuilder { $this->queryToBuild = $query; return $this; } - /** - * @return SolariumQuery|Query - */ public function getQuery(): SolariumQuery { return $this->queryToBuild; } - /** - * @param bool $omitHeader - * @return $this - */ public function useOmitHeader(bool $omitHeader = true): AbstractQueryBuilder { $this->queryToBuild->setOmitHeader($omitHeader); @@ -76,9 +65,6 @@ public function useOmitHeader(bool $omitHeader = true): AbstractQueryBuilder /** * Uses an array of filters and applies them to the query. - * - * @param array $filterArray - * @return $this */ public function useFilterArray(array $filterArray): AbstractQueryBuilder { @@ -91,9 +77,6 @@ public function useFilterArray(array $filterArray): AbstractQueryBuilder /** * Applies the queryString that is used to search - * - * @param string $queryString - * @return $this */ public function useQueryString(string $queryString): AbstractQueryBuilder { @@ -103,9 +86,6 @@ public function useQueryString(string $queryString): AbstractQueryBuilder /** * Applies the passed queryType to the query. - * - * @param string $queryType - * @return $this */ public function useQueryType(string $queryType): AbstractQueryBuilder { @@ -115,8 +95,6 @@ public function useQueryType(string $queryType): AbstractQueryBuilder /** * Remove the queryType (qt) from the query. - * - * @return $this */ public function removeQueryType(): AbstractQueryBuilder { @@ -126,8 +104,6 @@ public function removeQueryType(): AbstractQueryBuilder /** * Can be used to remove all sortings from the query. - * - * @return $this */ public function removeAllSortings(): AbstractQueryBuilder { @@ -137,9 +113,6 @@ public function removeAllSortings(): AbstractQueryBuilder /** * Applies the passed sorting to the query. - * - * @param Sorting $sorting - * @return $this */ public function useSorting(Sorting $sorting): AbstractQueryBuilder { @@ -154,9 +127,6 @@ public function useSorting(Sorting $sorting): AbstractQueryBuilder /** * Applies the passed sorting to the query. - * - * @param Sortings $sortings - * @return $this */ public function useSortings(Sortings $sortings): AbstractQueryBuilder { @@ -167,30 +137,18 @@ public function useSortings(Sortings $sortings): AbstractQueryBuilder return $this; } - /** - * @param int $resultsPerPage - * @return $this - */ public function useResultsPerPage(int $resultsPerPage): AbstractQueryBuilder { $this->queryToBuild->setRows($resultsPerPage); return $this; } - /** - * @param int $page - * @return $this - */ public function usePage(int $page): AbstractQueryBuilder { $this->queryToBuild->setStart($page); return $this; } - /** - * @param Operator $operator - * @return $this - */ public function useOperator(Operator $operator): AbstractQueryBuilder { $this->queryToBuild->setQueryDefaultOperator($operator->getOperator()); @@ -199,8 +157,6 @@ public function useOperator(Operator $operator): AbstractQueryBuilder /** * Remove the default query operator. - * - * @return $this */ public function removeOperator(): AbstractQueryBuilder { @@ -208,10 +164,6 @@ public function removeOperator(): AbstractQueryBuilder return $this; } - /** - * @param Slops $slops - * @return $this - */ public function useSlops(Slops $slops): AbstractQueryBuilder { return $slops->build($this); @@ -221,7 +173,6 @@ public function useSlops(Slops $slops): AbstractQueryBuilder * Uses the passed boostQuer(y|ies) for the query. * * @param string|array $boostQueries - * @return $this */ public function useBoostQueries($boostQueries): AbstractQueryBuilder { @@ -240,8 +191,6 @@ public function useBoostQueries($boostQueries): AbstractQueryBuilder /** * Removes all boost queries from the query. - * - * @return $this */ public function removeAllBoostQueries(): AbstractQueryBuilder { @@ -251,9 +200,6 @@ public function removeAllBoostQueries(): AbstractQueryBuilder /** * Uses the passed boostFunction for the query. - * - * @param string $boostFunction - * @return $this */ public function useBoostFunction(string $boostFunction): AbstractQueryBuilder { @@ -263,8 +209,6 @@ public function useBoostFunction(string $boostFunction): AbstractQueryBuilder /** * Removes all previously configured boost functions. - * - * @return $this */ public function removeAllBoostFunctions(): AbstractQueryBuilder { @@ -274,9 +218,6 @@ public function removeAllBoostFunctions(): AbstractQueryBuilder /** * Uses the passed minimumMatch(mm) for the query. - * - * @param string $minimumMatch - * @return $this */ public function useMinimumMatch(string $minimumMatch): AbstractQueryBuilder { @@ -286,8 +227,6 @@ public function useMinimumMatch(string $minimumMatch): AbstractQueryBuilder /** * Remove any previous passed minimumMatch parameter. - * - * @return $this */ public function removeMinimumMatch(): AbstractQueryBuilder { @@ -297,9 +236,6 @@ public function removeMinimumMatch(): AbstractQueryBuilder /** * Applies the tie parameter to the query. - * - * @param float $tie - * @return $this */ public function useTieParameter(float $tie): AbstractQueryBuilder { @@ -309,9 +245,6 @@ public function useTieParameter(float $tie): AbstractQueryBuilder /** * Applies custom QueryFields to the query. - * - * @param QueryFields $queryFields - * @return $this */ public function useQueryFields(QueryFields $queryFields): AbstractQueryBuilder { @@ -320,9 +253,6 @@ public function useQueryFields(QueryFields $queryFields): AbstractQueryBuilder /** * Applies custom ReturnFields to the query. - * - * @param ReturnFields $returnFields - * @return $this */ public function useReturnFields(ReturnFields $returnFields): AbstractQueryBuilder { @@ -331,10 +261,6 @@ public function useReturnFields(ReturnFields $returnFields): AbstractQueryBuilde /** * Can be used to use a specific filter string in the solr query. - * - * @param string $filterString - * @param string $filterName - * @return $this */ public function useFilter(string $filterString, string $filterName = ''): AbstractQueryBuilder { @@ -350,9 +276,6 @@ public function useFilter(string $filterString, string $filterName = ''): Abstra /** * Removes a filter by the fieldName. - * - * @param string $fieldName - * @return $this */ public function removeFilterByFieldName(string $fieldName): AbstractQueryBuilder { @@ -367,25 +290,18 @@ function ($key, $query) use ($fieldName) { /** * Removes a filter by the name of the filter (also known as key). - * - * @param string $name - * @return $this */ public function removeFilterByName(string $name): AbstractQueryBuilder { return $this->removeFilterByFunction( function ($key, $query) use ($name) { - $key = $query->getKey(); - return $key == $name; + return $query->getKey() === $name; } ); } /** * Removes a filter by the filter value. - * - * @param string $value - * @return $this */ public function removeFilterByValue(string $value): AbstractQueryBuilder { @@ -397,14 +313,10 @@ function ($key, $query) use ($value) { ); } - /** - * @param Closure $filterFunction - * @return $this - */ public function removeFilterByFunction(Closure $filterFunction): AbstractQueryBuilder { $queries = $this->queryToBuild->getFilterQueries(); - foreach ($queries as $key => $query) { + foreach ($queries as $key => $query) { $canBeRemoved = $filterFunction($key, $query); if ($canBeRemoved) { unset($queries[$key]); @@ -417,8 +329,6 @@ public function removeFilterByFunction(Closure $filterFunction): AbstractQueryBu /** * Passes the alternative query to the SolariumQuery - * @param string $query - * @return $this */ public function useAlternativeQuery(string $query): AbstractQueryBuilder { @@ -428,8 +338,6 @@ public function useAlternativeQuery(string $query): AbstractQueryBuilder /** * Remove the alternative query from the SolariumQuery. - * - * @return $this */ public function removeAlternativeQuery(): AbstractQueryBuilder { @@ -439,19 +347,12 @@ public function removeAlternativeQuery(): AbstractQueryBuilder /** * Applies a custom Faceting configuration to the query. - * - * @param Faceting $faceting - * @return $this */ public function useFaceting(Faceting $faceting): AbstractQueryBuilder { return $faceting->build($this); } - /** - * @param FieldCollapsing $fieldCollapsing - * @return $this - */ public function useFieldCollapsing(FieldCollapsing $fieldCollapsing): AbstractQueryBuilder { return $fieldCollapsing->build($this); @@ -459,28 +360,17 @@ public function useFieldCollapsing(FieldCollapsing $fieldCollapsing): AbstractQu /** * Applies a custom initialized grouping to the query. - * - * @param Grouping $grouping - * @return $this */ public function useGrouping(Grouping $grouping): AbstractQueryBuilder { return $grouping->build($this); } - /** - * @param Highlighting $highlighting - * @return $this - */ public function useHighlighting(Highlighting $highlighting): AbstractQueryBuilder { return $highlighting->build($this); } - /** - * @param bool $debugMode - * @return $this - */ public function useDebug(bool $debugMode): AbstractQueryBuilder { if (!$debugMode) { @@ -495,19 +385,11 @@ public function useDebug(bool $debugMode): AbstractQueryBuilder return $this; } - /** - * @param Elevation $elevation - * @return QueryBuilder - */ public function useElevation(Elevation $elevation): AbstractQueryBuilder { return $elevation->build($this); } - /** - * @param Spellchecking $spellchecking - * @return $this - */ public function useSpellchecking(Spellchecking $spellchecking): AbstractQueryBuilder { return $spellchecking->build($this); @@ -515,9 +397,6 @@ public function useSpellchecking(Spellchecking $spellchecking): AbstractQueryBui /** * Applies a custom configured PhraseFields to the query. - * - * @param PhraseFields $phraseFields - * @return $this */ public function usePhraseFields(PhraseFields $phraseFields): AbstractQueryBuilder { @@ -526,9 +405,6 @@ public function usePhraseFields(PhraseFields $phraseFields): AbstractQueryBuilde /** * Applies a custom configured BigramPhraseFields to the query. - * - * @param BigramPhraseFields $bigramPhraseFields - * @return $this */ public function useBigramPhraseFields(BigramPhraseFields $bigramPhraseFields): AbstractQueryBuilder { @@ -537,9 +413,6 @@ public function useBigramPhraseFields(BigramPhraseFields $bigramPhraseFields): A /** * Applies a custom configured TrigramPhraseFields to the query. - * - * @param TrigramPhraseFields $trigramPhraseFields - * @return $this */ public function useTrigramPhraseFields(TrigramPhraseFields $trigramPhraseFields): AbstractQueryBuilder { diff --git a/Classes/Domain/Search/Query/Helper/EscapeService.php b/Classes/Domain/Search/Query/Helper/EscapeService.php index 8403323281..82b1124af3 100644 --- a/Classes/Domain/Search/Query/Helper/EscapeService.php +++ b/Classes/Domain/Search/Query/Helper/EscapeService.php @@ -50,9 +50,7 @@ public static function escape($string) return static::escapeSpecialCharacters($string); } - $result = static::tokenizeByQuotesAndEscapeDependingOnContext($string); - - return $result; + return static::tokenizeByQuotesAndEscapeDependingOnContext($string); } /** diff --git a/Classes/Domain/Search/Query/ParameterBuilder/Filters.php b/Classes/Domain/Search/Query/ParameterBuilder/Filters.php index 3f936c21e5..6cef63d815 100644 --- a/Classes/Domain/Search/Query/ParameterBuilder/Filters.php +++ b/Classes/Domain/Search/Query/ParameterBuilder/Filters.php @@ -25,9 +25,6 @@ */ class Filters { - /** - * @var array - */ protected array $filters = []; /** @@ -35,15 +32,12 @@ class Filters * * @param string $filterFieldName The field name the filter should be removed for */ - public function removeByFieldName(string $filterFieldName) + public function removeByFieldName(string $filterFieldName): void { $this->removeByPrefix($filterFieldName . ':'); } - /** - * @param string $filterFieldName - */ - public function removeByPrefix(string $filterFieldName) + public function removeByPrefix(string $filterFieldName): void { foreach ($this->filters as $key => $filterString) { if (str_starts_with($filterString, $filterFieldName)) { @@ -57,16 +51,12 @@ public function removeByPrefix(string $filterFieldName) * * @param string $name name of the filter */ - public function removeByName(string $name) + public function removeByName(string $name): void { unset($this->filters[$name]); } - /** - * @param string $filterString - * @param string $name - */ - public function add(string $filterString, string $name = '') + public function add(string $filterString, string $name = ''): void { if ($name !== '') { $this->filters[$name] = $filterString; @@ -77,9 +67,6 @@ public function add(string $filterString, string $name = '') /** * Adds multiple filters to the filter collection. - * - * @param array $filterArray - * @return Filters */ public function addMultiple(array $filterArray): Filters { @@ -92,10 +79,6 @@ public function addMultiple(array $filterArray): Filters return $this; } - /** - * @param string $name - * @return bool - */ public function hasWithName(string $name): bool { return array_key_exists($name, $this->filters); @@ -108,7 +91,7 @@ public function hasWithName(string $name): bool * * @param string $filterString The filter to remove, in the form of field:value */ - public function removeByValue(string $filterString) + public function removeByValue(string $filterString): void { $key = array_search($filterString, $this->filters); if ($key === false) { @@ -129,20 +112,15 @@ public function getValues(): array } /** - * @param TypoScriptConfiguration $solrConfiguration - * @return Filters * @todo: Check why $solrConfiguration isn't used. */ public static function fromTypoScriptConfiguration(TypoScriptConfiguration $solrConfiguration): Filters { - return new Filters(); + return new self(); } - /** - * @return Filters - */ public static function getEmpty(): Filters { - return new Filters(); + return new self(); } } diff --git a/Classes/Domain/Search/Query/QueryBuilder.php b/Classes/Domain/Search/Query/QueryBuilder.php index 467694b0f6..cbd87d2db4 100644 --- a/Classes/Domain/Search/Query/QueryBuilder.php +++ b/Classes/Domain/Search/Query/QueryBuilder.php @@ -112,11 +112,6 @@ public function newSuggestQuery(string $queryString): QueryBuilder /** * Initializes the Query object and SearchComponents and returns * the initialized query object, when a search should be executed. - * - * @param string|null $rawQuery - * @param int $resultsPerPage - * @param array $additionalFiltersFromRequest - * @return SolariumSelectQuery */ public function buildSearchQuery( string $rawQuery = '', @@ -197,10 +192,6 @@ public function buildPageQuery(int $pageId): SolariumSelectQuery /** * Returns a query for single record * - * @param string $type - * @param int $uid - * @param int $pageId - * @return SolariumSelectQuery|Query * @throws DBALDriverException */ public function buildRecordQuery(string $type, int $uid, int $pageId): SolariumSelectQuery @@ -321,7 +312,7 @@ public function useReturnFieldsFromTypoScript(): QueryBuilder */ public function useSiteHashFromTypoScript(int $requestedPageId): QueryBuilder { - $queryConfiguration = $this->typoScriptConfiguration->getObjectByPathOrDefault('plugin.tx_solr.search.query.', []); + $queryConfiguration = $this->typoScriptConfiguration->getObjectByPathOrDefault('plugin.tx_solr.search.query.'); $allowedSites = $this->siteHashService->getAllowedSitesForPageIdAndAllowedSitesConfiguration($requestedPageId, $queryConfiguration['allowedSites']); return $this->useSiteHashFromAllowedSites($allowedSites); } diff --git a/Classes/Domain/Search/Query/SuggestQuery.php b/Classes/Domain/Search/Query/SuggestQuery.php index 9899c56e28..095ca57cb1 100644 --- a/Classes/Domain/Search/Query/SuggestQuery.php +++ b/Classes/Domain/Search/Query/SuggestQuery.php @@ -51,7 +51,7 @@ public function __construct(string $keywords, TypoScriptConfiguration $solrConfi $solrConfiguration = $solrConfiguration ?? Util::getSolrConfiguration(); $this->setQuery($keywords); - $this->configuration = $solrConfiguration->getObjectByPathOrDefault('plugin.tx_solr.suggest.', []); + $this->configuration = $solrConfiguration->getObjectByPathOrDefault('plugin.tx_solr.suggest.'); if (!empty($this->configuration['treatMultipleTermsAsSingleTerm'])) { $this->prefix = $keywords; diff --git a/Classes/Domain/Search/ResultSet/Facets/AbstractFacetItemCollection.php b/Classes/Domain/Search/ResultSet/Facets/AbstractFacetItemCollection.php index 8138c700d6..a6dc3b5333 100644 --- a/Classes/Domain/Search/ResultSet/Facets/AbstractFacetItemCollection.php +++ b/Classes/Domain/Search/ResultSet/Facets/AbstractFacetItemCollection.php @@ -86,7 +86,7 @@ public function getManualSortedCopy(array $manualSorting): AbstractFacetItemColl } } // in the end all items get appended that are not configured in the manual sort order - $sortedOptions = $sortedOptions + $copiedItems; + $sortedOptions += $copiedItems; $result->data = $sortedOptions; return $result; diff --git a/Classes/Domain/Search/ResultSet/Facets/FacetCollection.php b/Classes/Domain/Search/ResultSet/Facets/FacetCollection.php index cfc1c50a64..a829332fe8 100644 --- a/Classes/Domain/Search/ResultSet/Facets/FacetCollection.php +++ b/Classes/Domain/Search/ResultSet/Facets/FacetCollection.php @@ -32,9 +32,6 @@ public function addFacet(AbstractFacet $facet) $this->data[$facet->getName()] = $facet; } - /** - * @return FacetCollection|AbstractCollection - */ public function getUsed(): AbstractCollection { return $this->getFilteredCopy( @@ -44,9 +41,6 @@ function (AbstractFacet $facet) { ); } - /** - * @return FacetCollection|AbstractCollection - */ public function getAvailable(): AbstractCollection { return $this->getFilteredCopy( @@ -84,7 +78,7 @@ function (AbstractFacet $facet) use ($requiredName) { /** * @param int $position - * @return AbstractFacet + * @return AbstractFacet|object */ public function getByPosition(int $position): ?object { diff --git a/Classes/Domain/Search/ResultSet/Facets/OptionBased/Hierarchy/HierarchyFacetParser.php b/Classes/Domain/Search/ResultSet/Facets/OptionBased/Hierarchy/HierarchyFacetParser.php index 425bf108a2..165ba292da 100644 --- a/Classes/Domain/Search/ResultSet/Facets/OptionBased/Hierarchy/HierarchyFacetParser.php +++ b/Classes/Domain/Search/ResultSet/Facets/OptionBased/Hierarchy/HierarchyFacetParser.php @@ -113,11 +113,7 @@ protected function sortFacetOptionsInNaturalOrder(array $flatOptionsListForHiera */ protected function facetOptionsMustBeResorted(array $facetConfiguration): bool { - if (isset($facetConfiguration['sortBy']) && $facetConfiguration['sortBy'] === 'index') { - return true; - } - - return false; + return isset($facetConfiguration['sortBy']) && $facetConfiguration['sortBy'] === 'index'; } /** diff --git a/Classes/Domain/Search/ResultSet/Facets/RequirementsService.php b/Classes/Domain/Search/ResultSet/Facets/RequirementsService.php index fad625e941..fe3bd4cb6a 100644 --- a/Classes/Domain/Search/ResultSet/Facets/RequirementsService.php +++ b/Classes/Domain/Search/ResultSet/Facets/RequirementsService.php @@ -35,7 +35,7 @@ class RequirementsService public function getAllRequirementsMet(AbstractFacet $facet) { $requirements = $facet->getRequirements(); - if (!is_array($requirements) || count($requirements) === 0) { + if (count($requirements) === 0) { return true; } diff --git a/Classes/Domain/Search/ResultSet/Facets/UrlFacetContainer.php b/Classes/Domain/Search/ResultSet/Facets/UrlFacetContainer.php index d96bc85555..00781a53dc 100644 --- a/Classes/Domain/Search/ResultSet/Facets/UrlFacetContainer.php +++ b/Classes/Domain/Search/ResultSet/Facets/UrlFacetContainer.php @@ -205,7 +205,7 @@ public function getActiveFacetValuesByName(string $facetName): array */ public function getActiveFacets(): array { - $path = $this->prefixWithNamespace('filter'); + $path = $this->prefixWithNamespace(); $pathValue = $this->argumentsAccessor->get($path, []); if (!is_array($pathValue)) { @@ -242,7 +242,7 @@ public function count(): int */ public function setActiveFacets(array $activeFacets = []): UrlFacetContainer { - $path = $this->prefixWithNamespace('filter'); + $path = $this->prefixWithNamespace(); $this->argumentsAccessor->set($path, $activeFacets); return $this; @@ -298,10 +298,8 @@ public function removeFacetValue(string $facetName, $facetValue): UrlFacetContai break; } } - } else { - if (isset($facetValues[$facetValueToLookFor])) { - unset($facetValues[$facetValueToLookFor]); - } + } elseif (isset($facetValues[$facetValueToLookFor])) { + unset($facetValues[$facetValueToLookFor]); } $this->changed = true; $this->setActiveFacets($facetValues); @@ -342,7 +340,7 @@ public function removeAllFacetValuesByName(string $facetName): UrlFacetContainer */ public function removeAllFacets(): UrlFacetContainer { - $path = $this->prefixWithNamespace('filter'); + $path = $this->prefixWithNamespace(); $this->argumentsAccessor->reset($path); $this->changed = true; return $this; diff --git a/Classes/Domain/Search/ResultSet/Result/Parser/DefaultResultParser.php b/Classes/Domain/Search/ResultSet/Result/Parser/DefaultResultParser.php index 8dc3e05a10..18f8cf1ac4 100644 --- a/Classes/Domain/Search/ResultSet/Result/Parser/DefaultResultParser.php +++ b/Classes/Domain/Search/ResultSet/Result/Parser/DefaultResultParser.php @@ -70,10 +70,7 @@ public function canParse(SearchResultSet $resultSet): bool { // These parsers should not be used when grouping is enabled $configuration = $resultSet->getUsedSearchRequest()->getContextTypoScriptConfiguration(); - if ($configuration instanceof TypoScriptConfiguration && $configuration->getIsSearchGroupingEnabled()) { - return false; - } - return true; + return !($configuration instanceof TypoScriptConfiguration && $configuration->getIsSearchGroupingEnabled()); } } diff --git a/Classes/Domain/Search/ResultSet/Result/Parser/ResultParserRegistry.php b/Classes/Domain/Search/ResultSet/Result/Parser/ResultParserRegistry.php index 3109abf8c5..8c9f8d6c35 100644 --- a/Classes/Domain/Search/ResultSet/Result/Parser/ResultParserRegistry.php +++ b/Classes/Domain/Search/ResultSet/Result/Parser/ResultParserRegistry.php @@ -96,7 +96,7 @@ public function hasParser(string $className, int $priority): bool } /** - * @return AbstractResultParser[] + * @return array|null|AbstractResultParser[] */ public function getParserInstances(): ?array { diff --git a/Classes/Domain/Search/ResultSet/SearchResultSet.php b/Classes/Domain/Search/ResultSet/SearchResultSet.php index 6803b6771b..3ca4e40b3e 100644 --- a/Classes/Domain/Search/ResultSet/SearchResultSet.php +++ b/Classes/Domain/Search/ResultSet/SearchResultSet.php @@ -37,54 +37,24 @@ */ class SearchResultSet { - /** - * @var Query|null - */ protected ?Query $usedQuery = null; - /** - * @var SearchRequest|null - */ protected ?SearchRequest $usedSearchRequest = null; - /** - * @var Search|null - */ protected ?Search $usedSearch = null; - /** - * @var ?ResponseAdapter - */ protected ?ResponseAdapter $response = null; - /** - * @var int - */ protected int $usedPage = 0; - /** - * @var int - */ protected int $usedResultsPerPage = 0; - /** - * @var array - */ protected array $usedAdditionalFilters = []; - /** - * @var SearchResultCollection - */ protected SearchResultCollection $searchResults; - /** - * @var int - */ protected int $allResultCount = 0; - /** - * @var float - */ protected float $maximumScore = 0.0; /** @@ -92,39 +62,18 @@ class SearchResultSet */ protected array $spellCheckingSuggestions = []; - /** - * @var FacetCollection - */ protected FacetCollection $facets; - /** - * @var SortingCollection - */ protected SortingCollection $sortings; - /** - * @var bool - */ protected bool $isAutoCorrected = false; - /** - * @var string - */ protected string $initialQueryString = ''; - /** - * @var string - */ protected string $correctedQueryString = ''; - /** - * @var bool - */ protected bool $hasSearched = false; - /** - * Constructor for SearchResultSet - */ public function __construct() { $this->facets = new FacetCollection(); @@ -132,33 +81,21 @@ public function __construct() $this->searchResults = new SearchResultCollection(); } - /** - * @param int $allResultCount - */ - public function setAllResultCount(int $allResultCount) + public function setAllResultCount(int $allResultCount): void { $this->allResultCount = $allResultCount; } - /** - * @return int - */ public function getAllResultCount(): int { return $this->allResultCount; } - /** - * @param Suggestion $suggestion - */ - public function addSpellCheckingSuggestion(Suggestion $suggestion) + public function addSpellCheckingSuggestion(Suggestion $suggestion): void { $this->spellCheckingSuggestions[$suggestion->getSuggestion()] = $suggestion; } - /** - * @return bool - */ public function getHasSpellCheckingSuggestions(): bool { return count($this->spellCheckingSuggestions) > 0; @@ -167,7 +104,7 @@ public function getHasSpellCheckingSuggestions(): bool /** * @param Suggestion[] $spellCheckingSuggestions */ - public function setSpellCheckingSuggestions(array $spellCheckingSuggestions) + public function setSpellCheckingSuggestions(array $spellCheckingSuggestions): void { $this->spellCheckingSuggestions = $spellCheckingSuggestions; } @@ -180,256 +117,166 @@ public function getSpellCheckingSuggestions(): array return $this->spellCheckingSuggestions; } - /** - * @return FacetCollection - */ public function getFacets(): FacetCollection { return $this->facets; } - /** - * @param AbstractFacet $facet - */ - public function addFacet(AbstractFacet $facet) + public function addFacet(AbstractFacet $facet): void { $this->facets->addFacet($facet); } - /** - * @return float - */ public function getMaximumScore(): float { return $this->maximumScore; } - /** - * @param float $maximumScore - */ - public function setMaximumScore(float $maximumScore) + public function setMaximumScore(float $maximumScore): void { $this->maximumScore = $maximumScore; } - /** - * @param Sorting $sorting - */ - public function addSorting(Sorting $sorting) + public function addSorting(Sorting $sorting): void { $this->sortings->addSorting($sorting); } - /** - * @return SortingCollection - */ public function getSortings(): SortingCollection { return $this->sortings; } - /** - * @param ResponseAdapter $response - */ - public function setResponse(ResponseAdapter $response) + public function setResponse(ResponseAdapter $response): void { $this->response = $response; } - /** - * @return ?ResponseAdapter - */ public function getResponse(): ?ResponseAdapter { return $this->response; } - /** - * @param array $usedAdditionalFilters - */ - public function setUsedAdditionalFilters(array $usedAdditionalFilters) + public function setUsedAdditionalFilters(array $usedAdditionalFilters): void { $this->usedAdditionalFilters = $usedAdditionalFilters; } - /** - * @return array - */ public function getUsedAdditionalFilters(): array { return $this->usedAdditionalFilters; } - /** - * @param Query $usedQuery - */ - public function setUsedQuery(Query $usedQuery) + public function setUsedQuery(Query $usedQuery): void { $this->usedQuery = $usedQuery; } /** * Retrieves the query object that has been used to build this result set. - * - * @return Query */ public function getUsedQuery(): ?Query { return $this->usedQuery; } - /** - * @param int $page - */ - public function setUsedPage(int $page) + public function setUsedPage(int $page): void { $this->usedPage = $page; } /** * Retrieve the page argument that has been used to build this SearchResultSet. - * - * @return int */ public function getUsedPage(): int { return $this->usedPage; } - /** - * @param SearchRequest $usedSearchRequest - */ - public function setUsedSearchRequest(SearchRequest $usedSearchRequest) + public function setUsedSearchRequest(SearchRequest $usedSearchRequest): void { $this->usedSearchRequest = $usedSearchRequest; } /** * Retrieves the SearchRequest that has been used to build this SearchResultSet. - * - * @return SearchRequest */ public function getUsedSearchRequest(): ?SearchRequest { return $this->usedSearchRequest; } - /** - * @param Search $usedSearch - */ - public function setUsedSearch(Search $usedSearch) + public function setUsedSearch(Search $usedSearch): void { $this->usedSearch = $usedSearch; } - /** - * @return Search - */ public function getUsedSearch(): ?Search { return $this->usedSearch; } - /** - * @param int $usedResultsPerPage - */ - public function setUsedResultsPerPage(int $usedResultsPerPage) + public function setUsedResultsPerPage(int $usedResultsPerPage): void { $this->usedResultsPerPage = $usedResultsPerPage; } - /** - * @return int - */ public function getUsedResultsPerPage(): int { return $this->usedResultsPerPage; } - /** - * @return SearchResultCollection - */ public function getSearchResults(): SearchResultCollection { return $this->searchResults; } - /** - * @param SearchResultCollection $searchResults - */ - public function setSearchResults(SearchResultCollection $searchResults) + public function setSearchResults(SearchResultCollection $searchResults): void { $this->searchResults = $searchResults; } - /** - * @param SearchResult $searchResult - */ - public function addSearchResult(SearchResult $searchResult) + public function addSearchResult(SearchResult $searchResult): void { $this->searchResults[] = $searchResult; } - /** - * @return bool - */ public function getIsAutoCorrected(): bool { return $this->isAutoCorrected; } - /** - * @param bool $wasAutoCorrected - */ - public function setIsAutoCorrected(bool $wasAutoCorrected) + public function setIsAutoCorrected(bool $wasAutoCorrected): void { $this->isAutoCorrected = $wasAutoCorrected; } - /** - * @return string - */ public function getInitialQueryString(): string { return $this->initialQueryString; } - /** - * @param string $initialQueryString - */ - public function setInitialQueryString(string $initialQueryString) + public function setInitialQueryString(string $initialQueryString): void { $this->initialQueryString = $initialQueryString; } - /** - * @return string - */ public function getCorrectedQueryString(): string { return $this->correctedQueryString; } - /** - * @param string $correctedQueryString - */ - public function setCorrectedQueryString(string $correctedQueryString) + public function setCorrectedQueryString(string $correctedQueryString): void { $this->correctedQueryString = $correctedQueryString; } - /** - * @return bool - */ public function getHasSearched(): bool { return $this->hasSearched; } - /** - * @param bool $hasSearched - */ - public function setHasSearched(bool $hasSearched) + public function setHasSearched(bool $hasSearched): void { $this->hasSearched = $hasSearched; } diff --git a/Classes/Domain/Search/Score/ScoreCalculationService.php b/Classes/Domain/Search/Score/ScoreCalculationService.php index 7f46c6bf75..81164ce971 100644 --- a/Classes/Domain/Search/Score/ScoreCalculationService.php +++ b/Classes/Domain/Search/Score/ScoreCalculationService.php @@ -57,13 +57,11 @@ public function render(array $highScores) $totalScore += $highScore->getScore(); } - $content = '' + return '
' . '' . '' . implode('', $scores) . '' . '' . '
ScoreFieldBoost
= ' . $totalScore . ' (Inaccurate analysis! Not all parts of the score have been taken into account.)
'; - - return $content; } /** diff --git a/Classes/Domain/Search/SearchRequest.php b/Classes/Domain/Search/SearchRequest.php index b72bc1e8e6..f476134f51 100644 --- a/Classes/Domain/Search/SearchRequest.php +++ b/Classes/Domain/Search/SearchRequest.php @@ -361,9 +361,6 @@ public function getSorting(): string /** * Helper function to get the sorting configuration name or direction. - * - * @param int $index - * @return string */ protected function getSortingPart(int $index): ?string { @@ -378,8 +375,6 @@ protected function getSortingPart(int $index): ?string /** * Returns the sorting configuration name that is currently used. - * - * @return string */ public function getSortingName(): ?string { @@ -669,8 +664,6 @@ public function getContextPageUid(): int /** * Get contextTypoScriptConfiguration - * - * @return TypoScriptConfiguration */ public function getContextTypoScriptConfiguration(): ?TypoScriptConfiguration { diff --git a/Classes/Domain/Search/SearchRequestBuilder.php b/Classes/Domain/Search/SearchRequestBuilder.php index 8320c3b0b2..33ba47cc4d 100644 --- a/Classes/Domain/Search/SearchRequestBuilder.php +++ b/Classes/Domain/Search/SearchRequestBuilder.php @@ -76,7 +76,7 @@ protected function applyPassedResultsPerPage(SearchRequest $searchRequest): Sear $requestedPerPage = $searchRequest->getResultsPerPage(); $perPageSwitchOptions = $this->typoScriptConfiguration->getSearchResultsPerPageSwitchOptionsAsArray(); - if (isset($requestedPerPage) && in_array($requestedPerPage, $perPageSwitchOptions)) { + if (in_array($requestedPerPage, $perPageSwitchOptions)) { $this->session->setPerPage($requestedPerPage); $searchRequest->setPage(0); } @@ -86,7 +86,7 @@ protected function applyPassedResultsPerPage(SearchRequest $searchRequest): Sear if ($this->session->getHasPerPage()) { $sessionResultPerPage = $this->session->getPerPage(); if (in_array($sessionResultPerPage, $perPageSwitchOptions)) { - $currentNumberOfResultsShown = (int)$sessionResultPerPage; + $currentNumberOfResultsShown = $sessionResultPerPage; } } diff --git a/Classes/Domain/Search/Statistics/StatisticsRepository.php b/Classes/Domain/Search/Statistics/StatisticsRepository.php index ea724cab20..b82b888dbb 100644 --- a/Classes/Domain/Search/Statistics/StatisticsRepository.php +++ b/Classes/Domain/Search/Statistics/StatisticsRepository.php @@ -37,9 +37,7 @@ class StatisticsRepository extends AbstractRepository /** * Fetches most popular search keys words from the table tx_solr_statistics * - * @param int $rootPageId * @param int $days number of days of history to query - * @param int $limit * @return mixed * @throws DBALDriverException * @throws DBALException|\Doctrine\DBAL\DBALException @@ -47,7 +45,7 @@ class StatisticsRepository extends AbstractRepository public function getSearchStatistics(int $rootPageId, int $days = 30, int $limit = 10) { $now = time(); - $timeStart = (int)($now - 86400 * $days); // 86400 seconds/day + $timeStart = $now - 86400 * $days; // 86400 seconds/day return $this->getPreparedQueryBuilderForSearchStatisticsAndTopKeywords($rootPageId, $timeStart, $limit) ->executeQuery() ->fetchAllAssociative(); diff --git a/Classes/Domain/Search/Statistics/StatisticsWriterProcessor.php b/Classes/Domain/Search/Statistics/StatisticsWriterProcessor.php index 1b590a8bcd..6a711c7156 100644 --- a/Classes/Domain/Search/Statistics/StatisticsWriterProcessor.php +++ b/Classes/Domain/Search/Statistics/StatisticsWriterProcessor.php @@ -46,10 +46,6 @@ class StatisticsWriterProcessor implements SearchResultSetProcessor */ protected $siteRepository; - /** - * @param StatisticsRepository|null $statisticsRepository - * @param SiteRepository|null $siteRepository - */ public function __construct( StatisticsRepository $statisticsRepository = null, SiteRepository $siteRepository = null @@ -59,8 +55,6 @@ public function __construct( } /** - * @param SearchResultSet $resultSet - * @return SearchResultSet * @throws AspectNotFoundException */ public function process(SearchResultSet $resultSet): SearchResultSet @@ -111,11 +105,6 @@ public function process(SearchResultSet $resultSet): SearchResultSet return $resultSet; } - /** - * @param Query $query - * @param bool $lowerCaseQuery - * @return string - */ protected function getProcessedKeywords( Query $query, bool $lowerCaseQuery = false @@ -145,17 +134,11 @@ protected function sanitizeString(string $string): string return trim($string); } - /** - * @return TypoScriptFrontendController - */ protected function getTSFE(): ?TypoScriptFrontendController { return $GLOBALS['TSFE']; } - /** - * @return string - */ protected function getUserIp(): string { return GeneralUtility::getIndpEnv('REMOTE_ADDR'); diff --git a/Classes/Domain/Search/Suggest/SuggestService.php b/Classes/Domain/Search/Suggest/SuggestService.php index f860865a61..e75a2fafeb 100644 --- a/Classes/Domain/Search/Suggest/SuggestService.php +++ b/Classes/Domain/Search/Suggest/SuggestService.php @@ -99,7 +99,7 @@ public function __construct( */ public function getSuggestions(SearchRequest $searchRequest, array $additionalFilters = []): array { - $requestId = (int)$this->tsfe->getRequestedId(); + $requestId = $this->tsfe->getRequestedId(); $groupList = Util::getFrontendUserGroupsList(); $suggestQuery = $this->queryBuilder->buildSuggestQuery($searchRequest->getRawUserQuery(), $additionalFilters, $requestId, $groupList); diff --git a/Classes/Domain/Site/Site.php b/Classes/Domain/Site/Site.php index d249d01b20..899a942ee9 100644 --- a/Classes/Domain/Site/Site.php +++ b/Classes/Domain/Site/Site.php @@ -171,8 +171,6 @@ public function hasFreeContentModeLanguages(): bool * Note: There is no "fallback type" nor "fallbacks" for default language 0 * See "displayCond" on https://github.com/TYPO3/typo3/blob/1394a4cff5369df3f835dae254b3d4ada2f83c7b/typo3/sysext/backend/Configuration/SiteConfiguration/site_language.php#L403-L416 * or https://review.typo3.org/c/Packages/TYPO3.CMS/+/56505/ for more information. - * - * @return array|null */ public function getFreeContentModeLanguages(): array { @@ -201,11 +199,7 @@ public function getFreeContentModeLanguages(): array */ public static function isRootPage(array $pageRecord): bool { - if (($pageRecord['is_siteroot'] ?? null) == 1) { - return true; - } - - return false; + return ($pageRecord['is_siteroot'] ?? null) == 1; } /** diff --git a/Classes/Domain/Site/SiteRepository.php b/Classes/Domain/Site/SiteRepository.php index 4e633fdb21..690d7b143d 100644 --- a/Classes/Domain/Site/SiteRepository.php +++ b/Classes/Domain/Site/SiteRepository.php @@ -257,8 +257,6 @@ protected function validateRootPageRecord(int $rootPageId, array $rootPageRecord * * @param array $rootPageRecord * - * @return Site - * * @throws DBALDriverException */ protected function buildTypo3ManagedSite(array $rootPageRecord): ?Site diff --git a/Classes/EventListener/EnhancedRouting/CachedPathVariableModifier.php b/Classes/EventListener/EnhancedRouting/CachedPathVariableModifier.php index cb8ef5c981..6c54c15557 100644 --- a/Classes/EventListener/EnhancedRouting/CachedPathVariableModifier.php +++ b/Classes/EventListener/EnhancedRouting/CachedPathVariableModifier.php @@ -82,7 +82,7 @@ public function __invoke(BeforeProcessCachedVariablesEvent $event): void $singleValues = []; $index = 0; foreach ($facets as $facet) { - if (mb_strpos($facet, ':') !== false) { + if (str_contains($facet, ':')) { [$prefix, $value] = explode( ':', $facet, @@ -126,7 +126,7 @@ protected function getPathVariablesFromUri(UriInterface $uri): array continue; } $element = $this->standardizeKey($element); - if (substr($element, 0, 3) !== '###') { + if (!str_starts_with($element, '###')) { continue; } diff --git a/Classes/FrontendEnvironment/Tsfe.php b/Classes/FrontendEnvironment/Tsfe.php index 47cdbe4fdf..54a35e2022 100644 --- a/Classes/FrontendEnvironment/Tsfe.php +++ b/Classes/FrontendEnvironment/Tsfe.php @@ -211,13 +211,6 @@ protected function initializeTsfe(int $pageId, int $language = 0, ?int $rootPage /** * Returns TypoScriptFrontendController with sand cast context. * - * @param int $pageId - * @param int $language - * - * @param int|null $rootPageId - * - * @return TypoScriptFrontendController - * * @throws SiteNotFoundException * @throws DBALDriverException * @throws Exception\Exception @@ -285,13 +278,6 @@ public function getTsfeByPageIdIgnoringLanguage(int $pageId): ?TypoScriptFronten /** * Returns TypoScriptFrontendController with sand cast context. * - * @param int $pageId - * @param int $language - * - * @param int|null $rootPageId - * - * @return ServerRequest - * * @throws SiteNotFoundException * @throws DBALDriverException * @throws Exception\Exception @@ -348,11 +334,6 @@ protected function getCacheIdentifier(int $pageId, int $language, ?int $rootPage * * Note: The requested $pidToUse can be one of configured plugin.tx_solr.index.queue.[indexConfig].additionalPageIds. * - * @param int $pidToUse - * - * @param int|null $rootPageId - * - * @return int * @throws DBALDriverException * @throws Exception\Exception */ diff --git a/Classes/FrontendEnvironment/TypoScript.php b/Classes/FrontendEnvironment/TypoScript.php index 16be2e666d..5c05e31279 100644 --- a/Classes/FrontendEnvironment/TypoScript.php +++ b/Classes/FrontendEnvironment/TypoScript.php @@ -125,7 +125,7 @@ public function ext_getSetup(array $theSetup, string $theKey): array { // 'a.b.c' --> ['a', 'b.c'] $parts = explode('.', $theKey, 2); - if ((string)$parts[0] !== '' && is_array($theSetup[$parts[0] . '.'])) { + if ($parts[0] !== '' && is_array($theSetup[$parts[0] . '.'])) { if (trim($parts[1] ?? '') !== '') { // Current path segment is a sub array, check it recursively by applying the rest of the key return $this->ext_getSetup($theSetup[$parts[0] . '.'], trim($parts[1] ?? '')); diff --git a/Classes/IndexQueue/AbstractIndexer.php b/Classes/IndexQueue/AbstractIndexer.php index d9ca43e768..c4bd25407c 100644 --- a/Classes/IndexQueue/AbstractIndexer.php +++ b/Classes/IndexQueue/AbstractIndexer.php @@ -92,10 +92,8 @@ protected function addDocumentFieldsFromTyposcript(Document $document, array $in if (is_array($fieldValue)) { // multi value $document->setField($solrFieldName, $fieldValue); - } else { - if ($fieldValue !== '' && $fieldValue !== null) { - $document->setField($solrFieldName, $fieldValue); - } + } elseif ($fieldValue !== '' && $fieldValue !== null) { + $document->setField($solrFieldName, $fieldValue); } } @@ -162,7 +160,7 @@ protected function resolveFieldValue( $fieldValue = unserialize($fieldValue); } } elseif ( - substr($indexingConfiguration[$solrFieldName], 0, 1) === '<' + str_starts_with($indexingConfiguration[$solrFieldName], '<') ) { $referencedTsPath = trim(substr( $indexingConfiguration[$solrFieldName], diff --git a/Classes/IndexQueue/FrontendHelper/UserGroupDetector.php b/Classes/IndexQueue/FrontendHelper/UserGroupDetector.php index bf947e7f6c..aadd161bf6 100644 --- a/Classes/IndexQueue/FrontendHelper/UserGroupDetector.php +++ b/Classes/IndexQueue/FrontendHelper/UserGroupDetector.php @@ -183,18 +183,16 @@ protected function findFrontendGroups(array $record, string $table) if (empty($frontendGroups)) { // default = public access $frontendGroups = 0; - } else { - if ($this->request->getParameter('loggingEnabled')) { - $this->logger->log( - SolrLogManager::INFO, - 'Access restriction found', - [ - 'groups' => $frontendGroups, - 'record' => $record, - 'record type' => $table, - ] - ); - } + } elseif ($this->request->getParameter('loggingEnabled')) { + $this->logger->log( + SolrLogManager::INFO, + 'Access restriction found', + [ + 'groups' => $frontendGroups, + 'record' => $record, + 'record type' => $table, + ] + ); } $this->frontendGroups[] = $frontendGroups; diff --git a/Classes/IndexQueue/Indexer.php b/Classes/IndexQueue/Indexer.php index ff220088f3..c6d012f33e 100644 --- a/Classes/IndexQueue/Indexer.php +++ b/Classes/IndexQueue/Indexer.php @@ -241,7 +241,6 @@ protected function getFullItemRecord(Item $item, int $language = 0): ?array * * @param Item $item * @param int $language - * @return array|mixed|null * @throws DBALDriverException * @throws FrontendEnvironmentException * @throws SiteNotFoundException @@ -289,11 +288,7 @@ protected function isAFreeContentModeItemRecord(Item $item): bool $languageOfRecord = (int)($itemRecord[$languageField] ?? null); $l10nParentRecordUid = (int)($itemRecord[$l10nParentField] ?? null); - if ($languageOfRecord > 0 && $l10nParentRecordUid === 0) { - return true; - } - - return false; + return $languageOfRecord > 0 && $l10nParentRecordUid === 0; } /** @@ -332,7 +327,7 @@ protected function getFieldConfigurationFromItemRecordPage(Item $item, int $lang try { $pageId = $this->getPageIdOfItem($item); $solrConfiguration = $this->frontendEnvironment->getSolrConfigurationFromPageId($pageId, $language, $item->getRootPageUid()); - return $solrConfiguration->getIndexQueueFieldsConfigurationByConfigurationName($indexConfigurationName, []); + return $solrConfiguration->getIndexQueueFieldsConfigurationByConfigurationName($indexConfigurationName); } catch (Throwable $e) { return []; } @@ -363,7 +358,7 @@ protected function getFieldConfigurationFromItemRootPage(Item $item, int $langua { $solrConfiguration = $this->frontendEnvironment->getSolrConfigurationFromPageId($item->getRootPageUid(), $language); - return $solrConfiguration->getIndexQueueFieldsConfigurationByConfigurationName($indexConfigurationName, []); + return $solrConfiguration->getIndexQueueFieldsConfigurationByConfigurationName($indexConfigurationName); } /** @@ -801,9 +796,7 @@ protected function isLanguageInAFreeContentMode(Item $item, int $language): bool $typo3site = $item->getSite()->getTypo3SiteObject(); $typo3siteLanguage = $typo3site->getLanguageById($language); $typo3siteLanguageFallbackType = $typo3siteLanguage->getFallbackType(); - if ($typo3siteLanguageFallbackType === 'free') { - return true; - } - return false; + + return $typo3siteLanguageFallbackType === 'free'; } } diff --git a/Classes/IndexQueue/Item.php b/Classes/IndexQueue/Item.php index e9679b6e7a..3481730cc6 100644 --- a/Classes/IndexQueue/Item.php +++ b/Classes/IndexQueue/Item.php @@ -180,8 +180,6 @@ public function __construct( /** * Getter for Index Queue UID - * - * @return int */ public function getIndexQueueUid(): ?int { @@ -200,41 +198,27 @@ public function getRootPageUid(): ?int /** * Returns mount point identifier - * - * @return string */ public function getMountPointIdentifier(): ?string { return $this->mountPointIdentifier; } - /** - * @param int $uid - */ public function setRootPageUid(int $uid) { $this->rootPageUid = $uid; } - /** - * @return string - */ public function getErrors(): string { return $this->errors; } - /** - * @return bool - */ public function getHasErrors(): bool { return trim($this->errors) !== ''; } - /** - * @return int - */ public function getState(): int { if ($this->getHasErrors()) { diff --git a/Classes/IndexQueue/RecordMonitor.php b/Classes/IndexQueue/RecordMonitor.php index 52e0a55ca1..c44299a0e5 100644 --- a/Classes/IndexQueue/RecordMonitor.php +++ b/Classes/IndexQueue/RecordMonitor.php @@ -135,7 +135,7 @@ public function processDatamap_afterDatabaseOperations( $recordPid = $fields['pid'] ?? null; if (is_null($recordPid) && MathUtility::canBeInterpretedAsInteger($recordUid)) { - $recordInfo = $tceMain->recordInfo($table, (int)$recordUid, 'pid'); + $recordInfo = $tceMain->recordInfo($table, (int)$recordUid); if (!is_null($recordInfo)) { $recordPid = $recordInfo['pid'] ?? null; } diff --git a/Classes/Report/SiteHandlingStatus.php b/Classes/Report/SiteHandlingStatus.php index 97f716c72f..611e923202 100644 --- a/Classes/Report/SiteHandlingStatus.php +++ b/Classes/Report/SiteHandlingStatus.php @@ -149,7 +149,7 @@ protected function generateValidationReportForSingleSite(Typo3Site $ypo3Site): S /** @scrutinizer ignore-type */ $renderedReport, /** @scrutinizer ignore-type */ - $globalPassedStateForThisSite == true ? ContextualFeedbackSeverity::OK : ContextualFeedbackSeverity::ERROR + $globalPassedStateForThisSite ? ContextualFeedbackSeverity::OK : ContextualFeedbackSeverity::ERROR ); } diff --git a/Classes/Routing/Enhancer/SolrFacetMaskAndCombineEnhancer.php b/Classes/Routing/Enhancer/SolrFacetMaskAndCombineEnhancer.php index fbfb8ed727..d37be309fb 100644 --- a/Classes/Routing/Enhancer/SolrFacetMaskAndCombineEnhancer.php +++ b/Classes/Routing/Enhancer/SolrFacetMaskAndCombineEnhancer.php @@ -155,7 +155,7 @@ protected function combineArrayParameters(array $parameters = []): array $parameterValueNew = $parameterValue; // Placeholder for cached URIs (type is the last part of the parameter value) - if (substr($parameterValue, 0, 3) === '###') { + if (str_starts_with($parameterValue, '###')) { $facetFieldElements = explode(':', $parameterValue); $facetField = array_pop($facetFieldElements); $facetField = substr($facetField, 0, strlen($facetField) - 3); diff --git a/Classes/Routing/RoutingService.php b/Classes/Routing/RoutingService.php index 978fde87f6..6432568860 100644 --- a/Classes/Routing/RoutingService.php +++ b/Classes/Routing/RoutingService.php @@ -51,22 +51,16 @@ class RoutingService implements LoggerAwareInterface /** * Settings from routing configuration - * - * @var array */ protected array $settings = []; /** * List of filter that are placed as path arguments - * - * @var array */ protected array $pathArguments = []; /** * Plugin/extension namespace - * - * @var string */ protected string $pluginNamespace = 'tx_solr'; @@ -84,21 +78,12 @@ class RoutingService implements LoggerAwareInterface 'type', ]; - /** - * @var UrlFacetService|null - */ protected ?UrlFacetService $urlFacetPathService = null; - /** - * @var UrlFacetService|null - */ protected ?UrlFacetService $urlFacetQueryService = null; /** * RoutingService constructor. - * - * @param array $settings - * @param string $pluginNamespace */ public function __construct(array $settings = [], string $pluginNamespace = self::PLUGIN_NAMESPACE) { @@ -112,9 +97,6 @@ public function __construct(array $settings = [], string $pluginNamespace = self /** * Creates a clone of the current service and replace the settings inside - * - * @param array $settings - * @return RoutingService */ public function withSettings(array $settings): RoutingService { @@ -126,9 +108,6 @@ public function withSettings(array $settings): RoutingService /** * Creates a clone of the current service and replace the settings inside - * - * @param array $pathArguments - * @return RoutingService */ public function withPathArguments(array $pathArguments): RoutingService { @@ -140,9 +119,6 @@ public function withPathArguments(array $pathArguments): RoutingService /** * Load configuration from routing configuration - * - * @param array $routingConfiguration - * @return $this */ public function fromRoutingConfiguration(array $routingConfiguration): RoutingService { @@ -166,8 +142,6 @@ public function fromRoutingConfiguration(array $routingConfiguration): RoutingSe /** * Reset the routing service - * - * @return $this */ public function reset(): RoutingService { @@ -179,8 +153,6 @@ public function reset(): RoutingService /** * Initialize url facet services for different types - * - * @return $this */ protected function initUrlFacetService(): RoutingService { @@ -190,17 +162,11 @@ protected function initUrlFacetService(): RoutingService return $this; } - /** - * @return UrlFacetService - */ public function getUrlFacetPathService(): UrlFacetService { return $this->urlFacetPathService; } - /** - * @return UrlFacetService - */ public function getUrlFacetQueryService(): UrlFacetService { return $this->urlFacetQueryService; @@ -210,8 +176,6 @@ public function getUrlFacetQueryService(): UrlFacetService * Test if the given parameter is a Core parameter * * @see \TYPO3\CMS\Frontend\Page\CacheHashCalculator::isCoreParameter - * @param string $parameterName - * @return bool */ public function isCoreParameter(string $parameterName): bool { @@ -221,8 +185,6 @@ public function isCoreParameter(string $parameterName): bool /** * This returns the plugin namespace * @see https://docs.typo3.org/p/apache-solr-for-typo3/solr/main/en-us/Configuration/Reference/TxSolrView.html#pluginnamespace - * - * @return string */ public function getPluginNamespace(): string { @@ -231,9 +193,6 @@ public function getPluginNamespace(): string /** * Determine if an enhancer is in use for Solr - * - * @param string $enhancerName - * @return bool */ public function isRouteEnhancerForSolr(string $enhancerName): bool { @@ -257,9 +216,6 @@ public function isRouteEnhancerForSolr(string $enhancerName): bool /** * Masks Solr filter inside the query parameters - * - * @param string $uriPath - * @return string */ public function finalizePathQuery(string $uriPath): string { @@ -286,7 +242,7 @@ public function finalizePathQuery(string $uriPath): string 2 ); - if ($this->isPathArgument((string)$facetName)) { + if ($this->isPathArgument($facetName)) { $queryValues[$i] = $facetValue; } } @@ -305,8 +261,6 @@ public function finalizePathQuery(string $uriPath): string /** * This method checks if the query parameter should be masked. - * - * @return bool */ public function shouldMaskQueryParameter(): bool { @@ -322,9 +276,6 @@ public function shouldMaskQueryParameter(): bool /** * Masks Solr filter inside the query parameters - * - * @param array $queryParams - * @return array */ public function maskQueryParameters(array $queryParams): array { @@ -385,9 +336,6 @@ public function maskQueryParameters(array $queryParams): array /** * Unmask incoming parameters if needed - * - * @param array $queryParams - * @return array */ public function unmaskQueryParameters(array $queryParams): array { @@ -439,8 +387,6 @@ public function unmaskQueryParameters(array $queryParams): array * There are following requirements: * - Masking is activated and the mal is valid or * - Concat is activated - * - * @return bool */ public function shouldConcatQueryParameters(): bool { @@ -459,8 +405,6 @@ public function shouldConcatQueryParameters(): bool * Returns the query parameter map * * Note TYPO3 core query arguments removed from the configured map! - * - * @return array */ public function getQueryParameterMap(): array { @@ -501,8 +445,6 @@ static function ($value) use ($self) { * taste:sour * ] * ] - * @param array $queryParams - * @return array */ public function concatQueryParameter(array $queryParams = []): array { @@ -538,9 +480,6 @@ public function concatQueryParameter(array $queryParams = []): array /** * This method expect a filter array that should be concat instead of the whole query - * - * @param array $filterArray - * @return array */ public function concatFilterValues(array $filterArray): array { @@ -594,9 +533,6 @@ public function concatFilterValues(array $filterArray): array * taste:sour * ] * ] - * - * @param array $queryParams - * @return array */ public function inflateQueryParameter(array $queryParams = []): array { @@ -650,9 +586,6 @@ public function inflateQueryParameter(array $queryParams = []): array /** * Cleanup the query parameters, to avoid empty solr arguments - * - * @param array $queryParams - * @return array */ public function cleanUpQueryParameters(array $queryParams): array { @@ -673,9 +606,6 @@ public function cleanUpQueryParameters(array $queryParams): array * avoid problems during separation of the values later. * * This mask has to be applied before contact the values - * - * @param array $facets - * @return string */ public function queryParameterFacetsToString(array $facets): string { @@ -686,14 +616,11 @@ public function queryParameterFacetsToString(array $facets): string /** * Returns the string which separates the facet from the value - * - * @param string $facetWithValue - * @return string */ public function detectFacetAndValueSeparator(string $facetWithValue): string { $separator = ':'; - if (mb_strpos($facetWithValue, '%3A') !== false) { + if (str_contains($facetWithValue, '%3A')) { $separator = '%3A'; } @@ -702,24 +629,14 @@ public function detectFacetAndValueSeparator(string $facetWithValue): string /** * Check if given facet value combination contains a separator - * - * @param string $facetWithValue - * @return bool */ public function containsFacetAndValueSeparator(string $facetWithValue): bool { - if (mb_strpos($facetWithValue, ':') === false && mb_strpos($facetWithValue, '%3A') === false) { - return false; - } - - return true; + return !(!str_contains($facetWithValue, ':') && !str_contains($facetWithValue, '%3A')); } /** * Cleanup facet values (strip type if needed) - * - * @param array $facetValues - * @return array */ public function cleanupFacetValues(array $facetValues): array { @@ -741,9 +658,6 @@ public function cleanupFacetValues(array $facetValues): array /** * Builds a string out of multiple facet values - * - * @param array $facets - * @return string */ public function pathFacetsToString(array $facets): string { @@ -756,9 +670,6 @@ public function pathFacetsToString(array $facets): string /** * Builds a string out of multiple facet values - * - * @param array $facets - * @return string */ public function facetsToString(array $facets): string { @@ -773,10 +684,6 @@ public function facetsToString(array $facets): string * This method is used in two different situation * 1. Middleware: Here the values should not be decoded * 2. Within the event listener CachedPathVariableModifier - * - * @param string $facets - * @param bool $decode - * @return array */ public function pathFacetStringToArray(string $facets, bool $decode = true): array { @@ -790,7 +697,6 @@ public function pathFacetStringToArray(string $facets, bool $decode = true): arr /** * Returns the multi value separator - * @return string */ public function getDefaultMultiValueSeparator(): string { @@ -799,9 +705,6 @@ public function getDefaultMultiValueSeparator(): string /** * Find an enhancer configuration by a given page id - * - * @param int $pageUid - * @return array */ public function fetchEnhancerByPageUid(int $pageUid): array { @@ -819,10 +722,6 @@ public function fetchEnhancerByPageUid(int $pageUid): array /** * Returns the route enhancer configuration by given site and page uid - * - * @param Site $site - * @param int $pageUid - * @return array */ public function fetchEnhancerInSiteConfigurationByPageUid(Site $site, int $pageUid): array { @@ -852,17 +751,14 @@ public function fetchEnhancerInSiteConfigurationByPageUid(Site $site, int $pageU /** * Add heading slash to given slug - * - * @param string $slug - * @return string */ public function cleanupHeadingSlash(string $slug): string { - if (mb_substr($slug, 0, 1) !== '/') { + if (!str_starts_with($slug, '/')) { return '/' . $slug; } - if (mb_substr($slug, 0, 2) === '//') { - return mb_substr($slug, 1, mb_strlen($slug) - 1); + if (str_starts_with($slug, '//')) { + return mb_substr($slug, 1); } return $slug; @@ -870,13 +766,10 @@ public function cleanupHeadingSlash(string $slug): string /** * Add heading slash to given slug - * - * @param string $slug - * @return string */ public function addHeadingSlash(string $slug): string { - if (mb_substr($slug, 0, 1) === '/') { + if (str_starts_with($slug, '/')) { return $slug; } @@ -885,24 +778,18 @@ public function addHeadingSlash(string $slug): string /** * Remove heading slash from given slug - * - * @param string $slug - * @return string */ public function removeHeadingSlash(string $slug): string { - if (mb_substr($slug, 0, 1) !== '/') { + if (!str_starts_with($slug, '/')) { return $slug; } - return mb_substr($slug, 1, mb_strlen($slug) - 1); + return mb_substr($slug, 1); } /** * Retrieve the site by given UID - * - * @param int $pageUid - * @return SiteInterface */ public function findSiteByUid(int $pageUid): SiteInterface { @@ -914,10 +801,6 @@ public function findSiteByUid(int $pageUid): SiteInterface } } - /** - * @param Site $site - * @return PageSlugCandidateProvider - */ public function getSlugCandidateProvider(Site $site): PageSlugCandidateProvider { $context = GeneralUtility::makeInstance(Context::class); @@ -931,9 +814,6 @@ public function getSlugCandidateProvider(Site $site): PageSlugCandidateProvider /** * Convert the base string into a URI object - * - * @param string $base - * @return UriInterface|null */ public function convertStringIntoUri(string $base): ?UriInterface { @@ -950,10 +830,6 @@ public function convertStringIntoUri(string $base): ?UriInterface /** * In order to search for a path, a possible language prefix need to remove - * - * @param SiteLanguage $language - * @param string $path - * @return string */ public function stripLanguagePrefixFromPath(SiteLanguage $language, string $path): string { @@ -963,8 +839,8 @@ public function stripLanguagePrefixFromPath(SiteLanguage $language, string $path $pathLength = mb_strlen($language->getBase()->getPath()); - $path = mb_substr($path, $pathLength, mb_strlen($path) - $pathLength); - if (mb_substr($path, 0, 1) !== '/') { + $path = mb_substr($path, $pathLength); + if (!str_starts_with($path, '/')) { $path = '/' . $path; } @@ -973,11 +849,6 @@ public function stripLanguagePrefixFromPath(SiteLanguage $language, string $path /** * Enrich the current query Params with data from path information - * - * @param ServerRequestInterface $request - * @param array $arguments - * @param array $parameters - * @return ServerRequestInterface */ public function addPathArgumentsToQuery( ServerRequestInterface $request, @@ -1009,35 +880,22 @@ public function addPathArgumentsToQuery( /** * Check if given argument is a mapping argument - * - * @param string $facetName - * @return bool */ public function isMappingArgument(string $facetName): bool { $map = $this->getQueryParameterMap(); - if (isset($map[$facetName]) && $this->shouldMaskQueryParameter()) { - return true; - } - return false; + return isset($map[$facetName]) && $this->shouldMaskQueryParameter(); } /** * Check if given facet type is a path argument - * - * @param string $facetName - * @return bool */ public function isPathArgument(string $facetName): bool { return isset($this->pathArguments[$facetName]); } - /** - * @param string $variable - * @return string - */ public function reviewVariable(string $variable): string { if (!$this->containsFacetAndValueSeparator($variable)) { @@ -1052,9 +910,6 @@ public function reviewVariable(string $variable): string /** * Remove type prefix from filter - * - * @param array $variables - * @return array */ public function reviseFilterVariables(array $variables): array { @@ -1093,12 +948,6 @@ public function reviseFilterVariables(array $variables): array * tx_solr: * filter: * - type:household - * - * @param array $queryParams - * @param string $fieldName - * @param array $parameters - * @param array $pathElements - * @return array */ protected function processUriPathArgument( array $queryParams, @@ -1140,21 +989,11 @@ protected function processUriPathArgument( return $queryParams; } - /** - * Return site matcher - * - * @return SiteMatcher - */ public function getSiteMatcher(): SiteMatcher { return GeneralUtility::makeInstance(SiteMatcher::class); } - /** - * Returns the site finder - * - * @return SiteFinder - */ protected function getSiteFinder(): SiteFinder { return GeneralUtility::makeInstance(SiteFinder::class); diff --git a/Classes/Search.php b/Classes/Search.php index 3dda5581f1..270318e752 100644 --- a/Classes/Search.php +++ b/Classes/Search.php @@ -95,8 +95,6 @@ public function __construct(SolrConnection $solrConnection = null) /** * Gets the Solr connection used by this search. - * - * @return SolrConnection Solr connection */ public function getSolrConnection(): ?SolrConnection { @@ -127,7 +125,7 @@ public function setSolrConnection(SolrConnection $solrConnection) * @param Query $query The query with keywords, filters, and so on. * @param int $offset Result offset for pagination. * @param int|null $limit Maximum number of results to return. If set to NULL, this value is taken from the query object. - * @return ResponseAdapter Solr response + * @return ResponseAdapter|null Solr response */ public function search(Query $query, int $offset = 0, ?int $limit = null): ?ResponseAdapter { diff --git a/Classes/System/Configuration/ConfigurationManager.php b/Classes/System/Configuration/ConfigurationManager.php index 3fb409d888..90f626e0de 100644 --- a/Classes/System/Configuration/ConfigurationManager.php +++ b/Classes/System/Configuration/ConfigurationManager.php @@ -56,11 +56,9 @@ public function getTypoScriptConfiguration(array $configurationArray = null, int if ($configurationArray == null) { if (isset($this->typoScriptConfigurations['default'])) { $configurationArray = $this->typoScriptConfigurations['default']; - } else { - if (!empty($GLOBALS['TSFE']->tmpl->setup) && is_array($GLOBALS['TSFE']->tmpl->setup)) { - $configurationArray = $GLOBALS['TSFE']->tmpl->setup; - $this->typoScriptConfigurations['default'] = $configurationArray; - } + } elseif (!empty($GLOBALS['TSFE']->tmpl->setup) && is_array($GLOBALS['TSFE']->tmpl->setup)) { + $configurationArray = $GLOBALS['TSFE']->tmpl->setup; + $this->typoScriptConfigurations['default'] = $configurationArray; } } diff --git a/Classes/System/Configuration/ConfigurationPageResolver.php b/Classes/System/Configuration/ConfigurationPageResolver.php index 52ff93eca6..b8fbd41426 100644 --- a/Classes/System/Configuration/ConfigurationPageResolver.php +++ b/Classes/System/Configuration/ConfigurationPageResolver.php @@ -56,7 +56,6 @@ public function __construct(?TwoLevelCache $twoLevelCache = null, ?SystemTemplat * The result is stored in the runtime cache. * * @param int $startPageId - * @return int * @throws DBALDriverException */ public function getClosestPageIdWithActiveTemplate(int $startPageId): ?int @@ -81,7 +80,6 @@ public function getClosestPageIdWithActiveTemplate(int $startPageId): ?int * This method fetches the rootLine and calculates the id of the closest template in the rootLine. * * @param int $startPageId - * @return int * @throws DBALDriverException */ protected function calculateClosestPageIdWithActiveTemplate(int $startPageId): ?int diff --git a/Classes/System/Configuration/TypoScriptConfiguration.php b/Classes/System/Configuration/TypoScriptConfiguration.php index ce2b236cca..b0b1a22c18 100644 --- a/Classes/System/Configuration/TypoScriptConfiguration.php +++ b/Classes/System/Configuration/TypoScriptConfiguration.php @@ -174,7 +174,7 @@ public function getValueByPathOrDefaultValue(string $path, $defaultValue) */ public function getObjectByPath(string $path) { - if (substr($path, -1) !== '.') { + if (!str_ends_with($path, '.')) { $path = rtrim($path, '.'); $path = substr($path, 0, strrpos($path, '.') + 1); } @@ -583,14 +583,14 @@ public function getEnabledIndexQueueConfigurationNames(array $defaultIfEmpty = [ { $tablesToIndex = []; $path = 'plugin.tx_solr.index.queue.'; - $indexQueueConfiguration = $this->getObjectByPathOrDefault($path, []); + $indexQueueConfiguration = $this->getObjectByPathOrDefault($path); foreach ($indexQueueConfiguration as $configurationName => $indexingEnabled) { - if (substr($configurationName, -1) != '.' && $indexingEnabled) { + if (!str_ends_with($configurationName, '.') && $indexingEnabled) { $tablesToIndex[] = $configurationName; } } - return count($tablesToIndex) == 0 ? $defaultIfEmpty : $tablesToIndex; + return count($tablesToIndex) === 0 ? $defaultIfEmpty : $tablesToIndex; } /** @@ -669,11 +669,11 @@ public function getIndexQueueAdditionalWhereClauseByConfigurationName(string $co public function getIndexQueueConfigurationNamesByTableName(string $tableName, array $defaultIfEmpty = []): array { $path = 'plugin.tx_solr.index.queue.'; - $configuration = $this->getObjectByPathOrDefault($path, []); + $configuration = $this->getObjectByPathOrDefault($path); $possibleConfigurations = []; foreach ($configuration as $configurationName => $indexingEnabled) { - $isObject = substr($configurationName, -1) === '.'; + $isObject = str_ends_with($configurationName, '.'); if ($isObject || !$indexingEnabled) { continue; } @@ -2111,7 +2111,7 @@ public function getViewTemplateByFileKey(string $fileKey, string $defaultIfEmpty */ public function getAvailableTemplatesByFileKey(string $fileKey): array { - return $this->getObjectByPathOrDefault('plugin.tx_solr.view.templateFiles.' . $fileKey . '.availableTemplates.', []); + return $this->getObjectByPathOrDefault('plugin.tx_solr.view.templateFiles.' . $fileKey . '.availableTemplates.'); } /** @@ -2258,7 +2258,7 @@ public function getSearchGroupingSortBy(string $defaultIfEmpty = ''): string */ public function getSearchGroupingHighestGroupResultsLimit(?int $defaultIfEmpty = 1): int { - $groupingConfiguration = $this->getObjectByPathOrDefault('plugin.tx_solr.search.grouping.', []); + $groupingConfiguration = $this->getObjectByPathOrDefault('plugin.tx_solr.search.grouping.'); $highestLimit = $defaultIfEmpty; if (!empty($groupingConfiguration['numberOfResultsPerGroup'])) { $highestLimit = $groupingConfiguration['numberOfResultsPerGroup']; @@ -2284,10 +2284,6 @@ public function getSearchGroupingHighestGroupResultsLimit(?int $defaultIfEmpty = * * plugin.tx_solr.search.grouping.groups..numberOfResultsPerGroup if it is set otherwise * plugin.tx_solr.search.grouping.numberOfResultsPerGroup - * - * @param string $groupName - * @param ?int $defaultIfEmpty - * @return int */ public function getSearchGroupingResultLimit(string $groupName, ?int $defaultIfEmpty = 1): ?int { diff --git a/Classes/System/DateTime/FormatService.php b/Classes/System/DateTime/FormatService.php index fda39be807..fb2d1621aa 100644 --- a/Classes/System/DateTime/FormatService.php +++ b/Classes/System/DateTime/FormatService.php @@ -36,9 +36,8 @@ class FormatService * @param string $outputFormat The output format, when nothing is passed * $GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'] will be used or Y-m-d when nothing is configured * @param DateTimeZone|null $timezone - * @return \DateTime|string */ - public function format($input = '', $inputFormat = 'Y-m-d\TH:i:s\Z', $outputFormat = '', $timezone = null) + public function format($input = '', $inputFormat = 'Y-m-d\TH:i:s\Z', $outputFormat = '', $timezone = null): string { if ($outputFormat === '') { // when no value was passed we us the TYPO3 configured or fallback to Y-m-d diff --git a/Classes/System/Logging/DebugWriter.php b/Classes/System/Logging/DebugWriter.php index 797c9edf38..19e32dc0ff 100644 --- a/Classes/System/Logging/DebugWriter.php +++ b/Classes/System/Logging/DebugWriter.php @@ -95,7 +95,7 @@ protected function writeDebugMessage($level, $message, $data) $parameters = ['extKey' => 'solr', 'msg' => $message, 'level' => $level, 'data' => $data]; $message = $parameters['msg'] ?? ''; if (ApplicationType::fromRequest($GLOBALS['TYPO3_REQUEST'])->isBackend()) { - DebugUtility::debug($parameters, $parameters['extKey'], 'DevLog ext:solr: ' . $message); + DebugUtility::debug($parameters, $parameters['extKey']); } else { echo $message . ':
'; DebuggerUtility::var_dump($parameters); diff --git a/Classes/System/Mvc/Backend/ModuleData.php b/Classes/System/Mvc/Backend/ModuleData.php index bd7b4de6a0..f02a7d8295 100644 --- a/Classes/System/Mvc/Backend/ModuleData.php +++ b/Classes/System/Mvc/Backend/ModuleData.php @@ -36,8 +36,6 @@ class ModuleData /** * Gets the site to work with. - * - * @return Site */ public function getSite(): ?Site { @@ -46,10 +44,8 @@ public function getSite(): ?Site /** * Sets the site to work with. - * - * @param Site $site */ - public function setSite(Site $site) + public function setSite(Site $site): void { $this->site = $site; } diff --git a/Classes/System/Records/SystemTemplate/SystemTemplateRepository.php b/Classes/System/Records/SystemTemplate/SystemTemplateRepository.php index e903205d01..74ecd69db8 100644 --- a/Classes/System/Records/SystemTemplate/SystemTemplateRepository.php +++ b/Classes/System/Records/SystemTemplate/SystemTemplateRepository.php @@ -36,8 +36,6 @@ class SystemTemplateRepository extends AbstractRepository * * This method expects one startPageId, which must be inside the root line and does not check if it is one in the root line. * - * @param array $rootLine - * @return int * @throws DBALDriverException * @throws DBALException|\Doctrine\DBAL\DBALException */ diff --git a/Classes/System/Solr/Document/Document.php b/Classes/System/Solr/Document/Document.php index f5d0f57307..8fb1e27185 100644 --- a/Classes/System/Solr/Document/Document.php +++ b/Classes/System/Solr/Document/Document.php @@ -36,7 +36,7 @@ class Document extends SolariumDocument */ public function __call(string $name, array $arguments) { - if (substr($name, 0, 3) == 'get') { + if (str_starts_with($name, 'get')) { $field = substr($name, 3); $field = strtolower($field[0]) . substr($field, 1); return $this->fields[$field] ?? null; diff --git a/Classes/System/Solr/Parser/SynonymParser.php b/Classes/System/Solr/Parser/SynonymParser.php index 219d25238c..120760c242 100644 --- a/Classes/System/Solr/Parser/SynonymParser.php +++ b/Classes/System/Solr/Parser/SynonymParser.php @@ -37,10 +37,8 @@ public function parseJson(string $baseWord, string $jsonString): array if (is_array($decodedResponse->{$baseWord})) { $synonyms = $decodedResponse->{$baseWord}; } - } else { - if (isset($decodedResponse->synonymMappings->managedMap)) { - $synonyms = (array)$decodedResponse->synonymMappings->managedMap; - } + } elseif (isset($decodedResponse->synonymMappings->managedMap)) { + $synonyms = (array)$decodedResponse->synonymMappings->managedMap; } return $synonyms; diff --git a/Classes/System/Solr/Service/AbstractSolrService.php b/Classes/System/Solr/Service/AbstractSolrService.php index 9286382bf3..48b251b391 100644 --- a/Classes/System/Solr/Service/AbstractSolrService.php +++ b/Classes/System/Solr/Service/AbstractSolrService.php @@ -115,9 +115,6 @@ public function __toString() return $endpoint->getScheme() . '://' . $endpoint->getHost() . ':' . $endpoint->getPort() . $endpoint->getPath() . '/' . $endpoint->getCore() . '/'; } - /** - * @return Endpoint|null - */ public function getPrimaryEndpoint(): Endpoint { return $this->client->getEndpoint(); @@ -281,7 +278,7 @@ protected function buildLogDataFromResponse( $logData['content'] = $contentSend; } - if (!empty($e)) { + if ($e !== null) { $logData['exception'] = $e->__toString(); return $logData; } diff --git a/Classes/System/Solr/Service/SolrAdminService.php b/Classes/System/Solr/Service/SolrAdminService.php index ca79d462d5..f8db020fb6 100644 --- a/Classes/System/Solr/Service/SolrAdminService.php +++ b/Classes/System/Solr/Service/SolrAdminService.php @@ -208,7 +208,7 @@ public function getSystemInformation(): ResponseAdapter * Gets the name of the solrconfig.xml file installed and in use on the Solr * server. * - * @return string Name of the active solrconfig.xml + * @return string|null Name of the active solrconfig.xml */ public function getSolrconfigName(): ?string { diff --git a/Classes/System/Solr/SolrCommunicationException.php b/Classes/System/Solr/SolrCommunicationException.php index d2c35f80c8..54b39e3098 100644 --- a/Classes/System/Solr/SolrCommunicationException.php +++ b/Classes/System/Solr/SolrCommunicationException.php @@ -24,23 +24,14 @@ */ class SolrCommunicationException extends RuntimeException { - /** - * @var ResponseAdapter|null - */ protected ?ResponseAdapter $solrResponse = null; - /** - * @return ResponseAdapter - */ public function getSolrResponse(): ?ResponseAdapter { return $this->solrResponse; } - /** - * @param ResponseAdapter $solrResponse - */ - public function setSolrResponse(ResponseAdapter $solrResponse) + public function setSolrResponse(ResponseAdapter $solrResponse): void { $this->solrResponse = $solrResponse; } diff --git a/Classes/System/TCA/TCAService.php b/Classes/System/TCA/TCAService.php index 235640b544..6497f8e296 100644 --- a/Classes/System/TCA/TCAService.php +++ b/Classes/System/TCA/TCAService.php @@ -71,19 +71,13 @@ protected function getTime(): int */ public function isEnabledRecord(string $table, array $record): bool { - if ( - (empty($record)) + return !((empty($record)) || (isset($this->tca[$table]['ctrl']['enablecolumns']['disabled']) && !empty($record[$this->tca[$table]['ctrl']['enablecolumns']['disabled']])) || (isset($this->tca[$table]['ctrl']['delete']) && !empty($record[$this->tca[$table]['ctrl']['delete']])) || - ($table === 'pages' && !empty($record['no_search'])) - ) { - return false; - } - - return true; + ($table === 'pages' && !empty($record['no_search']))); } /** diff --git a/Classes/System/UserFunctions/FlexFormUserFunctions.php b/Classes/System/UserFunctions/FlexFormUserFunctions.php index 32eab0a16d..996019aeb4 100644 --- a/Classes/System/UserFunctions/FlexFormUserFunctions.php +++ b/Classes/System/UserFunctions/FlexFormUserFunctions.php @@ -102,7 +102,6 @@ protected function getParsedSolrFieldsFromSchema(array $configuredFacets, array * Retrieves the configured facets for a page. * * @param int|null $pid - * @return array * @throws DBALDriverException * @todo: Fix type hinting properly */ diff --git a/Classes/System/Validator/Path.php b/Classes/System/Validator/Path.php index 5e123360cb..f91532d1b2 100644 --- a/Classes/System/Validator/Path.php +++ b/Classes/System/Validator/Path.php @@ -32,10 +32,6 @@ public function isValidSolrPath($path) { $path = trim($path); - if ((!empty($path)) && (preg_match('/^[^*?"<>|:#]*$/', $path))) { - return true; - } - - return false; + return (!empty($path)) && (preg_match('/^[^*?"<>|:#]*$/', $path)); } } diff --git a/Classes/Task/OptimizeIndexTaskAdditionalFieldProvider.php b/Classes/Task/OptimizeIndexTaskAdditionalFieldProvider.php index 5f880cd0b7..d1541469ea 100644 --- a/Classes/Task/OptimizeIndexTaskAdditionalFieldProvider.php +++ b/Classes/Task/OptimizeIndexTaskAdditionalFieldProvider.php @@ -255,9 +255,6 @@ public function saveAdditionalFields( setCoresToOptimizeIndex($cores); } - /** - * @return PageRenderer - */ protected function getPageRenderer(): ?PageRenderer { if (!isset($this->pageRenderer)) { @@ -268,9 +265,6 @@ protected function getPageRenderer(): ?PageRenderer /** * Check that a task is an instance of ReIndexTask - * - * @param ?AbstractTask $task - * @return bool */ protected function isTaskInstanceofOptimizeIndexTask(?AbstractTask $task): bool { @@ -284,9 +278,6 @@ protected function isTaskInstanceofOptimizeIndexTask(?AbstractTask $task): bool return true; } - /** - * @return LanguageService - */ protected function getLanguageService(): LanguageService { return $GLOBALS['LANG']; diff --git a/Classes/Utility/ParameterSortingUtility.php b/Classes/Utility/ParameterSortingUtility.php index be470685c3..479bab9193 100644 --- a/Classes/Utility/ParameterSortingUtility.php +++ b/Classes/Utility/ParameterSortingUtility.php @@ -34,13 +34,10 @@ class ParameterSortingUtility */ public static function sortByType(array &$parameters, string $type = 'index'): array { - switch ($type) { - case 'assoc': - return self::sortByIndex($parameters); - case 'index': - default: - return self::sortByValue($parameters); - } + return match ($type) { + 'assoc' => self::sortByIndex($parameters), + default => self::sortByValue($parameters), + }; } /** diff --git a/Classes/ViewHelpers/Debug/QueryViewHelper.php b/Classes/ViewHelpers/Debug/QueryViewHelper.php index 8a9dd505c8..0c645553aa 100644 --- a/Classes/ViewHelpers/Debug/QueryViewHelper.php +++ b/Classes/ViewHelpers/Debug/QueryViewHelper.php @@ -54,21 +54,23 @@ public static function renderStatic(array $arguments, Closure $renderChildrenClo $content = ''; $resultSet = self::getUsedSearchResultSetFromRenderingContext($renderingContext); $backendUserIsLoggedIn = GeneralUtility::makeInstance(Context::class)->getPropertyFromAspect('backend.user', 'isLoggedIn'); - if ($backendUserIsLoggedIn === true && $resultSet && $resultSet->getUsedSearch() !== null) { - if ( - $resultSet->getHasSearched() === true - && $resultSet->getUsedSearch()->getDebugResponse() !== null - && !empty($resultSet->getUsedSearch()->getDebugResponse()->parsedquery) - ) { - $renderingContext->getVariableProvider()->add('parsedQuery', $resultSet->getUsedSearch()->getDebugResponse()->parsedquery); - $content = $renderChildrenClosure(); - $renderingContext->getVariableProvider()->remove('parsedQuery'); + if ( + $backendUserIsLoggedIn === true + && $resultSet + && $resultSet->getUsedSearch() !== null + && $resultSet->getHasSearched() === true + && $resultSet->getUsedSearch()->getDebugResponse() !== null + && !empty($resultSet->getUsedSearch()->getDebugResponse()->parsedquery) + ) { + $renderingContext->getVariableProvider()->add('parsedQuery', $resultSet->getUsedSearch()->getDebugResponse()->parsedquery); + $content = $renderChildrenClosure(); + $renderingContext->getVariableProvider()->remove('parsedQuery'); - if ($content === null) { - $content = '
Parsed Query:
' . htmlspecialchars($resultSet->getUsedSearch()->getDebugResponse()->parsedquery); - } + if ($content === null) { + $content = '
Parsed Query:
' . htmlspecialchars($resultSet->getUsedSearch()->getDebugResponse()->parsedquery); } } + return $content; } } diff --git a/Classes/ViewHelpers/Document/RelevanceViewHelper.php b/Classes/ViewHelpers/Document/RelevanceViewHelper.php index 84050420f4..504d7e5082 100644 --- a/Classes/ViewHelpers/Document/RelevanceViewHelper.php +++ b/Classes/ViewHelpers/Document/RelevanceViewHelper.php @@ -42,7 +42,7 @@ public function initializeArguments() parent::initializeArguments(); $this->registerArgument('resultSet', SearchResultSet::class, 'The context searchResultSet', true); $this->registerArgument('document', SearchResult::class, 'The document to highlight', true); - $this->registerArgument('maximumScore', 'float', 'The maximum score that should be used for percentage calculation, if nothing is passed the maximum from the resultSet is used', false); + $this->registerArgument('maximumScore', 'float', 'The maximum score that should be used for percentage calculation, if nothing is passed the maximum from the resultSet is used'); } /** diff --git a/Classes/ViewHelpers/Facet/Area/GroupViewHelper.php b/Classes/ViewHelpers/Facet/Area/GroupViewHelper.php index ff985652b8..0ebef454aa 100644 --- a/Classes/ViewHelpers/Facet/Area/GroupViewHelper.php +++ b/Classes/ViewHelpers/Facet/Area/GroupViewHelper.php @@ -55,7 +55,7 @@ public static function renderStatic(array $arguments, \Closure $renderChildrenCl { /** @var $facets FacetCollection */ $facets = $arguments['facets']; - $requiredGroup = isset($arguments['groupName']) ? $arguments['groupName'] : 'main'; + $requiredGroup = $arguments['groupName'] ?? 'main'; $filtered = $facets->getByGroupName($requiredGroup); $templateVariableProvider = $renderingContext->getVariableProvider(); diff --git a/Classes/ViewHelpers/FrequentlySearchedViewHelper.php b/Classes/ViewHelpers/FrequentlySearchedViewHelper.php index e8890e1c0a..b92fcffc20 100644 --- a/Classes/ViewHelpers/FrequentlySearchedViewHelper.php +++ b/Classes/ViewHelpers/FrequentlySearchedViewHelper.php @@ -100,9 +100,7 @@ protected static function getInitializedCache(): ?FrontendInterface /** * Enrich the frequentSearches * - * @param array Frequent search terms as array with terms as keys and hits as the value - * @param int $minimumSize - * @param int $maximumSize + * @param array $frequentSearchTerms Frequent search terms as array with terms as keys and hits as the value * @return array An array with content for the frequent terms markers */ protected static function enrichFrequentSearchesInfo(array $frequentSearchTerms, int $minimumSize, int $maximumSize): array @@ -112,7 +110,7 @@ protected static function enrichFrequentSearchesInfo(array $frequentSearchTerms, $maximumHits = max(array_values($frequentSearchTerms)); $minimumHits = min(array_values($frequentSearchTerms)); $spread = $maximumHits - $minimumHits; - $step = ($spread == 0) ? 1 : ($maximumSize - $minimumSize) / $spread; + $step = ($spread === 0) ? 1 : ($maximumSize - $minimumSize) / $spread; foreach ($frequentSearchTerms as $term => $hits) { $size = round($minimumSize + (($hits - $minimumHits) * $step)); diff --git a/Classes/ViewHelpers/Uri/Facet/AbstractValueViewHelper.php b/Classes/ViewHelpers/Uri/Facet/AbstractValueViewHelper.php index 218334c51c..c27778b7b9 100644 --- a/Classes/ViewHelpers/Uri/Facet/AbstractValueViewHelper.php +++ b/Classes/ViewHelpers/Uri/Facet/AbstractValueViewHelper.php @@ -34,11 +34,11 @@ abstract class AbstractValueViewHelper extends AbstractUriViewHelper public function initializeArguments() { parent::initializeArguments(); - $this->registerArgument('facet', AbstractFacet::class, 'The facet', false, null); - $this->registerArgument('facetName', 'string', 'The facet name', false, null); - $this->registerArgument('facetItem', AbstractFacetItem::class, 'The facet item', false, null); - $this->registerArgument('facetItemValue', 'string', 'The facet item', false, null); - $this->registerArgument('resultSet', SearchResultSet::class, 'The result set', false, null); + $this->registerArgument('facet', AbstractFacet::class, 'The facet'); + $this->registerArgument('facetName', 'string', 'The facet name'); + $this->registerArgument('facetItem', AbstractFacetItem::class, 'The facet item'); + $this->registerArgument('facetItemValue', 'string', 'The facet item'); + $this->registerArgument('resultSet', SearchResultSet::class, 'The result set'); } /** diff --git a/Classes/ViewHelpers/Uri/Facet/AddFacetItemViewHelper.php b/Classes/ViewHelpers/Uri/Facet/AddFacetItemViewHelper.php index d53276ea19..d28274a948 100644 --- a/Classes/ViewHelpers/Uri/Facet/AddFacetItemViewHelper.php +++ b/Classes/ViewHelpers/Uri/Facet/AddFacetItemViewHelper.php @@ -40,7 +40,6 @@ public static function renderStatic(array $arguments, \Closure $renderChildrenCl $itemValue = self::getValueFromArguments($arguments); $resultSet = self::getResultSetFromArguments($arguments); $previousRequest = $resultSet->getUsedSearchRequest(); - $uri = self::getSearchUriBuilder($renderingContext)->getAddFacetValueUri($previousRequest, $name, $itemValue); - return $uri; + return self::getSearchUriBuilder($renderingContext)->getAddFacetValueUri($previousRequest, $name, $itemValue); } } diff --git a/Classes/ViewHelpers/Uri/Facet/RemoveFacetItemViewHelper.php b/Classes/ViewHelpers/Uri/Facet/RemoveFacetItemViewHelper.php index 345e623eb5..db41a2fe9d 100644 --- a/Classes/ViewHelpers/Uri/Facet/RemoveFacetItemViewHelper.php +++ b/Classes/ViewHelpers/Uri/Facet/RemoveFacetItemViewHelper.php @@ -40,7 +40,7 @@ public static function renderStatic(array $arguments, \Closure $renderChildrenCl $itemValue = self::getValueFromArguments($arguments); $resultSet = self::getResultSetFromArguments($arguments); $previousRequest = $resultSet->getUsedSearchRequest(); - $uri = self::getSearchUriBuilder($renderingContext)->getRemoveFacetValueUri($previousRequest, $name, $itemValue); - return $uri; + + return self::getSearchUriBuilder($renderingContext)->getRemoveFacetValueUri($previousRequest, $name, $itemValue); } } diff --git a/Classes/ViewHelpers/Uri/Facet/RemoveFacetViewHelper.php b/Classes/ViewHelpers/Uri/Facet/RemoveFacetViewHelper.php index bd2d14678c..6fa9a0a770 100644 --- a/Classes/ViewHelpers/Uri/Facet/RemoveFacetViewHelper.php +++ b/Classes/ViewHelpers/Uri/Facet/RemoveFacetViewHelper.php @@ -48,7 +48,7 @@ public static function renderStatic(array $arguments, \Closure $renderChildrenCl /** @var $facet AbstractFacet */ $facet = $arguments['facet']; $previousRequest = $facet->getResultSet()->getUsedSearchRequest(); - $uri = self::getSearchUriBuilder($renderingContext)->getRemoveFacetUri($previousRequest, $facet->getName()); - return $uri; + + return self::getSearchUriBuilder($renderingContext)->getRemoveFacetUri($previousRequest, $facet->getName()); } } diff --git a/Classes/ViewHelpers/Uri/Facet/SetFacetItemViewHelper.php b/Classes/ViewHelpers/Uri/Facet/SetFacetItemViewHelper.php index 8cad9f2604..6621330181 100644 --- a/Classes/ViewHelpers/Uri/Facet/SetFacetItemViewHelper.php +++ b/Classes/ViewHelpers/Uri/Facet/SetFacetItemViewHelper.php @@ -40,7 +40,7 @@ public static function renderStatic(array $arguments, \Closure $renderChildrenCl $itemValue = self::getValueFromArguments($arguments); $resultSet = self::getResultSetFromArguments($arguments); $previousRequest = $resultSet->getUsedSearchRequest(); - $uri = self::getSearchUriBuilder($renderingContext)->getSetFacetValueUri($previousRequest, $name, $itemValue); - return $uri; + + return self::getSearchUriBuilder($renderingContext)->getSetFacetValueUri($previousRequest, $name, $itemValue); } } diff --git a/Classes/ViewHelpers/Uri/Search/CurrentSearchViewHelper.php b/Classes/ViewHelpers/Uri/Search/CurrentSearchViewHelper.php index b4f1bd09c2..4b342086d3 100644 --- a/Classes/ViewHelpers/Uri/Search/CurrentSearchViewHelper.php +++ b/Classes/ViewHelpers/Uri/Search/CurrentSearchViewHelper.php @@ -35,7 +35,6 @@ class CurrentSearchViewHelper extends AbstractUriViewHelper public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext) { $previousRequest = static::getUsedSearchRequestFromRenderingContext($renderingContext); - $uri = self::getSearchUriBuilder($renderingContext)->getCurrentSearchUri($previousRequest); - return $uri; + return self::getSearchUriBuilder($renderingContext)->getCurrentSearchUri($previousRequest); } } diff --git a/Classes/ViewHelpers/Uri/Sorting/RemoveSortingViewHelper.php b/Classes/ViewHelpers/Uri/Sorting/RemoveSortingViewHelper.php index c70cea95d2..07a4e18059 100644 --- a/Classes/ViewHelpers/Uri/Sorting/RemoveSortingViewHelper.php +++ b/Classes/ViewHelpers/Uri/Sorting/RemoveSortingViewHelper.php @@ -35,7 +35,7 @@ class RemoveSortingViewHelper extends AbstractUriViewHelper public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext) { $previousRequest = static::getUsedSearchRequestFromRenderingContext($renderingContext); - $uri = self::getSearchUriBuilder($renderingContext)->getRemoveSortingUri($previousRequest); - return $uri; + + return self::getSearchUriBuilder($renderingContext)->getRemoveSortingUri($previousRequest); } } diff --git a/Classes/ViewHelpers/Uri/Sorting/SetSortingViewHelper.php b/Classes/ViewHelpers/Uri/Sorting/SetSortingViewHelper.php index 96ae600f6e..068109b4ac 100644 --- a/Classes/ViewHelpers/Uri/Sorting/SetSortingViewHelper.php +++ b/Classes/ViewHelpers/Uri/Sorting/SetSortingViewHelper.php @@ -47,7 +47,7 @@ public static function renderStatic(array $arguments, \Closure $renderChildrenCl $sortingName = $arguments['sortingName']; $sortingDirection = $arguments['sortingDirection']; $previousRequest = static::getUsedSearchRequestFromRenderingContext($renderingContext); - $uri = self::getSearchUriBuilder($renderingContext)->getSetSortingUri($previousRequest, $sortingName, $sortingDirection); - return $uri; + + return self::getSearchUriBuilder($renderingContext)->getSetSortingUri($previousRequest, $sortingName, $sortingDirection); } }