Skip to content

Commit

Permalink
[TASK] fix CS issues for newest typo3/coding-standards
Browse files Browse the repository at this point in the history
  • Loading branch information
dkd-kaehm committed Oct 7, 2024
1 parent 9fbc353 commit 23ffeb9
Show file tree
Hide file tree
Showing 47 changed files with 86 additions and 86 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
);
}
}
Expand Down
6 changes: 3 additions & 3 deletions Classes/Domain/Search/Query/AbstractQueryBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
}
);
Expand All @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
}
Expand Down
8 changes: 4 additions & 4 deletions Classes/Domain/Search/ResultSet/Facets/FacetCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
);
Expand All @@ -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();
}
);
Expand All @@ -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;
}
);
Expand All @@ -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;
}
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
8 changes: 4 additions & 4 deletions Classes/Domain/Search/ResultSet/Facets/UrlFacetContainer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
Expand All @@ -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];
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion Classes/Domain/Search/ResultSet/Sorting/SortingHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
6 changes: 3 additions & 3 deletions Classes/Domain/Search/Uri/SearchUriBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion Classes/Domain/Site/SiteRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -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());

Expand Down
2 changes: 1 addition & 1 deletion Classes/FrontendEnvironment/Tsfe.php
Original file line number Diff line number Diff line change
Expand Up @@ -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());

Expand Down
2 changes: 1 addition & 1 deletion Classes/IndexQueue/FrontendHelper/UserGroupDetector.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down
2 changes: 1 addition & 1 deletion Classes/IndexQueue/Indexer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions Classes/IndexQueue/PageIndexer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand All @@ -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
{
Expand Down
2 changes: 1 addition & 1 deletion Classes/Routing/RoutingService.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
);
Expand Down
4 changes: 2 additions & 2 deletions Classes/System/Configuration/ExtensionConfiguration.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 . '__';
},
Expand Down
2 changes: 1 addition & 1 deletion Classes/System/Solr/Service/AbstractSolrService.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions Classes/System/UserFunctions/FlexFormUserFunctions.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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') {
Expand Down
4 changes: 2 additions & 2 deletions Tests/Integration/IndexQueue/PageIndexerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion Tests/Integration/IntegrationTestBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion Tests/Integration/Report/SolrVersionStatusTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 '
);
Expand Down
2 changes: 1 addition & 1 deletion Tests/Unit/Domain/Index/IndexServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion Tests/Unit/Domain/Search/Query/QueryBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});

Expand Down
Loading

0 comments on commit 23ffeb9

Please sign in to comment.