From 23ffeb9c5811ccb3c6d32ca70e1f2cd942eda3e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20K=C3=A4hm?= Date: Mon, 7 Oct 2024 12:31:25 +0200 Subject: [PATCH] [TASK] fix CS issues for newest typo3/coding-standards Relates: #3995 --- .../Index/Queue/UpdateHandler/GarbageHandler.php | 2 +- .../Domain/Search/Query/AbstractQueryBuilder.php | 6 +++--- .../Facets/AbstractFacetItemCollection.php | 2 +- .../Search/ResultSet/Facets/FacetCollection.php | 8 ++++---- .../OptionBased/Hierarchy/HierarchyFacetParser.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/IndexQueue/PageIndexer.php | 4 ++-- Classes/Routing/RoutingService.php | 2 +- .../Configuration/ExtensionConfiguration.php | 4 ++-- .../System/Solr/Service/AbstractSolrService.php | 2 +- .../System/UserFunctions/FlexFormUserFunctions.php | 4 ++-- .../Domain/Index/Queue/QueueItemRepositoryTest.php | 4 ++-- Tests/Integration/IndexQueue/PageIndexerTest.php | 4 ++-- Tests/Integration/IntegrationTestBase.php | 2 +- Tests/Integration/Report/SolrVersionStatusTest.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 | 8 ++++---- .../Statistics/StatisticsWriterProcessorTest.php | 4 ++-- .../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/AbstractIndexerTest.php | 2 +- Tests/Unit/IndexQueue/IndexerTest.php | 6 +++--- Tests/Unit/IndexQueue/PageIndexerRequestTest.php | 2 +- Tests/Unit/IndexQueue/RecordMonitorTest.php | 14 +++++++------- .../Unit/Middleware/SolrRoutingMiddlewareTest.php | 2 +- Tests/Unit/SearchTest.php | 4 ++-- .../System/Solr/Service/SolrReadServiceTest.php | 2 +- .../UserFunctions/FlexFormUserFunctionsTest.php | 2 +- Tests/Unit/Task/EventQueueWorkerTaskTest.php | 2 +- ext_localconf.php | 2 +- 47 files changed, 86 insertions(+), 86 deletions(-) diff --git a/Classes/Domain/Index/Queue/UpdateHandler/GarbageHandler.php b/Classes/Domain/Index/Queue/UpdateHandler/GarbageHandler.php index 58daa43cd0..42e4cbd5a2 100644 --- a/Classes/Domain/Index/Queue/UpdateHandler/GarbageHandler.php +++ b/Classes/Domain/Index/Queue/UpdateHandler/GarbageHandler.php @@ -99,7 +99,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/Query/AbstractQueryBuilder.php b/Classes/Domain/Search/Query/AbstractQueryBuilder.php index 1a54de4fad..2f77aeaaee 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/ResultSet/Facets/AbstractFacetItemCollection.php b/Classes/Domain/Search/ResultSet/Facets/AbstractFacetItemCollection.php index af634ebd36..57210eae9f 100644 --- a/Classes/Domain/Search/ResultSet/Facets/AbstractFacetItemCollection.php +++ b/Classes/Domain/Search/ResultSet/Facets/AbstractFacetItemCollection.php @@ -52,7 +52,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 ace40392f9..ee5cdb994d 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 95ee702f68..578dcee657 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/OptionCollection.php b/Classes/Domain/Search/ResultSet/Facets/OptionBased/OptionCollection.php index 19368bb6cc..fec637df0e 100644 --- a/Classes/Domain/Search/ResultSet/Facets/OptionBased/OptionCollection.php +++ b/Classes/Domain/Search/ResultSet/Facets/OptionBased/OptionCollection.php @@ -44,7 +44,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 a95f2df55d..c3e7a1dfc6 100644 --- a/Classes/Domain/Search/ResultSet/Facets/UrlFacetContainer.php +++ b/Classes/Domain/Search/ResultSet/Facets/UrlFacetContainer.php @@ -135,11 +135,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)); } @@ -157,7 +157,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]; @@ -269,7 +269,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 8589ccfd96..92f9086e6e 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 926c387810..1119bf7fa6 100644 --- a/Classes/Domain/Search/Uri/SearchUriBuilder.php +++ b/Classes/Domain/Search/Uri/SearchUriBuilder.php @@ -297,10 +297,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); @@ -333,7 +333,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 d2c7865c68..38ec6d6aaf 100644 --- a/Classes/Domain/Site/SiteRepository.php +++ b/Classes/Domain/Site/SiteRepository.php @@ -226,7 +226,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 466cc6641d..823e2afdd1 100644 --- a/Classes/FrontendEnvironment/Tsfe.php +++ b/Classes/FrontendEnvironment/Tsfe.php @@ -224,7 +224,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 b095fb3b1e..2df3602994 100644 --- a/Classes/IndexQueue/FrontendHelper/UserGroupDetector.php +++ b/Classes/IndexQueue/FrontendHelper/UserGroupDetector.php @@ -208,7 +208,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 ccc3d7ddcb..3e9e8a82d6 100644 --- a/Classes/IndexQueue/Indexer.php +++ b/Classes/IndexQueue/Indexer.php @@ -353,7 +353,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/IndexQueue/PageIndexer.php b/Classes/IndexQueue/PageIndexer.php index 7593998e65..ca4714b9d6 100644 --- a/Classes/IndexQueue/PageIndexer.php +++ b/Classes/IndexQueue/PageIndexer.php @@ -223,7 +223,7 @@ protected function getPageIndexerRequest(): PageIndexerRequest * Builds a URL for a given page ID and then actually build and return the page URL. * * @throws DBALException - * @throws \Exception + * @throws Exception */ protected function getDataUrl(Item $item, int $language = 0): string { @@ -235,7 +235,7 @@ protected function getDataUrl(Item $item, int $language = 0): string /** * Returns the URI strategy object * - * @throws \Exception + * @throws Exception */ protected function getUriBuilder(): PageUriBuilder { diff --git a/Classes/Routing/RoutingService.php b/Classes/Routing/RoutingService.php index 7379aa1733..ee41c00e55 100644 --- a/Classes/Routing/RoutingService.php +++ b/Classes/Routing/RoutingService.php @@ -413,7 +413,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 192bc9fc3a..d59f5b1b4a 100644 --- a/Classes/System/Configuration/ExtensionConfiguration.php +++ b/Classes/System/Configuration/ExtensionConfiguration.php @@ -109,13 +109,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 a367b7b0b8..e18c4284ca 100644 --- a/Classes/System/Solr/Service/AbstractSolrService.php +++ b/Classes/System/Solr/Service/AbstractSolrService.php @@ -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 63ad89600a..6358229f68 100644 --- a/Classes/System/UserFunctions/FlexFormUserFunctions.php +++ b/Classes/System/UserFunctions/FlexFormUserFunctions.php @@ -65,11 +65,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/Tests/Integration/Domain/Index/Queue/QueueItemRepositoryTest.php b/Tests/Integration/Domain/Index/Queue/QueueItemRepositoryTest.php index ef766bcb32..0149064770 100644 --- a/Tests/Integration/Domain/Index/Queue/QueueItemRepositoryTest.php +++ b/Tests/Integration/Domain/Index/Queue/QueueItemRepositoryTest.php @@ -110,7 +110,7 @@ public function canFindItemsAndModifyViaEventListener(): void $this->importCSVDataSet(__DIR__ . '/Fixtures/pages_and_news_queueitems.csv'); $eventDispatcher = $this->createMock(EventDispatcherInterface::class); $eventDispatcher->expects(self::any())->method('dispatch')->willReturnCallback( - static function( + static function ( AfterRecordsForIndexQueueItemsHaveBeenRetrievedEvent $event ): Object { return $event; @@ -126,7 +126,7 @@ static function( self::assertSame('pages', $firstItem->getType(), 'First item has unexpected type'); $eventDispatcher->expects(self::any())->method('dispatch')->willReturnCallback( - static function( + static function ( AfterRecordsForIndexQueueItemsHaveBeenRetrievedEvent $event ): Object { if ($event->getTable() === 'pages') { diff --git a/Tests/Integration/IndexQueue/PageIndexerTest.php b/Tests/Integration/IndexQueue/PageIndexerTest.php index bde52e85d9..3a7084690b 100644 --- a/Tests/Integration/IndexQueue/PageIndexerTest.php +++ b/Tests/Integration/IndexQueue/PageIndexerTest.php @@ -77,11 +77,11 @@ public function canIndexPageWithAccessProtectedContentIntoSolr( ): void { $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 0b31fed4cf..e5f31abbfb 100644 --- a/Tests/Integration/IntegrationTestBase.php +++ b/Tests/Integration/IntegrationTestBase.php @@ -289,7 +289,7 @@ 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 { + 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: in $file:$line" . PHP_EOL . $msg); } diff --git a/Tests/Integration/Report/SolrVersionStatusTest.php b/Tests/Integration/Report/SolrVersionStatusTest.php index fb6fd5f3cd..1c0d202a0c 100644 --- a/Tests/Integration/Report/SolrVersionStatusTest.php +++ b/Tests/Integration/Report/SolrVersionStatusTest.php @@ -45,7 +45,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/Domain/Index/IndexServiceTest.php b/Tests/Unit/Domain/Index/IndexServiceTest.php index a967ff614b..4d2e2ced01 100644 --- a/Tests/Unit/Domain/Index/IndexServiceTest.php +++ b/Tests/Unit/Domain/Index/IndexServiceTest.php @@ -118,7 +118,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 055bac085d..1b7f8c191d 100644 --- a/Tests/Unit/Domain/Index/Queue/QueueInitializerServiceTest.php +++ b/Tests/Unit/Domain/Index/Queue/QueueInitializerServiceTest.php @@ -86,7 +86,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 b6d8842049..481dd88d4c 100644 --- a/Tests/Unit/Domain/Index/Queue/UpdateHandler/DataUpdateHandlerTest.php +++ b/Tests/Unit/Domain/Index/Queue/UpdateHandler/DataUpdateHandlerTest.php @@ -388,7 +388,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 90fe259bc8..ea17359fe2 100644 --- a/Tests/Unit/Domain/Index/Queue/UpdateHandler/EventListener/DelayedProcessingEventListenerTest.php +++ b/Tests/Unit/Domain/Index/Queue/UpdateHandler/EventListener/DelayedProcessingEventListenerTest.php @@ -50,7 +50,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 c8f04d0993..12ad620d18 100644 --- a/Tests/Unit/Domain/Index/Queue/UpdateHandler/EventListener/ImmediateProcessingEventListenerTest.php +++ b/Tests/Unit/Domain/Index/Queue/UpdateHandler/EventListener/ImmediateProcessingEventListenerTest.php @@ -104,7 +104,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 b9eecde878..9308429bba 100644 --- a/Tests/Unit/Domain/Search/Query/QueryBuilderTest.php +++ b/Tests/Unit/Domain/Search/Query/QueryBuilderTest.php @@ -182,7 +182,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 9bd11dba79..d4ed971aac 100644 --- a/Tests/Unit/Domain/Search/ResultSet/Facets/OptionBased/QueryGroup/QueryGroupFacetParserTest.php +++ b/Tests/Unit/Domain/Search/ResultSet/Facets/OptionBased/QueryGroup/QueryGroupFacetParserTest.php @@ -54,13 +54,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 cf2e16f339..f4e0fafe00 100644 --- a/Tests/Unit/Domain/Search/ResultSet/Facets/SetUpFacetParser.php +++ b/Tests/Unit/Domain/Search/ResultSet/Facets/SetUpFacetParser.php @@ -61,17 +61,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 39dd5038b6..092958614a 100644 --- a/Tests/Unit/Domain/Search/ResultSet/ResultSetReconstitutionProcessorTest.php +++ b/Tests/Unit/Domain/Search/ResultSet/ResultSetReconstitutionProcessorTest.php @@ -232,7 +232,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'] : []; } ); @@ -413,7 +413,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'] : []; } ); @@ -463,7 +463,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'] : []; } ); @@ -505,7 +505,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'] : []; } ); @@ -542,7 +542,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'] : []; } ); @@ -584,7 +584,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 12e024e7fe..db38ccda33 100644 --- a/Tests/Unit/Domain/Search/ResultSet/SearchResultSetTest.php +++ b/Tests/Unit/Domain/Search/ResultSet/SearchResultSetTest.php @@ -65,7 +65,7 @@ protected function setUp(): void $this->eventDispatcher = $this->createMock(EventDispatcherInterface::class); $this->eventDispatcher->expects(self::any())->method('dispatch')->willReturnCallback( - static function(object $event) { + static function (object $event) { return $event; } ); @@ -126,7 +126,7 @@ public function testComponentAsEventListenerGetsInitialized(): void $this->configurationMock->expects(self::once())->method('getSearchQueryReturnFieldsAsArray')->willReturn(['*']); $this->eventDispatcher->expects(self::any())->method('dispatch')->willReturnCallback( - static function(object $event) { + static function (object $event) { if ($event instanceof AfterSearchQueryHasBeenPreparedEvent) { $event->getTypoScriptConfiguration()->getSearchConfiguration(); } @@ -149,7 +149,7 @@ public function canRegisterSearchResultSetProcessor(): void $this->configurationMock->expects(self::once())->method('getSearchQueryReturnFieldsAsArray')->willReturn(['*']); $this->eventDispatcher->expects(self::any())->method('dispatch')->willReturnCallback( - static function(object $event) { + static function (object $event) { if ($event instanceof AfterSearchHasBeenExecutedEvent) { foreach ($event->getSearchResultSet()->getSearchResults() as $result) { $result->type = strtoupper($result->type); @@ -226,7 +226,7 @@ public function assertOneSearchWillBeTriggeredWithQueryAndShouldReturnFakeRespon ResponseAdapter $fakeResponse, ): void { $this->searchMock->expects(self::once())->method('search')->willReturnCallback( - static function(Query $query, $offset) use ($expectedQueryString, $expectedOffset, $fakeResponse) { + static function (Query $query, $offset) use ($expectedQueryString, $expectedOffset, $fakeResponse) { self::assertSame($expectedQueryString, $query->getQuery(), 'Search was not triggered with an expected queryString'); self::assertSame($expectedOffset, $offset); return $fakeResponse; diff --git a/Tests/Unit/Domain/Search/Statistics/StatisticsWriterProcessorTest.php b/Tests/Unit/Domain/Search/Statistics/StatisticsWriterProcessorTest.php index d0e0f5e0c6..a89d6fdfb9 100644 --- a/Tests/Unit/Domain/Search/Statistics/StatisticsWriterProcessorTest.php +++ b/Tests/Unit/Domain/Search/Statistics/StatisticsWriterProcessorTest.php @@ -37,7 +37,7 @@ */ class StatisticsWriterProcessorTest extends SetUpUnitTestCase { - protected StatisticsRepository|MockObject$statisticsRepositoryMock; + protected StatisticsRepository|MockObject $statisticsRepositoryMock; protected SiteRepository|MockObject $siteRepositoryMock; protected StatisticsWriterProcessor|MockObject $processor; protected TypoScriptConfiguration|MockObject $typoScriptConfigurationMock; @@ -83,7 +83,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 2929f20824..93921527bf 100644 --- a/Tests/Unit/Domain/Search/Uri/SearchUriBuilderTest.php +++ b/Tests/Unit/Domain/Search/Uri/SearchUriBuilderTest.php @@ -500,7 +500,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), @@ -511,7 +511,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 538644ea64..254919bed4 100644 --- a/Tests/Unit/Domain/Site/SiteRepositoryTest.php +++ b/Tests/Unit/Domain/Site/SiteRepositoryTest.php @@ -145,7 +145,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 89c9576954..d777f1f054 100644 --- a/Tests/Unit/Domain/Variants/IdBuilderTest.php +++ b/Tests/Unit/Domain/Variants/IdBuilderTest.php @@ -44,7 +44,7 @@ public function canUseCustomEventListener(): void { $eventDispatcher = $this->createMock(EventDispatcherInterface::class); $eventDispatcher->expects(self::once())->method('dispatch')->willReturnCallback( - static function(AfterVariantIdWasBuiltEvent $event) { + static function (AfterVariantIdWasBuiltEvent $event) { $event->setVariantId('mycustomid'); return $event; } diff --git a/Tests/Unit/GarbageCollectorTest.php b/Tests/Unit/GarbageCollectorTest.php index a1939c83ac..ad2fc936e1 100644 --- a/Tests/Unit/GarbageCollectorTest.php +++ b/Tests/Unit/GarbageCollectorTest.php @@ -70,7 +70,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); @@ -101,7 +101,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); }); @@ -205,7 +205,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/AbstractIndexerTest.php b/Tests/Unit/IndexQueue/AbstractIndexerTest.php index c34fa8b135..5eb3f59abd 100644 --- a/Tests/Unit/IndexQueue/AbstractIndexerTest.php +++ b/Tests/Unit/IndexQueue/AbstractIndexerTest.php @@ -97,7 +97,7 @@ public function isSerializedValueCanHandleCustomValidSerializedValueDetector(): #[Test] public function resolveFieldValue(array $indexingConfiguration, string $solrFieldName, array $data, $expectedValue): void { - $subject = new class extends AbstractIndexer {}; + $subject = new class () extends AbstractIndexer {}; $tsfe = $this->createMock(TypoScriptFrontendController::class); self::assertEquals( $this->callInaccessibleMethod( diff --git a/Tests/Unit/IndexQueue/IndexerTest.php b/Tests/Unit/IndexQueue/IndexerTest.php index 1b563e8c27..8335712096 100644 --- a/Tests/Unit/IndexQueue/IndexerTest.php +++ b/Tests/Unit/IndexQueue/IndexerTest.php @@ -171,7 +171,7 @@ public function canGetAdditionalDocuments(Closure|null $listener, ?string $expec // @todo: it is really needed to test the EventDispatcher-Stack of libs there? // If not, remove this else block and 'no listener registered' from canGetAdditionalDocumentsDataProvider. $eventDispatcher->expects(self::once())->method('dispatch')->willReturnCallback( - static function(object $event) { + static function (object $event) { return $event; } ); @@ -221,14 +221,14 @@ public static function canGetAdditionalDocumentsDataProvider(): Generator ]; yield 'valid listener, no additional documents' => [ - 'listener' => static function(BeforeDocumentIsProcessedForIndexingEvent $event) { + 'listener' => static function (BeforeDocumentIsProcessedForIndexingEvent $event) { return $event; }, 'expectedException' => null, 'expectedResultCount' => 1, ]; yield 'valid listener, adds an additional document' => [ - 'listener' => static function(BeforeDocumentIsProcessedForIndexingEvent $event) { + 'listener' => static function (BeforeDocumentIsProcessedForIndexingEvent $event) { $event->addDocuments([new Document()]); return $event; }, diff --git a/Tests/Unit/IndexQueue/PageIndexerRequestTest.php b/Tests/Unit/IndexQueue/PageIndexerRequestTest.php index 7f7cfd5ff0..e25d787cd5 100644 --- a/Tests/Unit/IndexQueue/PageIndexerRequestTest.php +++ b/Tests/Unit/IndexQueue/PageIndexerRequestTest.php @@ -153,7 +153,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 fab0c4dee3..76461d303f 100644 --- a/Tests/Unit/IndexQueue/RecordMonitorTest.php +++ b/Tests/Unit/IndexQueue/RecordMonitorTest.php @@ -76,7 +76,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); @@ -105,7 +105,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']); @@ -122,7 +122,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']); @@ -139,7 +139,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, []); @@ -167,7 +167,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, []); @@ -186,7 +186,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); @@ -207,7 +207,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/Middleware/SolrRoutingMiddlewareTest.php b/Tests/Unit/Middleware/SolrRoutingMiddlewareTest.php index 2884c1f65e..e4985eedeb 100644 --- a/Tests/Unit/Middleware/SolrRoutingMiddlewareTest.php +++ b/Tests/Unit/Middleware/SolrRoutingMiddlewareTest.php @@ -53,7 +53,7 @@ protected function setUp(): void ->getMock(); /* @see \TYPO3\CMS\Frontend\Tests\Unit\Middleware\PageResolverTest::setUp */ - $this->responseOutputHandler = new class implements RequestHandlerInterface { + $this->responseOutputHandler = new class () implements RequestHandlerInterface { protected ServerRequestInterface $request; public function handle(ServerRequestInterface $request): ResponseInterface { diff --git a/Tests/Unit/SearchTest.php b/Tests/Unit/SearchTest.php index ccc5c52c55..ad2c2f603e 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/Solr/Service/SolrReadServiceTest.php b/Tests/Unit/System/Solr/Service/SolrReadServiceTest.php index 5b4971e516..beca9b0951 100644 --- a/Tests/Unit/System/Solr/Service/SolrReadServiceTest.php +++ b/Tests/Unit/System/Solr/Service/SolrReadServiceTest.php @@ -105,7 +105,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 e95adfc56b..abe2988f45 100644 --- a/Tests/Unit/System/UserFunctions/FlexFormUserFunctionsTest.php +++ b/Tests/Unit/System/UserFunctions/FlexFormUserFunctionsTest.php @@ -122,7 +122,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 9bee2a5ef2..a588c8e50c 100644 --- a/Tests/Unit/Task/EventQueueWorkerTaskTest.php +++ b/Tests/Unit/Task/EventQueueWorkerTaskTest.php @@ -79,7 +79,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/ext_localconf.php b/ext_localconf.php index 3821b40998..aa1cedc83c 100644 --- a/ext_localconf.php +++ b/ext_localconf.php @@ -37,7 +37,7 @@ // ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- # -(static function() { +(static function () { // ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- # // Registering RecordMonitor and GarbageCollector hooks.