From ef0d460286a82357828e5b165d515809c885efd6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20K=C3=A4hm?= Date: Mon, 13 May 2024 15:29:42 +0200 Subject: [PATCH] [BUGFIX] Fix TYPO3 coding standards Relates: #3995 --- .../Search/CoreOptimizationModuleController.php | 2 +- .../Index/Queue/UpdateHandler/GarbageHandler.php | 2 +- .../Search/ApacheSolrDocument/Repository.php | 2 +- .../Domain/Search/Query/AbstractQueryBuilder.php | 6 +++--- .../Domain/Search/Query/ParameterBuilder/Slops.php | 2 +- .../Facets/AbstractFacetItemCollection.php | 2 +- .../Search/ResultSet/Facets/FacetCollection.php | 8 ++++---- .../OptionBased/Hierarchy/HierarchyFacetParser.php | 2 +- .../Facets/OptionBased/Hierarchy/HierarchyTool.php | 2 +- .../Facets/OptionBased/OptionCollection.php | 2 +- .../Search/ResultSet/Facets/UrlFacetContainer.php | 8 ++++---- .../Search/ResultSet/Sorting/SortingHelper.php | 2 +- Classes/Domain/Search/Uri/SearchUriBuilder.php | 6 +++--- Classes/Domain/Site/SiteRepository.php | 2 +- Classes/FrontendEnvironment/Tsfe.php | 2 +- .../FrontendHelper/UserGroupDetector.php | 2 +- Classes/IndexQueue/Indexer.php | 2 +- Classes/Routing/RoutingService.php | 2 +- .../Configuration/ExtensionConfiguration.php | 4 ++-- .../System/Solr/Service/AbstractSolrService.php | 4 ++-- .../System/UserFunctions/FlexFormUserFunctions.php | 4 ++-- Classes/Task/EventQueueWorkerTask.php | 2 +- .../Domain/Index/Queue/QueueItemRepositoryTest.php | 2 +- Tests/Integration/IndexQueue/PageIndexerTest.php | 4 ++-- Tests/Integration/IntegrationTestBase.php | 2 +- Tests/Integration/Report/SolrVersionStatusTest.php | 2 +- .../Search/IndexQueueModuleControllerTest.php | 2 +- Tests/Unit/Domain/Index/IndexServiceTest.php | 2 +- .../Index/Queue/QueueInitializerServiceTest.php | 2 +- .../Queue/UpdateHandler/DataUpdateHandlerTest.php | 2 +- .../DelayedProcessingEventListenerTest.php | 2 +- .../ImmediateProcessingEventListenerTest.php | 2 +- .../Unit/Domain/Search/Query/QueryBuilderTest.php | 2 +- .../QueryGroup/QueryGroupFacetParserTest.php | 4 ++-- .../Search/ResultSet/Facets/SetUpFacetParser.php | 6 +++--- .../ResultSetReconstitutionProcessorTest.php | 12 ++++++------ .../Search/ResultSet/SearchResultSetTest.php | 6 +++--- .../Statistics/StatisticsWriterProcessorTest.php | 2 +- .../Domain/Search/Uri/SearchUriBuilderTest.php | 4 ++-- Tests/Unit/Domain/Site/SiteRepositoryTest.php | 2 +- Tests/Unit/Domain/Variants/IdBuilderTest.php | 2 +- Tests/Unit/GarbageCollectorTest.php | 6 +++--- Tests/Unit/IndexQueue/IndexerTest.php | 4 ++-- Tests/Unit/IndexQueue/PageIndexerRequestTest.php | 2 +- Tests/Unit/IndexQueue/RecordMonitorTest.php | 14 +++++++------- Tests/Unit/SearchTest.php | 4 ++-- .../ContentObject/ContentObjectServiceTest.php | 2 +- .../System/Solr/Service/SolrReadServiceTest.php | 2 +- .../UserFunctions/FlexFormUserFunctionsTest.php | 2 +- Tests/Unit/Task/EventQueueWorkerTaskTest.php | 2 +- .../ViewHelpers/Backend/IsStringViewHelperTest.php | 12 ++++++------ .../Document/RelevanceViewHelperTest.php | 4 ++-- .../ViewHelpers/Facet/Area/GroupViewHelperTest.php | 2 +- .../Group/Prefix/LabelFilterViewHelperTest.php | 4 ++-- .../Group/Prefix/LabelPrefixesViewHelperTest.php | 4 ++-- ext_localconf.php | 4 ++-- 56 files changed, 100 insertions(+), 100 deletions(-) diff --git a/Classes/Controller/Backend/Search/CoreOptimizationModuleController.php b/Classes/Controller/Backend/Search/CoreOptimizationModuleController.php index 7279fc483a..1047dfc595 100644 --- a/Classes/Controller/Backend/Search/CoreOptimizationModuleController.php +++ b/Classes/Controller/Backend/Search/CoreOptimizationModuleController.php @@ -275,7 +275,7 @@ public function saveStopWordsAction(string $stopWords, bool $replaceStopwords = protected function exportFile(string $content, string $type = 'synonyms', string $fileExtension = 'txt'): ResponseInterface { $coreAdmin = $this->selectedSolrCoreConnection->getAdminService(); - return $this->responseFactory->createResponse() + return $this->responseFactory->createResponse() ->withHeader('Content-Type', 'text/plain; charset=utf-8') ->withHeader('Cache-control', 'public') ->withHeader('Content-Description', 'File transfer') diff --git a/Classes/Domain/Index/Queue/UpdateHandler/GarbageHandler.php b/Classes/Domain/Index/Queue/UpdateHandler/GarbageHandler.php index 79fe7057da..b82bd8a074 100644 --- a/Classes/Domain/Index/Queue/UpdateHandler/GarbageHandler.php +++ b/Classes/Domain/Index/Queue/UpdateHandler/GarbageHandler.php @@ -100,7 +100,7 @@ public function handlePageMovement(int $uid, ?int $previousParentId = null): voi $subPageIds = $this->getSubPageIds($uid); array_walk( $subPageIds, - fn(int $subPageId) => $this->collectGarbage('pages', $subPageId) + fn (int $subPageId) => $this->collectGarbage('pages', $subPageId) ); } } diff --git a/Classes/Domain/Search/ApacheSolrDocument/Repository.php b/Classes/Domain/Search/ApacheSolrDocument/Repository.php index 08f4634c67..eeb9fb4130 100644 --- a/Classes/Domain/Search/ApacheSolrDocument/Repository.php +++ b/Classes/Domain/Search/ApacheSolrDocument/Repository.php @@ -132,6 +132,6 @@ protected function initializeSearch(int $pageId, int $languageId = 0): void */ protected function getSearch(SolrConnection $solrConnection): Search { - return GeneralUtility::makeInstance(Search::class, $solrConnection); + return GeneralUtility::makeInstance(Search::class, $solrConnection); } } diff --git a/Classes/Domain/Search/Query/AbstractQueryBuilder.php b/Classes/Domain/Search/Query/AbstractQueryBuilder.php index 2f77aeaaee..1a54de4fad 100644 --- a/Classes/Domain/Search/Query/AbstractQueryBuilder.php +++ b/Classes/Domain/Search/Query/AbstractQueryBuilder.php @@ -278,7 +278,7 @@ public function useFilter(string $filterString, string $filterName = ''): self public function removeFilterByFieldName(string $fieldName): self { return $this->removeFilterByFunction( - function ($key, $query) use ($fieldName) { + function($key, $query) use ($fieldName) { $queryString = $query->getQuery(); $storedFieldName = substr($queryString, 0, strpos($queryString, ':')); return $storedFieldName == $fieldName; @@ -292,7 +292,7 @@ function ($key, $query) use ($fieldName) { public function removeFilterByName(string $name): self { return $this->removeFilterByFunction( - function ($key, $query) use ($name) { + function($key, $query) use ($name) { return $query->getKey() === $name; } ); @@ -304,7 +304,7 @@ function ($key, $query) use ($name) { public function removeFilterByValue(string $value): self { return $this->removeFilterByFunction( - function ($key, $query) use ($value) { + function($key, $query) use ($value) { $query = $query->getQuery(); return $query == $value; } diff --git a/Classes/Domain/Search/Query/ParameterBuilder/Slops.php b/Classes/Domain/Search/Query/ParameterBuilder/Slops.php index 7384b64a73..86fae82cae 100644 --- a/Classes/Domain/Search/Query/ParameterBuilder/Slops.php +++ b/Classes/Domain/Search/Query/ParameterBuilder/Slops.php @@ -141,7 +141,7 @@ protected static function getPhraseSlopFromConfiguration(array $searchConfigurat { $phraseEnabled = !(empty($searchConfiguration['query.']['phrase']) || $searchConfiguration['query.']['phrase'] !== 1); $phraseSlopConfigured = !empty($searchConfiguration['query.']['phrase.']['slop']); - return ($phraseEnabled && $phraseSlopConfigured) ? $searchConfiguration['query.']['phrase.']['slop'] : self::NO_SLOP; + return ($phraseEnabled && $phraseSlopConfigured) ? $searchConfiguration['query.']['phrase.']['slop'] : self::NO_SLOP; } protected static function getQuerySlopFromConfiguration(array $searchConfiguration): ?int diff --git a/Classes/Domain/Search/ResultSet/Facets/AbstractFacetItemCollection.php b/Classes/Domain/Search/ResultSet/Facets/AbstractFacetItemCollection.php index b967067d56..7e5a00a8d0 100644 --- a/Classes/Domain/Search/ResultSet/Facets/AbstractFacetItemCollection.php +++ b/Classes/Domain/Search/ResultSet/Facets/AbstractFacetItemCollection.php @@ -55,7 +55,7 @@ public function getCount(): int */ public function getSelected(): AbstractCollection { - return $this->getFilteredCopy(function (AbstractFacetItem $item) { + return $this->getFilteredCopy(function(AbstractFacetItem $item) { return $item->getSelected(); }); } diff --git a/Classes/Domain/Search/ResultSet/Facets/FacetCollection.php b/Classes/Domain/Search/ResultSet/Facets/FacetCollection.php index ee5cdb994d..ace40392f9 100644 --- a/Classes/Domain/Search/ResultSet/Facets/FacetCollection.php +++ b/Classes/Domain/Search/ResultSet/Facets/FacetCollection.php @@ -32,7 +32,7 @@ public function addFacet(AbstractFacet $facet): void public function getUsed(): AbstractCollection { return $this->getFilteredCopy( - function (AbstractFacet $facet) { + function(AbstractFacet $facet) { return $facet->getIsUsed() && $facet->getIncludeInUsedFacets(); } ); @@ -41,7 +41,7 @@ function (AbstractFacet $facet) { public function getAvailable(): AbstractCollection { return $this->getFilteredCopy( - function (AbstractFacet $facet) { + function(AbstractFacet $facet) { return $facet->getIsAvailable() && $facet->getIncludeInAvailableFacets() && $facet->getAllRequirementsMet(); } ); @@ -50,7 +50,7 @@ function (AbstractFacet $facet) { public function getByGroupName(string $requiredGroup = 'all'): AbstractCollection { return $this->getFilteredCopy( - function (AbstractFacet $facet) use ($requiredGroup) { + function(AbstractFacet $facet) use ($requiredGroup) { return $facet->getGroupName() == $requiredGroup; } ); @@ -59,7 +59,7 @@ function (AbstractFacet $facet) use ($requiredGroup) { public function getByName(string $requiredName): AbstractCollection { return $this->getFilteredCopy( - function (AbstractFacet $facet) use ($requiredName) { + function(AbstractFacet $facet) use ($requiredName) { return $facet->getName() == $requiredName; } ); diff --git a/Classes/Domain/Search/ResultSet/Facets/OptionBased/Hierarchy/HierarchyFacetParser.php b/Classes/Domain/Search/ResultSet/Facets/OptionBased/Hierarchy/HierarchyFacetParser.php index 578dcee657..95ee702f68 100644 --- a/Classes/Domain/Search/ResultSet/Facets/OptionBased/Hierarchy/HierarchyFacetParser.php +++ b/Classes/Domain/Search/ResultSet/Facets/OptionBased/Hierarchy/HierarchyFacetParser.php @@ -129,7 +129,7 @@ protected function getPathAsArray(string $path): array $path = str_replace('\/', '@@@', $path); $path = rtrim($path, '/'); $segments = explode('/', $path); - return array_map(static function ($item) { + return array_map(static function($item) { return str_replace('@@@', '/', $item); }, $segments); } diff --git a/Classes/Domain/Search/ResultSet/Facets/OptionBased/Hierarchy/HierarchyTool.php b/Classes/Domain/Search/ResultSet/Facets/OptionBased/Hierarchy/HierarchyTool.php index eeb728fcdc..f8212e8078 100644 --- a/Classes/Domain/Search/ResultSet/Facets/OptionBased/Hierarchy/HierarchyTool.php +++ b/Classes/Domain/Search/ResultSet/Facets/OptionBased/Hierarchy/HierarchyTool.php @@ -23,7 +23,7 @@ class HierarchyTool */ public static function substituteSlashes(string $pathWithContentSlashes): string { - return (string)str_replace('\/', '@@@slash@@@', $pathWithContentSlashes); + return (string)str_replace('\/', '@@@slash@@@', $pathWithContentSlashes); } /** diff --git a/Classes/Domain/Search/ResultSet/Facets/OptionBased/OptionCollection.php b/Classes/Domain/Search/ResultSet/Facets/OptionBased/OptionCollection.php index 3daf0d9c5f..04249db252 100644 --- a/Classes/Domain/Search/ResultSet/Facets/OptionBased/OptionCollection.php +++ b/Classes/Domain/Search/ResultSet/Facets/OptionBased/OptionCollection.php @@ -47,7 +47,7 @@ public function getLowercaseLabelPrefixes(int $length = 1): array */ public function getByLowercaseLabelPrefix(string $filteredPrefix): AbstractCollection|AbstractFacetItemCollection|OptionCollection { - return $this->getFilteredCopy(function (Option $option) use ($filteredPrefix) { + return $this->getFilteredCopy(function(Option $option) use ($filteredPrefix) { $filteredPrefixLength = mb_strlen($filteredPrefix); $currentPrefix = mb_substr(mb_strtolower($option->getLabel()), 0, $filteredPrefixLength); diff --git a/Classes/Domain/Search/ResultSet/Facets/UrlFacetContainer.php b/Classes/Domain/Search/ResultSet/Facets/UrlFacetContainer.php index 6f1de16f67..3ff7688469 100644 --- a/Classes/Domain/Search/ResultSet/Facets/UrlFacetContainer.php +++ b/Classes/Domain/Search/ResultSet/Facets/UrlFacetContainer.php @@ -136,11 +136,11 @@ public function getActiveFacetNames(): array $facetNames = []; if ($this->parameterStyle === self::PARAMETER_STYLE_INDEX) { - array_map(static function ($activeFacet) use (&$facetNames) { + array_map(static function($activeFacet) use (&$facetNames) { $facetNames[] = substr($activeFacet, 0, strpos($activeFacet, ':')); }, $activeFacets); } else { - array_map(static function ($activeFacet) use (&$facetNames) { + array_map(static function($activeFacet) use (&$facetNames) { $facetNames[] = substr($activeFacet, 0, strpos($activeFacet, ':')); }, array_keys($activeFacets)); } @@ -158,7 +158,7 @@ public function getActiveFacetValuesByName(string $facetName): array if ($this->parameterStyle === self::PARAMETER_STYLE_ASSOC) { $activeFacets = array_keys($activeFacets); } - array_map(static function ($activeFacet) use (&$values, $facetName) { + array_map(static function($activeFacet) use (&$values, $facetName) { $parts = explode(':', $activeFacet, 2); if ($parts[0] === $facetName) { $values[] = $parts[1]; @@ -270,7 +270,7 @@ public function removeAllFacetValuesByName(string $facetName): UrlFacetContainer $filterOptions = ARRAY_FILTER_USE_KEY; } - $facetValues = array_filter($facetValues, static function ($facetNameValue) use ($facetName) { + $facetValues = array_filter($facetValues, static function($facetNameValue) use ($facetName) { $parts = explode(':', $facetNameValue, 2); return $parts[0] !== $facetName; }, $filterOptions); diff --git a/Classes/Domain/Search/ResultSet/Sorting/SortingHelper.php b/Classes/Domain/Search/ResultSet/Sorting/SortingHelper.php index 92f9086e6e..8589ccfd96 100644 --- a/Classes/Domain/Search/ResultSet/Sorting/SortingHelper.php +++ b/Classes/Domain/Search/ResultSet/Sorting/SortingHelper.php @@ -52,7 +52,7 @@ public function getSortFieldFromUrlParameter(string $urlParameters): string $sortFields = []; $sortParameters = GeneralUtility::trimExplode(',', $urlParameters); - $removeTsKeyDot = static function ($sortingKey) { return trim($sortingKey, '.'); }; + $removeTsKeyDot = static function($sortingKey) { return trim($sortingKey, '.'); }; $configuredSortingName = array_map($removeTsKeyDot, array_keys($this->configuration)); foreach ($sortParameters as $sortParameter) { diff --git a/Classes/Domain/Search/Uri/SearchUriBuilder.php b/Classes/Domain/Search/Uri/SearchUriBuilder.php index b5e91cf1c4..5565c97fba 100644 --- a/Classes/Domain/Search/Uri/SearchUriBuilder.php +++ b/Classes/Domain/Search/Uri/SearchUriBuilder.php @@ -300,10 +300,10 @@ protected function buildLinkWithInMemoryCache(?int $pageUid, array $arguments): } } - $keys = array_map(static function ($value) { + $keys = array_map(static function($value) { return urlencode((string)$value); }, array_keys($values)); - $values = array_map(static function ($value) { + $values = array_map(static function($value) { return urlencode((string)$value); }, $values); @@ -336,7 +336,7 @@ protected function buildLinkWithInMemoryCache(?int $pageUid, array $arguments): $values = $variableEvent->getVariableValues(); // Take care that everything is urlencoded! - $keys = array_map(static function ($value) { + $keys = array_map(static function($value) { if (!str_contains($value, '###')) { return $value; } diff --git a/Classes/Domain/Site/SiteRepository.php b/Classes/Domain/Site/SiteRepository.php index 13a06a5100..102e5e6586 100644 --- a/Classes/Domain/Site/SiteRepository.php +++ b/Classes/Domain/Site/SiteRepository.php @@ -229,7 +229,7 @@ protected function buildTypo3ManagedSite(array $rootPageRecord): ?Site $siteHash = $this->getSiteHashForDomain($domain); $defaultLanguage = $typo3Site->getDefaultLanguage()->getLanguageId(); $pageRepository = GeneralUtility::makeInstance(PagesRepository::class); - $availableLanguageIds = array_map(static function ($language) { + $availableLanguageIds = array_map(static function($language) { return $language->getLanguageId(); }, $typo3Site->getLanguages()); diff --git a/Classes/FrontendEnvironment/Tsfe.php b/Classes/FrontendEnvironment/Tsfe.php index 675c1c26e4..4c250d0cf2 100644 --- a/Classes/FrontendEnvironment/Tsfe.php +++ b/Classes/FrontendEnvironment/Tsfe.php @@ -254,7 +254,7 @@ public function getTsfeByPageIdIgnoringLanguage(int $pageId): ?TypoScriptFronten } catch (Throwable $e) { return null; } - $availableLanguageIds = array_map(static function ($siteLanguage) { + $availableLanguageIds = array_map(static function($siteLanguage) { return $siteLanguage->getLanguageId(); }, $typo3Site->getLanguages()); diff --git a/Classes/IndexQueue/FrontendHelper/UserGroupDetector.php b/Classes/IndexQueue/FrontendHelper/UserGroupDetector.php index ceb9c77b49..0847b2014f 100644 --- a/Classes/IndexQueue/FrontendHelper/UserGroupDetector.php +++ b/Classes/IndexQueue/FrontendHelper/UserGroupDetector.php @@ -218,7 +218,7 @@ protected function getFrontendGroups(): array $frontendGroups = array_unique($frontendGroups); $frontendGroups = array_filter( array_values($frontendGroups), - static fn(int $val): bool => ($val !== -1) + static fn (int $val): bool => ($val !== -1) ); if (empty($frontendGroups)) { diff --git a/Classes/IndexQueue/Indexer.php b/Classes/IndexQueue/Indexer.php index 1c3f97a271..289cd37c18 100644 --- a/Classes/IndexQueue/Indexer.php +++ b/Classes/IndexQueue/Indexer.php @@ -355,7 +355,7 @@ protected function isRootPageIdPartOfRootLine(Item $item): bool $rootlineUtility = GeneralUtility::makeInstance(RootlineUtility::class, $buildRootlineWithPid); $rootline = $rootlineUtility->get(); - $pageInRootline = array_filter($rootline, static function ($page) use ($rootPageId) { + $pageInRootline = array_filter($rootline, static function($page) use ($rootPageId) { return (int)$page['uid'] === $rootPageId; }); return !empty($pageInRootline); diff --git a/Classes/Routing/RoutingService.php b/Classes/Routing/RoutingService.php index 6d4f31cf0e..a5875a3300 100644 --- a/Classes/Routing/RoutingService.php +++ b/Classes/Routing/RoutingService.php @@ -415,7 +415,7 @@ public function getQueryParameterMap(): array $self = $this; return array_filter( $this->settings['query']['map'], - static function ($value) use ($self) { + static function($value) use ($self) { return !$self->isCoreParameter($value); } ); diff --git a/Classes/System/Configuration/ExtensionConfiguration.php b/Classes/System/Configuration/ExtensionConfiguration.php index fca5331c98..8e5b10b28d 100644 --- a/Classes/System/Configuration/ExtensionConfiguration.php +++ b/Classes/System/Configuration/ExtensionConfiguration.php @@ -111,13 +111,13 @@ public function getAvailablePluginNamespaces(): array public function getCacheHashExcludedParameters(): array { $pluginNamespaces = array_map( - static function ($pluginNamespace) { + static function($pluginNamespace) { return '^' . $pluginNamespace . '['; }, $this->getAvailablePluginNamespaces() ); $enhancersRouteParts = array_map( - static function ($pluginNamespace) { + static function($pluginNamespace) { // __ \TYPO3\CMS\Core\Routing\Enhancer\VariableProcessor::LEVEL_DELIMITER return '^' . $pluginNamespace . '__'; }, diff --git a/Classes/System/Solr/Service/AbstractSolrService.php b/Classes/System/Solr/Service/AbstractSolrService.php index 9695eb60d2..74e9519965 100644 --- a/Classes/System/Solr/Service/AbstractSolrService.php +++ b/Classes/System/Solr/Service/AbstractSolrService.php @@ -87,7 +87,7 @@ public function __toString() return $endpoint->getCoreBaseUri(); } catch (Throwable) { } - return $endpoint->getScheme() . '://' . $endpoint->getHost() . ':' . $endpoint->getPort() . $endpoint->getPath() . '/' . $endpoint->getCore() . '/'; + return $endpoint->getScheme() . '://' . $endpoint->getHost() . ':' . $endpoint->getPort() . $endpoint->getPath() . '/' . $endpoint->getCore() . '/'; } public function getPrimaryEndpoint(): Endpoint @@ -119,7 +119,7 @@ protected function _sendRawPost( string $rawPost, string $contentType = 'text/xml; charset=UTF-8' ): ResponseAdapter { - $initializeRequest = function (Request $request) use ($rawPost, $contentType) { + $initializeRequest = function(Request $request) use ($rawPost, $contentType) { $request->setRawData($rawPost); $request->addHeader('Content-Type: ' . $contentType); return $request; diff --git a/Classes/System/UserFunctions/FlexFormUserFunctions.php b/Classes/System/UserFunctions/FlexFormUserFunctions.php index cf758dcdff..6be1870a0e 100644 --- a/Classes/System/UserFunctions/FlexFormUserFunctions.php +++ b/Classes/System/UserFunctions/FlexFormUserFunctions.php @@ -67,11 +67,11 @@ protected function getParsedSolrFieldsFromSchema(array $configuredFacets, array { $newItems = []; - array_map(function ($fieldName) use (&$newItems, $configuredFacets) { + array_map(function($fieldName) use (&$newItems, $configuredFacets) { $value = $fieldName; $label = $fieldName; - $facetNameFilter = static function ($facet) use ($fieldName) { + $facetNameFilter = static function($facet) use ($fieldName) { return $facet['field'] === $fieldName; }; $configuredFacets = array_filter($configuredFacets, $facetNameFilter); diff --git a/Classes/Task/EventQueueWorkerTask.php b/Classes/Task/EventQueueWorkerTask.php index 5483e74988..d1f1812c6d 100644 --- a/Classes/Task/EventQueueWorkerTask.php +++ b/Classes/Task/EventQueueWorkerTask.php @@ -155,7 +155,7 @@ public function getLimit(): int */ protected function getSolrLogManager(): SolrLogManager { - return GeneralUtility::makeInstance(SolrLogManager::class, __CLASS__); + return GeneralUtility::makeInstance(SolrLogManager::class, __CLASS__); } /** diff --git a/Tests/Integration/Domain/Index/Queue/QueueItemRepositoryTest.php b/Tests/Integration/Domain/Index/Queue/QueueItemRepositoryTest.php index 99a0716027..6743e433e3 100644 --- a/Tests/Integration/Domain/Index/Queue/QueueItemRepositoryTest.php +++ b/Tests/Integration/Domain/Index/Queue/QueueItemRepositoryTest.php @@ -119,7 +119,7 @@ public function canFindItemsAndModifyViaEventListener(): void self::assertSame(2, count($items)); self::assertSame('pages', $firstItem->getType(), 'First item has unexpected type'); - $eventDispatcher->addListener(function (AfterRecordsForIndexQueueItemsHaveBeenRetrievedEvent $event): void { + $eventDispatcher->addListener(function(AfterRecordsForIndexQueueItemsHaveBeenRetrievedEvent $event): void { if ($event->getTable() === 'pages') { $event->setRecords([]); } diff --git a/Tests/Integration/IndexQueue/PageIndexerTest.php b/Tests/Integration/IndexQueue/PageIndexerTest.php index 5e96edb9a1..5fa5fe4afa 100644 --- a/Tests/Integration/IndexQueue/PageIndexerTest.php +++ b/Tests/Integration/IndexQueue/PageIndexerTest.php @@ -79,11 +79,11 @@ public function canIndexPageWithAccessProtectedContentIntoSolr( $this->cleanUpSolrServerAndAssertEmpty($core); $this->importCSVDataSet(__DIR__ . '/Fixtures/' . $fixture . '.csv'); - $createPageIndexerMock = function (): PageIndexerRequest { + $createPageIndexerMock = function(): PageIndexerRequest { $requestMock = $this->getMockBuilder(PageIndexerRequest::class) ->onlyMethods(['send']) ->getMock(); - $sendCallback = function ($indexRequestUrl) use ($requestMock): PageIndexerResponse { + $sendCallback = function($indexRequestUrl) use ($requestMock): PageIndexerResponse { return $this->sendPageIndexerRequest($indexRequestUrl, $requestMock); }; $requestMock->method('send')->willReturnCallback($sendCallback); diff --git a/Tests/Integration/IntegrationTestBase.php b/Tests/Integration/IntegrationTestBase.php index 96dd1a02b4..03854162c8 100644 --- a/Tests/Integration/IntegrationTestBase.php +++ b/Tests/Integration/IntegrationTestBase.php @@ -262,7 +262,7 @@ private function importRootPagesAndTemplatesForConfiguredSites(): void protected function failWhenSolrDeprecationIsCreated(): ?callable { error_reporting(error_reporting() & ~E_USER_DEPRECATED); - return set_error_handler(function (int $id, string $msg, string $file, int $line): bool { + return set_error_handler(function(int $id, string $msg, string $file, int $line): bool { if ($id === E_USER_DEPRECATED && str_starts_with($msg, 'solr:deprecation: ')) { $this->fail('Executed deprecated EXT:solr code: ' . $msg); } diff --git a/Tests/Integration/Report/SolrVersionStatusTest.php b/Tests/Integration/Report/SolrVersionStatusTest.php index dc352abe6d..4c59095b22 100644 --- a/Tests/Integration/Report/SolrVersionStatusTest.php +++ b/Tests/Integration/Report/SolrVersionStatusTest.php @@ -47,7 +47,7 @@ public function canGetAGreenSolrConfigStatusAgainstTestServer(): void self::assertEmpty( array_filter( $results, - static fn(Status $status): bool => $status->getSeverity() !== ContextualFeedbackSeverity::OK + static fn (Status $status): bool => $status->getSeverity() !== ContextualFeedbackSeverity::OK ), 'We expect to get no violations against the test Solr server ' ); diff --git a/Tests/Unit/Controller/Backend/Search/IndexQueueModuleControllerTest.php b/Tests/Unit/Controller/Backend/Search/IndexQueueModuleControllerTest.php index 135e657438..4ae1b9d3ac 100644 --- a/Tests/Unit/Controller/Backend/Search/IndexQueueModuleControllerTest.php +++ b/Tests/Unit/Controller/Backend/Search/IndexQueueModuleControllerTest.php @@ -80,7 +80,7 @@ public function requeueDocumentActionIsTriggeringReIndexOnIndexQueue(): void #[Test] public function hookIsTriggeredWhenRegistered(): void { - $this->eventDispatcher->addListener(function (AfterIndexQueueItemHasBeenMarkedForReindexingEvent $event) { + $this->eventDispatcher->addListener(function(AfterIndexQueueItemHasBeenMarkedForReindexingEvent $event) { $event->setUpdateCount(5); }); diff --git a/Tests/Unit/Domain/Index/IndexServiceTest.php b/Tests/Unit/Domain/Index/IndexServiceTest.php index da50cab438..9cc9fd11f9 100644 --- a/Tests/Unit/Domain/Index/IndexServiceTest.php +++ b/Tests/Unit/Domain/Index/IndexServiceTest.php @@ -121,7 +121,7 @@ public function testServerHostIsRestoredInCaseOfAnException(): void ->disableOriginalConstructor() ->onlyMethods(['index']) ->getMock(); - $indexerMock->expects(self::exactly(2))->method('index')->willReturnCallback(function () { + $indexerMock->expects(self::exactly(2))->method('index')->willReturnCallback(function() { throw new Exception('unknown error occurred'); }); $indexService->expects(self::exactly(2))->method('getIndexerByItem')->willReturn($indexerMock); diff --git a/Tests/Unit/Domain/Index/Queue/QueueInitializerServiceTest.php b/Tests/Unit/Domain/Index/Queue/QueueInitializerServiceTest.php index a7718a5893..aae996dc9c 100644 --- a/Tests/Unit/Domain/Index/Queue/QueueInitializerServiceTest.php +++ b/Tests/Unit/Domain/Index/Queue/QueueInitializerServiceTest.php @@ -89,7 +89,7 @@ public function allIndexConfigurationsAreUsedWhenWildcardIsPassed(): void $service ->expects($matcher) ->method('executeInitializer') - ->willReturnCallback(static function () use ($siteMock, $fakeTs, $matcher): bool { + ->willReturnCallback(static function() use ($siteMock, $fakeTs, $matcher): bool { match ($matcher->numberOfInvocations()) { 1 => self::assertEquals( func_get_args(), diff --git a/Tests/Unit/Domain/Index/Queue/UpdateHandler/DataUpdateHandlerTest.php b/Tests/Unit/Domain/Index/Queue/UpdateHandler/DataUpdateHandlerTest.php index c8a33bd8ae..3b5e580854 100644 --- a/Tests/Unit/Domain/Index/Queue/UpdateHandler/DataUpdateHandlerTest.php +++ b/Tests/Unit/Domain/Index/Queue/UpdateHandler/DataUpdateHandlerTest.php @@ -376,7 +376,7 @@ public function handlePageUpdateTriggersRecursivePageProcessing(): void $this->indexQueueMock ->expects($matcher) ->method('updateItem') - ->willReturnCallback(static function (string $type, int $uid) use ($dummyPageRecord, $matcher): int { + ->willReturnCallback(static function(string $type, int $uid) use ($dummyPageRecord, $matcher): int { match ($matcher->numberOfInvocations()) { 1 => self::assertEquals( [ diff --git a/Tests/Unit/Domain/Index/Queue/UpdateHandler/EventListener/DelayedProcessingEventListenerTest.php b/Tests/Unit/Domain/Index/Queue/UpdateHandler/EventListener/DelayedProcessingEventListenerTest.php index 9c0e205318..bf0d2c5b50 100644 --- a/Tests/Unit/Domain/Index/Queue/UpdateHandler/EventListener/DelayedProcessingEventListenerTest.php +++ b/Tests/Unit/Domain/Index/Queue/UpdateHandler/EventListener/DelayedProcessingEventListenerTest.php @@ -56,7 +56,7 @@ public function canHandleEvents(): void $this->eventDispatcherMock ->expects(self::once()) ->method('dispatch') - ->willReturnCallback(function () use (&$dispatchedEvent) { + ->willReturnCallback(function() use (&$dispatchedEvent) { $dispatchedEvent = func_get_arg(0); }); diff --git a/Tests/Unit/Domain/Index/Queue/UpdateHandler/EventListener/ImmediateProcessingEventListenerTest.php b/Tests/Unit/Domain/Index/Queue/UpdateHandler/EventListener/ImmediateProcessingEventListenerTest.php index eb546359e8..e1352bbb1f 100644 --- a/Tests/Unit/Domain/Index/Queue/UpdateHandler/EventListener/ImmediateProcessingEventListenerTest.php +++ b/Tests/Unit/Domain/Index/Queue/UpdateHandler/EventListener/ImmediateProcessingEventListenerTest.php @@ -110,7 +110,7 @@ protected function checkEventHandling( $this->eventDispatcherMock ->expects(self::once()) ->method('dispatch') - ->willReturnCallback(function () use (&$dispatchedEvent) { + ->willReturnCallback(function() use (&$dispatchedEvent) { $dispatchedEvent = func_get_arg(0); }); } else { diff --git a/Tests/Unit/Domain/Search/Query/QueryBuilderTest.php b/Tests/Unit/Domain/Search/Query/QueryBuilderTest.php index cfa8240bbd..a0a5de2a6a 100644 --- a/Tests/Unit/Domain/Search/Query/QueryBuilderTest.php +++ b/Tests/Unit/Domain/Search/Query/QueryBuilderTest.php @@ -174,7 +174,7 @@ public function buildSearchIsRespectingPageSectionFilters( $rootLinesCount = count($rootLines); $rootlineUtilityMock = $this->createMock(RootlineUtility::class); $matcher = self::exactly($rootLinesCount); - $rootlineUtilityMock->method('get')->willReturnCallback(static function () use ($matcher, $rootLines): array { + $rootlineUtilityMock->method('get')->willReturnCallback(static function() use ($matcher, $rootLines): array { if (isset($rootLines[$matcher->numberOfInvocations()])) { return $rootLines[$matcher->numberOfInvocations()]; } diff --git a/Tests/Unit/Domain/Search/ResultSet/Facets/OptionBased/QueryGroup/QueryGroupFacetParserTest.php b/Tests/Unit/Domain/Search/ResultSet/Facets/OptionBased/QueryGroup/QueryGroupFacetParserTest.php index 48baf0b381..815e8ada79 100644 --- a/Tests/Unit/Domain/Search/ResultSet/Facets/OptionBased/QueryGroup/QueryGroupFacetParserTest.php +++ b/Tests/Unit/Domain/Search/ResultSet/Facets/OptionBased/QueryGroup/QueryGroupFacetParserTest.php @@ -57,13 +57,13 @@ protected function initializeSearchResultSetFromFakeResponse(string $fixtureFile $searchRequestMock->expects(self::any()) ->method('getActiveFacetNames') - ->willReturnCallback(function () use ($activeUrlFacets) { + ->willReturnCallback(function() use ($activeUrlFacets) { return $activeUrlFacets->getActiveFacetNames(); }); $searchRequestMock->expects(self::any()) ->method('getHasFacetValue') - ->willReturnCallback(function (string $facetName, $facetValue) use ($activeUrlFacets) { + ->willReturnCallback(function(string $facetName, $facetValue) use ($activeUrlFacets) { return $activeUrlFacets->hasFacetValue($facetName, $facetValue); }); diff --git a/Tests/Unit/Domain/Search/ResultSet/Facets/SetUpFacetParser.php b/Tests/Unit/Domain/Search/ResultSet/Facets/SetUpFacetParser.php index 034f735432..5616e4c3ac 100644 --- a/Tests/Unit/Domain/Search/ResultSet/Facets/SetUpFacetParser.php +++ b/Tests/Unit/Domain/Search/ResultSet/Facets/SetUpFacetParser.php @@ -65,17 +65,17 @@ protected function initializeSearchResultSetFromFakeResponse(string $fixtureFile // Replace calls with own data bag $searchRequestMock->expects(self::any()) ->method('getActiveFacetNames') - ->willReturnCallback(function () use ($activeUrlFacets) { + ->willReturnCallback(function() use ($activeUrlFacets) { return $activeUrlFacets->getActiveFacetNames(); }); $searchRequestMock->expects(self::any()) ->method('getActiveFacets') - ->willReturnCallback(function () use ($activeUrlFacets) { + ->willReturnCallback(function() use ($activeUrlFacets) { return $activeUrlFacets->getActiveFacets(); }); $searchRequestMock->expects(self::any()) ->method('getActiveFacetValuesByName') - ->willReturnCallback(function (string $facetName) use ($activeUrlFacets) { + ->willReturnCallback(function(string $facetName) use ($activeUrlFacets) { return $activeUrlFacets->getActiveFacetValuesByName($facetName); }); diff --git a/Tests/Unit/Domain/Search/ResultSet/ResultSetReconstitutionProcessorTest.php b/Tests/Unit/Domain/Search/ResultSet/ResultSetReconstitutionProcessorTest.php index 6eeaf351ae..79db884827 100644 --- a/Tests/Unit/Domain/Search/ResultSet/ResultSetReconstitutionProcessorTest.php +++ b/Tests/Unit/Domain/Search/ResultSet/ResultSetReconstitutionProcessorTest.php @@ -235,7 +235,7 @@ public function canSetRequirementsMetToTrueOnFacetThatFullFillsARequirement(): v /** @var MockObject|SearchRequest $usedSearchRequest */ $usedSearchRequest = $searchResultSet->getUsedSearchRequest(); $usedSearchRequest->expects(self::any())->method('getActiveFacetValuesByName')->willReturnCallback( - function ($name) { + function($name) { return $name == 'myType' ? ['pages'] : []; } ); @@ -416,7 +416,7 @@ public function canReconstituteUsedFacet(): void /** @var MockObject|SearchRequest $usedSearchRequest */ $usedSearchRequest = $searchResultSet->getUsedSearchRequest(); $usedSearchRequest->expects(self::any())->method('getActiveFacetValuesByName')->willReturnCallback( - function ($name) { + function($name) { return $name == 'type' ? ['tx_solr_file'] : []; } ); @@ -466,7 +466,7 @@ public function canMarkUsedOptionAsSelected(): void /** @var MockObject|SearchRequest $usedSearchRequest */ $usedSearchRequest = $searchResultSet->getUsedSearchRequest(); $usedSearchRequest->expects(self::any())->method('getActiveFacetValuesByName')->willReturnCallback( - function ($name) { + function($name) { return $name == 'type' ? ['tx_solr_file'] : []; } ); @@ -508,7 +508,7 @@ public function includeIsUsedFacetsCanBeSetToFalse(): void /** @var MockObject|SearchRequest $usedSearchRequest */ $usedSearchRequest = $searchResultSet->getUsedSearchRequest(); $usedSearchRequest->expects(self::any())->method('getActiveFacetValuesByName')->willReturnCallback( - function ($name) { + function($name) { return $name == 'type' ? ['tx_solr_file'] : []; } ); @@ -545,7 +545,7 @@ public function canGetConfiguredFacetNotInResponseAsUnavailableFacet(): void /** @var MockObject|SearchRequest $usedSearchRequest */ $usedSearchRequest = $searchResultSet->getUsedSearchRequest(); $usedSearchRequest->expects(self::any())->method('getActiveFacetValuesByName')->willReturnCallback( - function ($name) { + function($name) { return $name == 'type' ? ['pages'] : []; } ); @@ -587,7 +587,7 @@ public function canGetTwoUsedFacetOptions(): void /** @var MockObject|SearchRequest $usedSearchRequest */ $usedSearchRequest = $searchResultSet->getUsedSearchRequest(); $usedSearchRequest->expects(self::any())->method('getActiveFacetValuesByName')->willReturnCallback( - function ($name) { + function($name) { if ($name == 'mytitle') { return ['jpeg', 'kasper"s']; } diff --git a/Tests/Unit/Domain/Search/ResultSet/SearchResultSetTest.php b/Tests/Unit/Domain/Search/ResultSet/SearchResultSetTest.php index 70033dc90c..7b78f4ad8c 100644 --- a/Tests/Unit/Domain/Search/ResultSet/SearchResultSetTest.php +++ b/Tests/Unit/Domain/Search/ResultSet/SearchResultSetTest.php @@ -113,7 +113,7 @@ public function testComponentAsEventListenerGetsInitialized(): void $this->configurationMock->expects(self::once())->method('getSearchConfiguration')->willReturn([]); $this->configurationMock->expects(self::once())->method('getSearchQueryReturnFieldsAsArray')->willReturn(['*']); - $this->eventDispatcher->addListener(function (object $event) { + $this->eventDispatcher->addListener(function(object $event) { if ($event instanceof AfterSearchQueryHasBeenPreparedEvent) { $event->getTypoScriptConfiguration()->getSearchConfiguration(); } @@ -133,7 +133,7 @@ public function canRegisterSearchResultSetProcessor(): void { $this->configurationMock->expects(self::once())->method('getSearchQueryReturnFieldsAsArray')->willReturn(['*']); - $this->eventDispatcher->addListener(function (object $event) { + $this->eventDispatcher->addListener(function(object $event) { if ($event instanceof AfterSearchHasBeenExecutedEvent) { foreach ($event->getSearchResultSet()->getSearchResults() as $result) { $result->type = strtoupper($result->type); @@ -205,7 +205,7 @@ public function testExpandedDocumentsGetAddedWhenVariantsAreConfigured(): void public function assertOneSearchWillBeTriggeredWithQueryAndShouldReturnFakeResponse(string $expextedQueryString, int $expectedOffset, ResponseAdapter $fakeResponse): void { $this->searchMock->expects(self::once())->method('search')->willReturnCallback( - function (Query $query, $offset) use ($expextedQueryString, $expectedOffset, $fakeResponse) { + function(Query $query, $offset) use ($expextedQueryString, $expectedOffset, $fakeResponse) { $this->assertSame($expextedQueryString, $query->getQuery(), 'Search was not triggered with an expected queryString'); $this->assertSame($expectedOffset, $offset); return $fakeResponse; diff --git a/Tests/Unit/Domain/Search/Statistics/StatisticsWriterProcessorTest.php b/Tests/Unit/Domain/Search/Statistics/StatisticsWriterProcessorTest.php index bb2895abb7..54402b95f6 100644 --- a/Tests/Unit/Domain/Search/Statistics/StatisticsWriterProcessorTest.php +++ b/Tests/Unit/Domain/Search/Statistics/StatisticsWriterProcessorTest.php @@ -103,7 +103,7 @@ public function canWriteExpectedStatisticsData(): void $resultSetMock->expects(self::once())->method('getUsedQuery')->willReturn($this->queryMock); $resultSetMock->expects(self::once())->method('getUsedSearchRequest')->willReturn($this->searchRequestMock); - $this->statisticsRepositoryMock->expects(self::any())->method('saveStatisticsRecord')->willReturnCallback(function ($statisticData) { + $this->statisticsRepositoryMock->expects(self::any())->method('saveStatisticsRecord')->willReturnCallback(function($statisticData) { $this->assertSame('my search', $statisticData['keywords'], 'Unexpected keywords given'); $this->assertSame('192.168.2.22', $statisticData['ip'], 'Unexpected ip given'); $this->assertSame(4711, $statisticData['root_pid'], 'Unexpected root pid given'); diff --git a/Tests/Unit/Domain/Search/Uri/SearchUriBuilderTest.php b/Tests/Unit/Domain/Search/Uri/SearchUriBuilderTest.php index 042b7c2ac1..6ac5f0ec52 100644 --- a/Tests/Unit/Domain/Search/Uri/SearchUriBuilderTest.php +++ b/Tests/Unit/Domain/Search/Uri/SearchUriBuilderTest.php @@ -502,7 +502,7 @@ public function uriErrorsResultInNonMappedProcessing(): void $previousRequest = new SearchRequest($queryParameters, 42, 0, $configurationMock); $this->extBaseUriBuilderMock ->expects($matcher)->method('setArguments') - ->willReturnCallback(function (array $arguments) use ($subsitutedQueryParameters, $queryParameters, $matcher) { + ->willReturnCallback(function(array $arguments) use ($subsitutedQueryParameters, $queryParameters, $matcher) { match ($matcher->numberOfInvocations()) { 1 => self::assertEquals($subsitutedQueryParameters, $arguments), 2 => self::assertEquals($queryParameters, $arguments), @@ -513,7 +513,7 @@ public function uriErrorsResultInNonMappedProcessing(): void $this->extBaseUriBuilderMock->expects(self::once())->method('reset')->with()->willReturn($this->extBaseUriBuilderMock); $buildCounter = 0; $this->extBaseUriBuilderMock->expects(self::exactly(2))->method('build') - ->willReturnCallback(function () use ($linkBuilderResult, &$buildCounter) { + ->willReturnCallback(function() use ($linkBuilderResult, &$buildCounter) { if (++$buildCounter === 1) { throw new InvalidParameterException('First call fails, should reprocess with regular arguments'); } diff --git a/Tests/Unit/Domain/Site/SiteRepositoryTest.php b/Tests/Unit/Domain/Site/SiteRepositoryTest.php index e2656c69bc..ca975f3e99 100644 --- a/Tests/Unit/Domain/Site/SiteRepositoryTest.php +++ b/Tests/Unit/Domain/Site/SiteRepositoryTest.php @@ -148,7 +148,7 @@ protected function assertCacheIsWritten(): void protected function assertThatSitesAreCreatedWithPageIds(array $pageIds, array $fakedConnectionConfiguration = []): void { $this->siteRepository->expects(self::any())->method('buildSite')->willReturnCallback( - function ($idToUse) use ($pageIds, $fakedConnectionConfiguration) { + function($idToUse) use ($pageIds, $fakedConnectionConfiguration) { if (in_array($idToUse, $pageIds)) { $site = $this->createMock(Site::class); $site->expects($this->any())->method('getRootPageId')->willReturn( diff --git a/Tests/Unit/Domain/Variants/IdBuilderTest.php b/Tests/Unit/Domain/Variants/IdBuilderTest.php index 6d820a7958..7d2b0ec8ff 100644 --- a/Tests/Unit/Domain/Variants/IdBuilderTest.php +++ b/Tests/Unit/Domain/Variants/IdBuilderTest.php @@ -45,7 +45,7 @@ public function canBuildVariantId(): void public function canUseCustomEventListener(): void { $eventDispatcher = new MockEventDispatcher(); - $eventDispatcher->addListener(function (AfterVariantIdWasBuiltEvent $event) { + $eventDispatcher->addListener(function(AfterVariantIdWasBuiltEvent $event) { $event->setVariantId('mycustomid'); }); $build = new IdBuilder($eventDispatcher); diff --git a/Tests/Unit/GarbageCollectorTest.php b/Tests/Unit/GarbageCollectorTest.php index 2eb0f3fec1..753e932ea8 100644 --- a/Tests/Unit/GarbageCollectorTest.php +++ b/Tests/Unit/GarbageCollectorTest.php @@ -87,7 +87,7 @@ public function processCmdmap_preProcessUHandlesRecordDeletion(): void $this->eventDispatcherMock ->expects(self::once()) ->method('dispatch') - ->willReturnCallback(function () use (&$dispatchedEvent) { + ->willReturnCallback(function() use (&$dispatchedEvent) { $dispatchedEvent = func_get_arg(0); }); $this->garbageCollector->processCmdmap_preProcess('delete', 'pages', 123, '', $dataHandlerMock); @@ -118,7 +118,7 @@ public function processCmdmap_postProcessHandlesPageMovement(): void $this->eventDispatcherMock ->expects(self::once()) ->method('dispatch') - ->willReturnCallback(function () use (&$dispatchedEvent) { + ->willReturnCallback(function() use (&$dispatchedEvent) { $dispatchedEvent = func_get_arg(0); }); @@ -222,7 +222,7 @@ public function processDatamap_afterDatabaseOperationsTriggersRecordGarbageCheck $this->eventDispatcherMock ->expects(self::once()) ->method('dispatch') - ->willReturnCallback(function () use (&$dispatchedEvent) { + ->willReturnCallback(function() use (&$dispatchedEvent) { $dispatchedEvent = func_get_arg(0); }); diff --git a/Tests/Unit/IndexQueue/IndexerTest.php b/Tests/Unit/IndexQueue/IndexerTest.php index bfd8a1ca61..630feb412c 100644 --- a/Tests/Unit/IndexQueue/IndexerTest.php +++ b/Tests/Unit/IndexQueue/IndexerTest.php @@ -213,14 +213,14 @@ public static function canGetAdditionalDocumentsDataProvider(): Generator ]; yield 'valid listener, no additional documents' => [ - function (BeforeDocumentIsProcessedForIndexingEvent $event) { + function(BeforeDocumentIsProcessedForIndexingEvent $event) { // Does nothing }, null, 1, ]; yield 'valid listener, adds an additional document' => [ - function (BeforeDocumentIsProcessedForIndexingEvent $event) { + function(BeforeDocumentIsProcessedForIndexingEvent $event) { $event->addDocuments([new Document()]); }, null, diff --git a/Tests/Unit/IndexQueue/PageIndexerRequestTest.php b/Tests/Unit/IndexQueue/PageIndexerRequestTest.php index 91e979ff65..e179bb33b4 100644 --- a/Tests/Unit/IndexQueue/PageIndexerRequestTest.php +++ b/Tests/Unit/IndexQueue/PageIndexerRequestTest.php @@ -155,7 +155,7 @@ public function authenticationHeaderIsSetWhenUsernameAndPasswordHaveBeenPassed() { /** @var MockObject|RequestFactory $requestFactoryMock */ $requestFactoryMock = $this->createMock(RequestFactory::class); - $requestFactoryMock->expects(self::once())->method('request')->willReturnCallback(function ($url, $method, $options) { + $requestFactoryMock->expects(self::once())->method('request')->willReturnCallback(function($url, $method, $options) { $this->assertSame(['bob', 'topsecret'], $options['auth'], 'Authentication options have not been set'); $this->assertSame('GET', $method, 'Unexpected http method'); diff --git a/Tests/Unit/IndexQueue/RecordMonitorTest.php b/Tests/Unit/IndexQueue/RecordMonitorTest.php index e06e867937..d3ca8abc20 100644 --- a/Tests/Unit/IndexQueue/RecordMonitorTest.php +++ b/Tests/Unit/IndexQueue/RecordMonitorTest.php @@ -82,7 +82,7 @@ public function processCmdmap_preProcessUHandlesDeletedContentElements(): void $this->eventDispatcherMock ->expects(self::once()) ->method('dispatch') - ->willReturnCallback(function () use (&$dispatchedEvent) { + ->willReturnCallback(function() use (&$dispatchedEvent) { $dispatchedEvent = func_get_arg(0); }); $this->recordMonitor->processCmdmap_preProcess('delete', 'tt_content', 123); @@ -111,7 +111,7 @@ public function processCmdmap_postProcessUpdatesQueueItemForVersionSwapOfPageRec $this->eventDispatcherMock ->expects(self::once()) ->method('dispatch') - ->willReturnCallback(function () use (&$dispatchedEvent) { + ->willReturnCallback(function() use (&$dispatchedEvent) { $dispatchedEvent = func_get_arg(0); }); $this->recordMonitor->processCmdmap_postProcess('version', 'pages', 4711, ['action' => 'swap']); @@ -128,7 +128,7 @@ public function processCmdmap_postProcessUpdatesQueueItemForVersionSwapOfRecord( $this->eventDispatcherMock ->expects(self::once()) ->method('dispatch') - ->willReturnCallback(function () use (&$dispatchedEvent) { + ->willReturnCallback(function() use (&$dispatchedEvent) { $dispatchedEvent = func_get_arg(0); }); $this->recordMonitor->processCmdmap_postProcess('version', 'tx_foo_bar', 888, ['action' => 'swap']); @@ -145,7 +145,7 @@ public function processCmdmap_postProcessUpdatesQueueItemForMoveOfPageRecord(): $this->eventDispatcherMock ->expects(self::once()) ->method('dispatch') - ->willReturnCallback(function () use (&$dispatchedEvent) { + ->willReturnCallback(function() use (&$dispatchedEvent) { $dispatchedEvent = func_get_arg(0); }); $this->recordMonitor->processCmdmap_postProcess('move', 'pages', 4711, []); @@ -173,7 +173,7 @@ public function processCmdmap_postProcessUpdatesQueueItemForMoveOfRecord(): void $this->eventDispatcherMock ->expects(self::once()) ->method('dispatch') - ->willReturnCallback(function () use (&$dispatchedEvent) { + ->willReturnCallback(function() use (&$dispatchedEvent) { $dispatchedEvent = func_get_arg(0); }); $this->recordMonitor->processCmdmap_postProcess('move', 'tx_foo_bar', 888, []); @@ -192,7 +192,7 @@ public function processDatamap_afterDatabaseOperationsUsesAlreadyResolvedNextAut $this->eventDispatcherMock ->expects(self::once()) ->method('dispatch') - ->willReturnCallback(function () use (&$dispatchedEvent) { + ->willReturnCallback(function() use (&$dispatchedEvent) { $dispatchedEvent = func_get_arg(0); }); $this->recordMonitor->processDatamap_afterDatabaseOperations('new', 'tt_content', 4711, ['pid' => 1], $dataHandlerMock); @@ -213,7 +213,7 @@ public function processDatamap_afterDatabaseOperationsUsesNotYetResolvedNextAuto $this->eventDispatcherMock ->expects(self::once()) ->method('dispatch') - ->willReturnCallback(function () use (&$dispatchedEvent) { + ->willReturnCallback(function() use (&$dispatchedEvent) { $dispatchedEvent = func_get_arg(0); }); diff --git a/Tests/Unit/SearchTest.php b/Tests/Unit/SearchTest.php index 0ec3a564cd..b4d57a8ac9 100644 --- a/Tests/Unit/SearchTest.php +++ b/Tests/Unit/SearchTest.php @@ -62,7 +62,7 @@ public function canPassLimit(): void $query = new SearchQuery(); $limit = 99; $this->solrReadServiceMock->expects(self::once())->method('search')->willReturnCallback( - function ($query) use ($limit) { + function($query) use ($limit) { $this->assertSame($limit, $query->getRows(), 'Unexpected limit was passed'); return $this->createMock(ResponseAdapter::class); } @@ -79,7 +79,7 @@ public function canKeepLimitWhenNullWasPassedAsLimit(): void $query->setRows($limit); $this->solrReadServiceMock->expects(self::once())->method('search')->willReturnCallback( - function ($query) use ($limit) { + function($query) use ($limit) { $this->assertSame($limit, $query->getRows(), 'Unexpected limit was passed'); return $this->createMock(ResponseAdapter::class); } diff --git a/Tests/Unit/System/ContentObject/ContentObjectServiceTest.php b/Tests/Unit/System/ContentObject/ContentObjectServiceTest.php index 2c43afe7a6..926907fb0d 100644 --- a/Tests/Unit/System/ContentObject/ContentObjectServiceTest.php +++ b/Tests/Unit/System/ContentObject/ContentObjectServiceTest.php @@ -15,7 +15,7 @@ * The TYPO3 project - inspiring people to share! */ -namespace ApacheSolrForTypo3\Solr\Tests\Unit\System\ContentObject; +namespace ApacheSolrForTypo3\Solr\Tests\Unit\System\ContentObject; use ApacheSolrForTypo3\Solr\System\ContentObject\ContentObjectService; use ApacheSolrForTypo3\Solr\Tests\Unit\SetUpUnitTestCase; diff --git a/Tests/Unit/System/Solr/Service/SolrReadServiceTest.php b/Tests/Unit/System/Solr/Service/SolrReadServiceTest.php index 1f4b0f6fda..e28b3b52d8 100644 --- a/Tests/Unit/System/Solr/Service/SolrReadServiceTest.php +++ b/Tests/Unit/System/Solr/Service/SolrReadServiceTest.php @@ -107,7 +107,7 @@ public function searchThrowsExpectedExceptionForStatusCode( $this->responseMock->expects(self::any())->method('getStatusCode')->willReturn($statusCode); $this->clientMock->expects(self::once())->method('createRequest')->willReturn($this->createMock(Request::class)); - $this->clientMock->expects(self::once())->method('executeRequest')->willReturnCallback(function () use ($statusCode) { + $this->clientMock->expects(self::once())->method('executeRequest')->willReturnCallback(function() use ($statusCode) { throw new HttpException('Solr error', $statusCode); }); $searchQuery = new SearchQuery(); diff --git a/Tests/Unit/System/UserFunctions/FlexFormUserFunctionsTest.php b/Tests/Unit/System/UserFunctions/FlexFormUserFunctionsTest.php index d8a41c3fc7..360466165c 100644 --- a/Tests/Unit/System/UserFunctions/FlexFormUserFunctionsTest.php +++ b/Tests/Unit/System/UserFunctions/FlexFormUserFunctionsTest.php @@ -125,7 +125,7 @@ public function facetLabelIsShownTranslatedInBracketsSignsInFlexFormsIfTranslati ]); $flexFormUserFunctionsMock->expects(self::any())->method('getTranslation')->willReturnCallback( - function () { + function() { $args = func_get_args(); if ($args[0] === 'LLL:EXT:some_ext/locallang.xlf:existing_label') { return 'Translated Facet'; diff --git a/Tests/Unit/Task/EventQueueWorkerTaskTest.php b/Tests/Unit/Task/EventQueueWorkerTaskTest.php index 4c336a307d..4e14c4538f 100644 --- a/Tests/Unit/Task/EventQueueWorkerTaskTest.php +++ b/Tests/Unit/Task/EventQueueWorkerTaskTest.php @@ -81,7 +81,7 @@ public function canProcessEventQueue(): void $eventDispatcherMock ->expects(self::exactly(2)) ->method('dispatch') - ->willReturnCallback(function () use (&$dispatchedEvents) { + ->willReturnCallback(function() use (&$dispatchedEvents) { $dispatchedEvents[] = func_get_arg(0); }); diff --git a/Tests/Unit/ViewHelpers/Backend/IsStringViewHelperTest.php b/Tests/Unit/ViewHelpers/Backend/IsStringViewHelperTest.php index 60764ab8d4..75e4fe381b 100644 --- a/Tests/Unit/ViewHelpers/Backend/IsStringViewHelperTest.php +++ b/Tests/Unit/ViewHelpers/Backend/IsStringViewHelperTest.php @@ -30,12 +30,12 @@ public function viewHelperRendersThenChildIfStringIsGiven(): void { $arguments = [ 'value' => 'givenString', - '__then' => function () { return 'thenResult'; }, - '__else' => function () { return 'elseResult'; }, + '__then' => function() { return 'thenResult'; }, + '__else' => function() { return 'elseResult'; }, ]; $renderingContextMock = $this->createMock(RenderingContextInterface::class); - $result = IsStringViewHelper::renderStatic($arguments, function () {}, $renderingContextMock); + $result = IsStringViewHelper::renderStatic($arguments, function() {}, $renderingContextMock); self::assertSame('thenResult', $result, 'thenClosure was not rendered'); } @@ -44,12 +44,12 @@ public function viewHelperRendersElseChildIfNotStringTypeIsGiven(): void { $arguments = [ 'value' => ['givenStringInArray'], - '__then' => function () { return 'thenResult'; }, - '__else' => function () { return 'elseResult'; }, + '__then' => function() { return 'thenResult'; }, + '__else' => function() { return 'elseResult'; }, ]; $renderingContextMock = $this->createMock(RenderingContextInterface::class); - $result = IsStringViewHelper::renderStatic($arguments, function () {}, $renderingContextMock); + $result = IsStringViewHelper::renderStatic($arguments, function() {}, $renderingContextMock); self::assertSame('elseResult', $result, 'elseResult was not rendered'); } } diff --git a/Tests/Unit/ViewHelpers/Document/RelevanceViewHelperTest.php b/Tests/Unit/ViewHelpers/Document/RelevanceViewHelperTest.php index d73472bad1..7a87e2acf8 100644 --- a/Tests/Unit/ViewHelpers/Document/RelevanceViewHelperTest.php +++ b/Tests/Unit/ViewHelpers/Document/RelevanceViewHelperTest.php @@ -41,7 +41,7 @@ public function canCalculateRelevance(): void 'document' => $documentMock, ]; $renderingContextMock = $this->createMock(RenderingContextInterface::class); - $score = RelevanceViewHelper::renderStatic($arguments, function () {}, $renderingContextMock); + $score = RelevanceViewHelper::renderStatic($arguments, function() {}, $renderingContextMock); self::assertEquals(10.0, $score, 'Unexpected score'); } @@ -61,7 +61,7 @@ public function canCalculateRelevanceFromPassedMaximumScore(): void 'maximumScore' => 11, ]; $renderingContextMock = $this->createMock(RenderingContextInterface::class); - $score = RelevanceViewHelper::renderStatic($arguments, function () {}, $renderingContextMock); + $score = RelevanceViewHelper::renderStatic($arguments, function() {}, $renderingContextMock); self::assertEquals(5.0, $score, 'Unexpected score'); } diff --git a/Tests/Unit/ViewHelpers/Facet/Area/GroupViewHelperTest.php b/Tests/Unit/ViewHelpers/Facet/Area/GroupViewHelperTest.php index c7c74bac14..f54cbf9322 100644 --- a/Tests/Unit/ViewHelpers/Facet/Area/GroupViewHelperTest.php +++ b/Tests/Unit/ViewHelpers/Facet/Area/GroupViewHelperTest.php @@ -41,7 +41,7 @@ public function canMakeOnlyExpectedFacetsAvailableInStaticContext(): void $testArguments['facets'] = $facetCollection; $testArguments['groupName'] = 'left'; - GroupViewHelper::renderStatic($testArguments, function () {}, $renderingContextMock); + GroupViewHelper::renderStatic($testArguments, function() {}, $renderingContextMock); self::assertTrue($variableContainer->exists('areaFacets'), 'Expected that filteredFacets has been set'); /** @var FacetCollection $facetCollection */ diff --git a/Tests/Unit/ViewHelpers/Facet/Options/Group/Prefix/LabelFilterViewHelperTest.php b/Tests/Unit/ViewHelpers/Facet/Options/Group/Prefix/LabelFilterViewHelperTest.php index 525965f28e..3db2e57acd 100644 --- a/Tests/Unit/ViewHelpers/Facet/Options/Group/Prefix/LabelFilterViewHelperTest.php +++ b/Tests/Unit/ViewHelpers/Facet/Options/Group/Prefix/LabelFilterViewHelperTest.php @@ -54,7 +54,7 @@ public function canMakeOnlyExpectedFacetsAvailableInStaticContext(): void $testArguments['options'] = $optionCollection; $testArguments['prefix'] = 'p'; - LabelFilterViewHelper::renderStatic($testArguments, function () {}, $renderingContextMock); + LabelFilterViewHelper::renderStatic($testArguments, function() {}, $renderingContextMock); self::assertTrue($variableContainer->exists('filteredOptions'), 'Expected that filteredOptions has been set'); /** @var OptionCollection $optionCollection */ @@ -82,7 +82,7 @@ public function canMakeOnlyExpectedFacetsAvailableInStaticContextWithMultiByteCh $testArguments['options'] = $optionCollection; $testArguments['prefix'] = 'ΓΈ'; - LabelFilterViewHelper::renderStatic($testArguments, function () {}, $renderingContextMock); + LabelFilterViewHelper::renderStatic($testArguments, function() {}, $renderingContextMock); self::assertTrue($variableContainer->exists('filteredOptions'), 'Expected that filteredOptions has been set'); /** @var OptionCollection $optionCollection */ diff --git a/Tests/Unit/ViewHelpers/Facet/Options/Group/Prefix/LabelPrefixesViewHelperTest.php b/Tests/Unit/ViewHelpers/Facet/Options/Group/Prefix/LabelPrefixesViewHelperTest.php index 72429ca828..4cabd8f98f 100644 --- a/Tests/Unit/ViewHelpers/Facet/Options/Group/Prefix/LabelPrefixesViewHelperTest.php +++ b/Tests/Unit/ViewHelpers/Facet/Options/Group/Prefix/LabelPrefixesViewHelperTest.php @@ -40,7 +40,7 @@ public function canGetPrefixesSortedByOrderInCollection(): void $testArguments['options'] = $optionCollection; $testArguments['length'] = 1; - LabelPrefixesViewHelper::renderStatic($testArguments, function () {}, $renderingContextMock); + LabelPrefixesViewHelper::renderStatic($testArguments, function() {}, $renderingContextMock); self::assertTrue($variableContainer->exists('prefixes'), 'Expected that prefixes has been set'); $prefixes = $variableContainer->get('prefixes'); self::assertSame(['r', 'p', 'l'], $prefixes, 'ViewHelper registers unexpected prefixes from passed options'); @@ -58,7 +58,7 @@ public function canGetPrefixesSortedAlphabeticalByLabel(): void $testArguments['options'] = $optionCollection; $testArguments['length'] = 1; $testArguments['sortBy'] = 'alpha'; - LabelPrefixesViewHelper::renderStatic($testArguments, function () {}, $renderingContextMock); + LabelPrefixesViewHelper::renderStatic($testArguments, function() {}, $renderingContextMock); $prefixes = $variableContainer->get('prefixes'); self::assertSame(['l', 'p', 'r'], $prefixes, 'ViewHelper registers unexpected prefixes from passed options'); } diff --git a/ext_localconf.php b/ext_localconf.php index 242b911648..3821b40998 100644 --- a/ext_localconf.php +++ b/ext_localconf.php @@ -37,7 +37,7 @@ // ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- # -(static function () { +(static function() { // ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- # // Registering RecordMonitor and GarbageCollector hooks. @@ -221,7 +221,7 @@ $GLOBALS['TYPO3_CONF_VARS']['SYS']['routing']['enhancers']['SolrFacetMaskAndCombineEnhancer'] = SolrFacetMaskAndCombineEnhancer::class; // add solr field to rootline fields - if ($GLOBALS['TYPO3_CONF_VARS']['FE']['addRootLineFields'] === '') { + if (($GLOBALS['TYPO3_CONF_VARS']['FE']['addRootLineFields'] ?? '') === '') { $GLOBALS['TYPO3_CONF_VARS']['FE']['addRootLineFields'] = 'no_search_sub_entries'; } else { $GLOBALS['TYPO3_CONF_VARS']['FE']['addRootLineFields'] .= ',no_search_sub_entries';