From 232574be22bde775c19a4054a42f2746319cd0f0 Mon Sep 17 00:00:00 2001 From: Timon Heuser Date: Wed, 19 Aug 2026 10:14:26 +0200 Subject: [PATCH] CHORE: format code according to PER coding style --- Classes/Aspects/CacheUrlMappingAspect.php | 16 ++--- ...setHandlingInContentCacheFlusherAspect.php | 6 +- .../AutomaticReleaseStatusDataSource.php | 6 +- Classes/BackendUi/BackendDateFormatter.php | 2 +- Classes/BackendUi/BackendUiDataService.php | 36 ++++++------ .../BackendUi/Dto/ContentReleaseDetails.php | 2 +- .../Dto/ContentReleaseOverviewRow.php | 2 +- Classes/BackendUi/Dto/WorkerErrorLog.php | 2 +- Classes/BackendUi/RenderingErrorExtractor.php | 2 +- .../BackendUi/WorkerErrorLogAggregator.php | 9 ++- .../ContentReleaseEventsCommandController.php | 6 +- ...ContentReleasePrepareCommandController.php | 12 ++-- ...ntReleaseQuickPublishCommandController.php | 6 +- .../ContentReleaseSwitchCommandController.php | 6 +- ...ontentReleaseTransferCommandController.php | 4 +- ...tentReleaseValidationCommandController.php | 22 +++---- .../ContentStorePruneCommandController.php | 2 +- .../NodeEnumerationCommandController.php | 2 +- .../NodeRenderingCommandController.php | 8 +-- Classes/ContentReleaseManager.php | 31 +++++----- Classes/Controller/BackendController.php | 24 ++++---- .../Core/AutomaticReleaseSwitchService.php | 4 +- Classes/Core/ConcurrentBuildLockService.php | 2 +- .../AutomaticReleasePauseState.php | 6 +- .../ConsoleStatisticsEventOutput.php | 4 +- .../Infrastructure/ContentReleaseLogger.php | 12 ++-- .../Infrastructure/RedisClientManager.php | 14 ++--- .../RedisContentReleaseSizeService.php | 2 +- .../RedisStatisticsEventOutput.php | 2 +- .../RedisStatisticsEventService.php | 8 +-- .../StatisticsEventOutputInterface.php | 2 +- Classes/Eel/ModuleHelper.php | 6 +- Classes/Exception.php | 4 +- Classes/Exception/InvalidReleaseException.php | 4 +- .../InvalidSiteConfigurationException.php | 4 +- .../InvalidTransferConfigException.php | 4 +- Classes/Exception/NodeNotFoundException.php | 4 +- ...uickContentReleaseNotPossibleException.php | 4 +- Classes/Exception/RenderingException.php | 2 +- .../Domain/Dto/EnumeratedNode.php | 12 ++-- .../Repository/RedisEnumerationRepository.php | 14 ++--- .../Domain/Service/NodeContextCombinator.php | 11 ++-- Classes/NodeEnumeration/NodeEnumerator.php | 29 +++++----- .../Dto/DocumentNodeCacheKey.php | 8 +-- .../Dto/RenderedDocumentFromContentCache.php | 4 +- .../NodeRendering/Dto/RenderingStatistics.php | 2 +- .../ContentReleaseWriterInterface.php | 2 +- .../ContentReleaseWriters/GzipWriter.php | 10 ++-- .../ContentReleaseWriters/LegacyWriter.php | 8 +-- .../DocumentEnumerators/DefaultEnumerator.php | 6 +- .../DocumentEnumerators/LimitEnumerator.php | 4 +- .../DocumentMetadataGeneratorInterface.php | 2 +- .../DocumentRendererInterface.php | 2 +- .../DocumentRenderers/FusionHtmlRenderer.php | 6 +- .../NodeRenderingExtensionManager.php | 26 ++++----- .../RedisContentCacheReader.php | 8 +-- .../RedisRenderingErrorManager.php | 12 ++-- .../Infrastructure/RedisRenderingQueue.php | 37 ++++++------ .../RedisRenderingTimeStatisticsStore.php | 24 ++++---- .../InterruptibleProcessRuntime.php | 2 +- ...erruptibleProcessRuntimeEventInterface.php | 4 +- .../NodeRendering/NodeRenderOrchestrator.php | 53 +++++++++-------- Classes/NodeRendering/NodeRenderer.php | 58 +++++++++---------- .../NodeRendering/NodeRenderingUriService.php | 10 ++-- .../NodeRendering/Render/CustomFusionView.php | 4 +- .../NodeRendering/Render/DocumentRenderer.php | 14 ++--- .../Render/ExtractedExceptionDto.php | 4 +- .../Render/RenderExceptionExtractor.php | 2 +- Classes/Package.php | 7 +-- .../Dto/ContentReleaseMetadata.php | 23 ++++---- .../RedisContentReleaseService.php | 32 +++++----- Classes/QuickPublish/ContentReleaseScope.php | 4 +- .../Dto/QuickPublishPreviewRow.php | 4 +- .../RedisReleaseCopyService.php | 42 +++++++------- .../QuickPublishNodeEnumerator.php | 34 +++++------ .../QuickPublishPreviewService.php | 7 +-- .../RedisReleaseSwitchService.php | 14 ++--- Classes/Transfer/ContentReleaseCleaner.php | 16 ++--- .../Transfer/ContentReleaseSynchronizer.php | 38 ++++++------ .../Dto/RedisKeyPostfixForEachRelease.php | 6 +- .../Resource/RemoteResourceSynchronizer.php | 4 +- .../MultisiteFileSystemSymlinkTarget.php | 2 +- Classes/Utility/GeneratorUtility.php | 2 +- Classes/Utility/Sparkline.php | 10 ++-- .../Features/Bootstrap/FeatureContext.php | 57 +++++++++--------- .../Fixtures/StubPrunnerApiService.php | 4 +- .../AutomaticReleaseStatusDataSourceTest.php | 20 +++---- Tests/Unit/ContentReleaseManagerTest.php | 12 ++-- .../AutomaticReleaseSwitchServiceTest.php | 13 ++--- .../AutomaticReleasePauseStateTest.php | 6 +- .../Domain/Service/DocumentNodeFilterTest.php | 18 +++--- .../QuickPublish/ContentReleaseScopeTest.php | 20 +++---- .../QuickPublish/Dto/NodeIdentifiersTest.php | 8 +-- .../RedisReleaseCopyServiceTest.php | 27 +++++---- .../RedisKeyPostfixesForEachReleaseTest.php | 6 +- mago.toml | 26 +++++++++ 96 files changed, 564 insertions(+), 570 deletions(-) create mode 100644 mago.toml diff --git a/Classes/Aspects/CacheUrlMappingAspect.php b/Classes/Aspects/CacheUrlMappingAspect.php index 3a31b58..bc1333a 100644 --- a/Classes/Aspects/CacheUrlMappingAspect.php +++ b/Classes/Aspects/CacheUrlMappingAspect.php @@ -142,7 +142,7 @@ public function storeRootCacheIdentifier(JoinPointInterface $joinPoint): void . ( $extractedExceptionDto !== null ? "\nException extracted from output: {$extractedExceptionDto}" : '' ), - 1539156004 + 1539156004, ); } @@ -165,7 +165,7 @@ public function storeRootCacheIdentifier(JoinPointInterface $joinPoint): void $logger->info(sprintf( 'Skipping URL %s, because it matches the blacklist %s', $url, - $this->urlExcludelistRegex + $this->urlExcludelistRegex, )); return; @@ -174,7 +174,7 @@ public function storeRootCacheIdentifier(JoinPointInterface $joinPoint): void if ($rootIdentifier === null) { throw new Exception( 'Could not find root cache identifier for ' . $url . ', possible rendering error?', - 1491394849 + 1491394849, ); } @@ -185,19 +185,19 @@ public function storeRootCacheIdentifier(JoinPointInterface $joinPoint): void $rootKey = DocumentNodeCacheKey::fromNodeAndArguments($node, $arguments); $rootCacheValues = DocumentNodeCacheValues::create($rootIdentifier, $url)->withMetadata( 'renderTime', - (int) ( microtime(true) * 1000 ) - $this->renderTimestamp + (int) (microtime(true) * 1000) - $this->renderTimestamp, ); // allow other document metadata generators here $rootCacheValues = $this->nodeRenderingExtensionManager->runDocumentMetadataGenerators( $node, $arguments, $this->controllerContext, - $rootCacheValues + $rootCacheValues, ); $this->contentCacheFrontend->set( $rootKey->redisKeyName(), json_encode($rootCacheValues, JSON_THROW_ON_ERROR), - $rootTags + $rootTags, ); $this->mappingWasWrittenForCurrentDocument = true; } @@ -253,7 +253,7 @@ public function beforeDocumentRendering(ContentReleaseLogger $contentReleaseLogg { $this->isActive = true; $this->contentReleaseLogger = $contentReleaseLogger; - $this->renderTimestamp = (int) ( microtime(true) * 1000 ); + $this->renderTimestamp = (int) (microtime(true) * 1000); $this->mappingWasWrittenForCurrentDocument = false; } @@ -265,7 +265,7 @@ public function afterDocumentRendering(): void // about the reason. {@see storeRootCacheIdentifier()} if (!$this->mappingWasWrittenForCurrentDocument && $this->contentReleaseLogger !== null) { $this->contentReleaseLogger->warn( - 'No "doc--..." mapping entry was written for this rendering, so it can never be added to the content release. Either the rendering was fully served from the content cache (then the content cache entries of this node need to be flushed before re-rendering), or its URL is excluded via nodeRendering.urlExcludelistRegex while the node is still part of the enumeration.' + 'No "doc--..." mapping entry was written for this rendering, so it can never be added to the content release. Either the rendering was fully served from the content cache (then the content cache entries of this node need to be flushed before re-rendering), or its URL is excluded via nodeRendering.urlExcludelistRegex while the node is still part of the enumeration.', ); } diff --git a/Classes/Aspects/FixedAssetHandlingInContentCacheFlusherAspect.php b/Classes/Aspects/FixedAssetHandlingInContentCacheFlusherAspect.php index 20eee64..8a14874 100644 --- a/Classes/Aspects/FixedAssetHandlingInContentCacheFlusherAspect.php +++ b/Classes/Aspects/FixedAssetHandlingInContentCacheFlusherAspect.php @@ -116,7 +116,7 @@ public function registerAssetChange(JoinPointInterface $joinPoint) $tagsToFlush[$assetCacheTag] = sprintf( 'which were tagged with "%s" because asset "%s" has changed.', $assetCacheTag, - $assetIdentifier + $assetIdentifier, ); ObjectAccess::setProperty($contentCacheFlusher, 'tagsToFlush', $tagsToFlush, true); @@ -128,7 +128,7 @@ public function registerAssetChange(JoinPointInterface $joinPoint) 'workspaceName' => $assetUsage->getWorkspaceName(), 'dimensions' => $assetUsage->getDimensionValues(), 'invisibleContentShown' => true, - 'removedContentShown' => true + 'removedContentShown' => true, ]); $node = $context->getNodeByIdentifier($assetUsage->getNodeIdentifier()); @@ -144,7 +144,7 @@ public function registerAssetChange(JoinPointInterface $joinPoint) $tagsToFlush[$assetCacheTagWithWorkspace] = sprintf( 'which were tagged with "%s" because asset "%s" has changed.', $assetCacheTagWithWorkspace, - $assetIdentifier + $assetIdentifier, ); ObjectAccess::setProperty($contentCacheFlusher, 'tagsToFlush', $tagsToFlush, true); diff --git a/Classes/BackendUi/AutomaticReleaseStatusDataSource.php b/Classes/BackendUi/AutomaticReleaseStatusDataSource.php index 3e3150a..c5da260 100644 --- a/Classes/BackendUi/AutomaticReleaseStatusDataSource.php +++ b/Classes/BackendUi/AutomaticReleaseStatusDataSource.php @@ -57,13 +57,13 @@ public function getData(?NodeInterface $node = null, array $arguments = []): arr 'automaticReleases.paused.contentModuleWarning', [ $this->backendDateFormatter->format($pauseState->getPausedAt()), - $pauseState->getSuppressedReleaseCount() + $pauseState->getSuppressedReleaseCount(), ], null, null, 'Main', - 'Flowpack.DecoupledContentStore' - ) + 'Flowpack.DecoupledContentStore', + ), ]; } } diff --git a/Classes/BackendUi/BackendDateFormatter.php b/Classes/BackendUi/BackendDateFormatter.php index 267a291..3316ea1 100644 --- a/Classes/BackendUi/BackendDateFormatter.php +++ b/Classes/BackendUi/BackendDateFormatter.php @@ -30,7 +30,7 @@ public function format(\DateTimeInterface $dateTime): string return $this->datetimeFormatter->formatDateTime( $dateTime, $this->localizationService->getConfiguration()->getCurrentLocale(), - DatesReader::FORMAT_LENGTH_MEDIUM + DatesReader::FORMAT_LENGTH_MEDIUM, ); } } diff --git a/Classes/BackendUi/BackendUiDataService.php b/Classes/BackendUi/BackendUiDataService.php index 73a15cc..a8d6e5a 100644 --- a/Classes/BackendUi/BackendUiDataService.php +++ b/Classes/BackendUi/BackendUiDataService.php @@ -16,8 +16,8 @@ use Flowpack\DecoupledContentStore\PrepareContentRelease\Dto\ContentReleaseMetadata; use Flowpack\DecoupledContentStore\PrepareContentRelease\Infrastructure\RedisContentReleaseService; use Flowpack\DecoupledContentStore\ReleaseSwitch\Infrastructure\RedisReleaseSwitchService; -use Neos\Flow\Annotations as Flow; use Flowpack\Prunner\PrunnerApiService; +use Neos\Flow\Annotations as Flow; /** * @Flow\Scope("singleton") @@ -65,33 +65,33 @@ public function loadBackendOverviewData(RedisInstanceIdentifier $redisInstanceId $contentReleaseIds = $this->redisContentReleaseService->fetchAllReleaseIds($redisInstanceIdentifier); $metadata = $this->redisContentReleaseService->fetchMetadataForContentReleases( $redisInstanceIdentifier, - ...$contentReleaseIds + ...$contentReleaseIds, ); $counts = $this->redisEnumerationRepository->countMultiple($redisInstanceIdentifier, ...$contentReleaseIds); $iterationsCounts = $this->redisRenderingStatisticsStore->countMultipleRenderingStatistics( $redisInstanceIdentifier, - ...$contentReleaseIds + ...$contentReleaseIds, ); $errorCounts = $this->redisRenderingErrorManager->countMultipleErrors( $redisInstanceIdentifier, - ...$contentReleaseIds + ...$contentReleaseIds, ); $lastRenderingStatisticsEntries = $this->redisRenderingStatisticsStore->getLastRenderingStatisticsEntry( $redisInstanceIdentifier, - ...$contentReleaseIds + ...$contentReleaseIds, ); $firstRenderingStatisticsEntries = $this->redisRenderingStatisticsStore->getFirstRenderingStatisticsEntry( $redisInstanceIdentifier, - ...$contentReleaseIds + ...$contentReleaseIds, ); $result = []; foreach ($contentReleaseIds as $contentReleaseId) { $lastRendering = RenderingStatistics::fromJsonString($lastRenderingStatisticsEntries->getResultForContentRelease( - $contentReleaseId + $contentReleaseId, )); $firstRendering = RenderingStatistics::fromJsonString($firstRenderingStatisticsEntries->getResultForContentRelease( - $contentReleaseId + $contentReleaseId, )); $metadataForContentRelease = $metadata->getResultForContentRelease($contentReleaseId); @@ -106,15 +106,15 @@ public function loadBackendOverviewData(RedisInstanceIdentifier $redisInstanceId is_int($iterationsCountForContentRelease) ? $iterationsCountForContentRelease : 0, is_int($errorCountForContentRelease) ? $errorCountForContentRelease : 0, $lastRendering->getTotalJobs() > 0 - ? round(( $lastRendering->getRenderedJobs() / $lastRendering->getTotalJobs() ) * 100) + ? round(($lastRendering->getRenderedJobs() / $lastRendering->getTotalJobs()) * 100) : 100, $firstRendering->getRenderedJobs(), $contentReleaseId->equals($this->redisReleaseSwitchService->getCurrentRelease( - $redisInstanceIdentifier + $redisInstanceIdentifier, )), $metadataForContentRelease instanceof ContentReleaseMetadata ? $metadataForContentRelease->getContentReleaseSize() - : null + : null, ); } @@ -123,11 +123,11 @@ public function loadBackendOverviewData(RedisInstanceIdentifier $redisInstanceId public function loadDetailsData( ContentReleaseIdentifier $contentReleaseIdentifier, - RedisInstanceIdentifier $redisInstanceIdentifier + RedisInstanceIdentifier $redisInstanceIdentifier, ): ?ContentReleaseDetails { $contentReleaseMetadata = $this->redisContentReleaseService->fetchMetadataForContentRelease( $contentReleaseIdentifier, - $redisInstanceIdentifier + $redisInstanceIdentifier, ); if (!$contentReleaseMetadata) { @@ -135,7 +135,7 @@ public function loadDetailsData( } $contentReleaseJob = $this->prunnerApiService->loadJobDetail( - $contentReleaseMetadata->getPrunnerJobId()->toJobId() + $contentReleaseMetadata->getPrunnerJobId()->toJobId(), ); $manualTransferJobs = count($contentReleaseMetadata->getManualTransferJobIds()) @@ -150,13 +150,13 @@ function (string $item) { }, $this->redisRenderingStatisticsStore->getRenderingStatistics( $contentReleaseIdentifier, - $redisInstanceIdentifier - ) + $redisInstanceIdentifier, + ), ); $renderingErrorCount = count($this->redisRenderingErrorManager->getRenderingErrors( $contentReleaseIdentifier, - $redisInstanceIdentifier + $redisInstanceIdentifier, )); $currentReleaseIdentifier = $this->redisReleaseSwitchService->getCurrentRelease($redisInstanceIdentifier); @@ -169,7 +169,7 @@ function (string $item) { $renderingErrorCount, $contentReleaseIdentifier->equals($currentReleaseIdentifier), $manualTransferJobs, - $contentReleaseMetadata->getContentReleaseSize() + $contentReleaseMetadata->getContentReleaseSize(), ); } } diff --git a/Classes/BackendUi/Dto/ContentReleaseDetails.php b/Classes/BackendUi/Dto/ContentReleaseDetails.php index 10802e6..52a9d21 100644 --- a/Classes/BackendUi/Dto/ContentReleaseDetails.php +++ b/Classes/BackendUi/Dto/ContentReleaseDetails.php @@ -39,7 +39,7 @@ public function __construct( int $renderingErrorCount, bool $isActive, array $manualTransferJobIds, - ?float $contentReleaseSize = null + ?float $contentReleaseSize = null, ) { $this->contentReleaseIdentifier = $contentReleaseIdentifier; $this->job = $job; diff --git a/Classes/BackendUi/Dto/ContentReleaseOverviewRow.php b/Classes/BackendUi/Dto/ContentReleaseOverviewRow.php index fcae6d0..fbdebe4 100644 --- a/Classes/BackendUi/Dto/ContentReleaseOverviewRow.php +++ b/Classes/BackendUi/Dto/ContentReleaseOverviewRow.php @@ -32,7 +32,7 @@ public function __construct( float $progress, int $renderedUrlCount, bool $isActive, - ?float $releaseSize + ?float $releaseSize, ) { $this->contentReleaseIdentifier = $contentReleaseIdentifier; $this->metadata = $metadata; diff --git a/Classes/BackendUi/Dto/WorkerErrorLog.php b/Classes/BackendUi/Dto/WorkerErrorLog.php index d23c217..80c89fc 100644 --- a/Classes/BackendUi/Dto/WorkerErrorLog.php +++ b/Classes/BackendUi/Dto/WorkerErrorLog.php @@ -24,7 +24,7 @@ public function __construct( public int $exitCode, public ?string $taskError, public array $errorBlocks, - public ?string $lastAttemptedNode = null + public ?string $lastAttemptedNode = null, ) { $this->wasKilledByOrchestrator = $this->exitCode === WorkerErrorLogAggregator::EXIT_CODE_SIGTERM; } diff --git a/Classes/BackendUi/RenderingErrorExtractor.php b/Classes/BackendUi/RenderingErrorExtractor.php index 2eea22c..cb6cbf4 100644 --- a/Classes/BackendUi/RenderingErrorExtractor.php +++ b/Classes/BackendUi/RenderingErrorExtractor.php @@ -94,7 +94,7 @@ public function extractLastAttemptedNode(string $log): ?string '/"node"\s*:\s*"((?:\\\\.|[^"\\\\])*)"(?:\s*,\s*"nodeUri"\s*:\s*"((?:\\\\.|[^"\\\\])*)")?/', $log, $matches, - PREG_SET_ORDER + PREG_SET_ORDER, )) { return null; } diff --git a/Classes/BackendUi/WorkerErrorLogAggregator.php b/Classes/BackendUi/WorkerErrorLogAggregator.php index f2da94b..5e78223 100644 --- a/Classes/BackendUi/WorkerErrorLogAggregator.php +++ b/Classes/BackendUi/WorkerErrorLogAggregator.php @@ -37,8 +37,7 @@ class WorkerErrorLogAggregator */ public function aggregate(Job $job): array { - $renderTasks = $job - ->getTaskResults() + $renderTasks = $job->getTaskResults() ->filteredByPrefix('render_') ->withoutTasks('render_finished', 'render_orchestrator'); @@ -60,8 +59,8 @@ public function aggregate(Job $job): array // sort worker names naturally (1, 2, ..., 10 instead of 1, 10, ..., 2). usort($erroredTasks, static function (TaskResult $a, TaskResult $b): int { $killedComparison = - ( $a->getExitCode() === self::EXIT_CODE_SIGTERM ? 1 : 0 ) - <=> ( $b->getExitCode() === self::EXIT_CODE_SIGTERM ? 1 : 0 ); + ($a->getExitCode() === self::EXIT_CODE_SIGTERM ? 1 : 0) + <=> ($b->getExitCode() === self::EXIT_CODE_SIGTERM ? 1 : 0); return $killedComparison !== 0 ? $killedComparison : strnatcasecmp($a->getName(), $b->getName()); }); @@ -83,7 +82,7 @@ public function aggregate(Job $job): array $task->getExitCode(), $task->getError() ?: null, $blocks, - $lastAttemptedNode + $lastAttemptedNode, ); } diff --git a/Classes/Command/ContentReleaseEventsCommandController.php b/Classes/Command/ContentReleaseEventsCommandController.php index 9afe977..4949ee0 100644 --- a/Classes/Command/ContentReleaseEventsCommandController.php +++ b/Classes/Command/ContentReleaseEventsCommandController.php @@ -4,11 +4,11 @@ namespace Flowpack\DecoupledContentStore\Command; +use Flowpack\DecoupledContentStore\Core\Domain\ValueObject\ContentReleaseIdentifier; use Flowpack\DecoupledContentStore\Core\Domain\ValueObject\PrunnerJobId; +use Flowpack\DecoupledContentStore\Core\Infrastructure\ContentReleaseLogger; use Flowpack\DecoupledContentStore\Core\Infrastructure\RedisStatisticsEventService; use Neos\Flow\Annotations as Flow; -use Flowpack\DecoupledContentStore\Core\Domain\ValueObject\ContentReleaseIdentifier; -use Flowpack\DecoupledContentStore\Core\Infrastructure\ContentReleaseLogger; use Neos\Flow\Cli\CommandController; /** @@ -38,7 +38,7 @@ class ContentReleaseEventsCommandController extends CommandController public function countStatisticsEventCommand( string $contentReleaseIdentifier, string $where = '', - string $groupBy = '' + string $groupBy = '', ): void { $contentReleaseIdentifier = ContentReleaseIdentifier::fromString($contentReleaseIdentifier); // split every string in $where by the first '=' and use the left part as key and the right part as value diff --git a/Classes/Command/ContentReleasePrepareCommandController.php b/Classes/Command/ContentReleasePrepareCommandController.php index 465dbe1..a64da0a 100644 --- a/Classes/Command/ContentReleasePrepareCommandController.php +++ b/Classes/Command/ContentReleasePrepareCommandController.php @@ -5,11 +5,11 @@ namespace Flowpack\DecoupledContentStore\Command; use Flowpack\DecoupledContentStore\Core\ConcurrentBuildLockService; +use Flowpack\DecoupledContentStore\Core\Domain\ValueObject\ContentReleaseIdentifier; use Flowpack\DecoupledContentStore\Core\Domain\ValueObject\PrunnerJobId; +use Flowpack\DecoupledContentStore\Core\Infrastructure\ContentReleaseLogger; use Flowpack\DecoupledContentStore\PrepareContentRelease\Infrastructure\RedisContentReleaseService; use Neos\Flow\Annotations as Flow; -use Flowpack\DecoupledContentStore\Core\Domain\ValueObject\ContentReleaseIdentifier; -use Flowpack\DecoupledContentStore\Core\Infrastructure\ContentReleaseLogger; use Neos\Flow\Cli\CommandController; use Neos\Fusion\Core\Cache\ContentCache; @@ -40,7 +40,7 @@ public function createContentReleaseCommand( string $contentReleaseIdentifier, string $prunnerJobId, string $workspaceName = 'live', - string $accountId = 'cli' + string $accountId = 'cli', ): void { $contentReleaseIdentifier = ContentReleaseIdentifier::fromString($contentReleaseIdentifier); $prunnerJobId = PrunnerJobId::fromString($prunnerJobId); @@ -50,7 +50,7 @@ public function createContentReleaseCommand( $prunnerJobId, $logger, $workspaceName, - $accountId + $accountId, ); } @@ -72,11 +72,11 @@ public function registerManualTransferJobCommand(string $contentReleaseIdentifie public function flushContentCacheIfRequiredCommand( string $contentReleaseIdentifier, - bool $flushContentCache = false + bool $flushContentCache = false, ): void { $logger = ContentReleaseLogger::fromConsoleOutput( $this->output, - ContentReleaseIdentifier::fromString($contentReleaseIdentifier) + ContentReleaseIdentifier::fromString($contentReleaseIdentifier), ); if (!$flushContentCache) { $logger->info('Not flushing content cache'); diff --git a/Classes/Command/ContentReleaseQuickPublishCommandController.php b/Classes/Command/ContentReleaseQuickPublishCommandController.php index 3bb080e..ebf3161 100644 --- a/Classes/Command/ContentReleaseQuickPublishCommandController.php +++ b/Classes/Command/ContentReleaseQuickPublishCommandController.php @@ -35,7 +35,7 @@ final class ContentReleaseQuickPublishCommandController extends CommandControlle public function copyReleaseWithinCommand( string $redisContentStoreIdentifier, string $sourceContentReleaseIdentifier, - string $targetContentReleaseIdentifier + string $targetContentReleaseIdentifier, ): void { $redisInstanceIdentifier = RedisInstanceIdentifier::fromString($redisContentStoreIdentifier); $sourceIdentifier = ContentReleaseIdentifier::fromString($sourceContentReleaseIdentifier); @@ -47,7 +47,7 @@ public function copyReleaseWithinCommand( $redisInstanceIdentifier, $sourceIdentifier, $targetIdentifier, - $logger + $logger, ); } catch (Exception $exception) { // the pipeline shows the task log, so an uncaught exception would bury the reason under a stack trace @@ -72,7 +72,7 @@ public function enumerateGivenNodesCommand(string $contentReleaseIdentifier, str $this->quickPublishNodeEnumerator->enumerateGivenNodesAndStoreInRedis( NodeIdentifiers::fromCommaSeparatedString($nodeIdentifiers), $logger, - $releaseIdentifier + $releaseIdentifier, ); } catch (Exception $exception) { $logger->error($exception->getMessage()); diff --git a/Classes/Command/ContentReleaseSwitchCommandController.php b/Classes/Command/ContentReleaseSwitchCommandController.php index 0955151..e1209b5 100644 --- a/Classes/Command/ContentReleaseSwitchCommandController.php +++ b/Classes/Command/ContentReleaseSwitchCommandController.php @@ -4,11 +4,11 @@ namespace Flowpack\DecoupledContentStore\Command; +use Flowpack\DecoupledContentStore\Core\Domain\ValueObject\ContentReleaseIdentifier; use Flowpack\DecoupledContentStore\Core\Domain\ValueObject\RedisInstanceIdentifier; +use Flowpack\DecoupledContentStore\Core\Infrastructure\ContentReleaseLogger; use Flowpack\DecoupledContentStore\ReleaseSwitch\Infrastructure\RedisReleaseSwitchService; use Neos\Flow\Annotations as Flow; -use Flowpack\DecoupledContentStore\Core\Domain\ValueObject\ContentReleaseIdentifier; -use Flowpack\DecoupledContentStore\Core\Infrastructure\ContentReleaseLogger; use Neos\Flow\Cli\CommandController; /** @@ -31,7 +31,7 @@ public function switchActiveContentReleaseCommand(string $redisInstanceIdentifie $this->redisReleaseSwitchService->switchContentRelease( $redisInstanceIdentifier, $contentReleaseIdentifier, - $logger + $logger, ); } } diff --git a/Classes/Command/ContentReleaseTransferCommandController.php b/Classes/Command/ContentReleaseTransferCommandController.php index c312dd5..3113984 100644 --- a/Classes/Command/ContentReleaseTransferCommandController.php +++ b/Classes/Command/ContentReleaseTransferCommandController.php @@ -4,13 +4,13 @@ namespace Flowpack\DecoupledContentStore\Command; +use Flowpack\DecoupledContentStore\Core\Domain\ValueObject\ContentReleaseIdentifier; use Flowpack\DecoupledContentStore\Core\Domain\ValueObject\RedisInstanceIdentifier; +use Flowpack\DecoupledContentStore\Core\Infrastructure\ContentReleaseLogger; use Flowpack\DecoupledContentStore\Transfer\ContentReleaseCleaner; use Flowpack\DecoupledContentStore\Transfer\ContentReleaseSynchronizer; use Flowpack\DecoupledContentStore\Transfer\Resource\RemoteResourceSynchronizer; use Neos\Flow\Annotations as Flow; -use Flowpack\DecoupledContentStore\Core\Domain\ValueObject\ContentReleaseIdentifier; -use Flowpack\DecoupledContentStore\Core\Infrastructure\ContentReleaseLogger; use Neos\Flow\Cli\CommandController; /** diff --git a/Classes/Command/ContentReleaseValidationCommandController.php b/Classes/Command/ContentReleaseValidationCommandController.php index 13d151b..69f5687 100644 --- a/Classes/Command/ContentReleaseValidationCommandController.php +++ b/Classes/Command/ContentReleaseValidationCommandController.php @@ -55,11 +55,11 @@ public function validateCommand(string $contentReleaseIdentifier) $logger->info(sprintf( 'Validating URL count of content release %s (threshold: %d%% of the currently live release).', $contentReleaseIdentifier->getIdentifier(), - $this->validReleaseUrlCountThreshold * 100 + $this->validReleaseUrlCountThreshold * 100, )); $currentlyLiveReleaseIdentifier = $this->redisReleaseSwitchService->getCurrentRelease( - RedisInstanceIdentifier::primary() + RedisInstanceIdentifier::primary(), ); if ($currentlyLiveReleaseIdentifier === null) { $logger->info('Did not find a previous Content Release; thus exiting early (OK).'); @@ -77,31 +77,31 @@ public function validateCommand(string $contentReleaseIdentifier) $logger->info(sprintf( 'Minimum URL Count for automatic switch: %d (new release has %d%% of the previous one).', $minimumUrlsCount, - $currentUrlsCount > 0 ? round(( $newUrlsCount / $currentUrlsCount ) * 100) : 100 + $currentUrlsCount > 0 ? round(($newUrlsCount / $currentUrlsCount) * 100) : 100, )); $alreadyRegisteredErrorCount = count($this->redisRenderingErrorManager->getRenderingErrors( - $contentReleaseIdentifier + $contentReleaseIdentifier, )); if ($alreadyRegisteredErrorCount > 0) { $logger->warn(sprintf( '%d rendering error(s) are already registered for this release; the pipeline will abort in validate_finished.', - $alreadyRegisteredErrorCount + $alreadyRegisteredErrorCount, )); } - if ($newUrlsCount < ( $this->validReleaseUrlCountThreshold * $currentUrlsCount )) { + if ($newUrlsCount < ($this->validReleaseUrlCountThreshold * $currentUrlsCount)) { $message = sprintf( 'Invalid release due to low URL count: (has %d of currently %d, need at least %d for automatic switch)', $newUrlsCount, $currentUrlsCount, - $this->validReleaseUrlCountThreshold * $currentUrlsCount + $this->validReleaseUrlCountThreshold * $currentUrlsCount, ); $logger->error($message); $this->redisRenderingErrorManager->registerRenderingError( $contentReleaseIdentifier, [], - new Exception($message, 1493387482) + new Exception($message, 1493387482), ); $this->logCompletion($logger, $startedAt); exit(1); @@ -124,7 +124,7 @@ public function validateCommand(string $contentReleaseIdentifier) private function countUrls( ContentReleaseIdentifier $contentReleaseIdentifier, ContentReleaseLogger $logger, - string $label + string $label, ): int { if ($this->contentReleaseScope->getChangedUrls($contentReleaseIdentifier) === null) { return $this->redisEnumerationRepository->count($contentReleaseIdentifier); @@ -144,7 +144,7 @@ private function logCompletion(ContentReleaseLogger $logger, float $startedAt): { $logger->info(sprintf( 'contentReleaseValidation:validate finished in %.2f seconds.', - microtime(true) - $startedAt + microtime(true) - $startedAt, )); } @@ -157,7 +157,7 @@ public function ensureNoValidationErrorsExistCommand(string $contentReleaseIdent $logger->info(sprintf( 'Checking rendering errors of content release %s: %d found.', $contentReleaseIdentifier->getIdentifier(), - count($errors) + count($errors), )); foreach ($errors as $error) { diff --git a/Classes/Command/ContentStorePruneCommandController.php b/Classes/Command/ContentStorePruneCommandController.php index 56b58c0..5924ae6 100644 --- a/Classes/Command/ContentStorePruneCommandController.php +++ b/Classes/Command/ContentStorePruneCommandController.php @@ -6,8 +6,8 @@ use Flowpack\DecoupledContentStore\Core\Domain\ValueObject\RedisInstanceIdentifier; use Flowpack\DecoupledContentStore\Core\RedisPruneService; -use Neos\Flow\Cli\CommandController; use Neos\Flow\Annotations as Flow; +use Neos\Flow\Cli\CommandController; class ContentStorePruneCommandController extends CommandController { diff --git a/Classes/Command/NodeEnumerationCommandController.php b/Classes/Command/NodeEnumerationCommandController.php index 9a72be8..09f5b0b 100644 --- a/Classes/Command/NodeEnumerationCommandController.php +++ b/Classes/Command/NodeEnumerationCommandController.php @@ -4,10 +4,10 @@ namespace Flowpack\DecoupledContentStore\Command; -use Neos\Flow\Annotations as Flow; use Flowpack\DecoupledContentStore\Core\Domain\ValueObject\ContentReleaseIdentifier; use Flowpack\DecoupledContentStore\Core\Infrastructure\ContentReleaseLogger; use Flowpack\DecoupledContentStore\NodeEnumeration\NodeEnumerator; +use Neos\Flow\Annotations as Flow; use Neos\Flow\Cli\CommandController; /** diff --git a/Classes/Command/NodeRenderingCommandController.php b/Classes/Command/NodeRenderingCommandController.php index f469261..cd95462 100644 --- a/Classes/Command/NodeRenderingCommandController.php +++ b/Classes/Command/NodeRenderingCommandController.php @@ -4,13 +4,13 @@ namespace Flowpack\DecoupledContentStore\Command; +use Flowpack\DecoupledContentStore\Core\Domain\ValueObject\ContentReleaseIdentifier; +use Flowpack\DecoupledContentStore\Core\Infrastructure\ContentReleaseLogger; use Flowpack\DecoupledContentStore\NodeRendering\Dto\RendererIdentifier; use Flowpack\DecoupledContentStore\NodeRendering\InterruptibleProcessRuntime; use Flowpack\DecoupledContentStore\NodeRendering\NodeRenderer; use Flowpack\DecoupledContentStore\NodeRendering\NodeRenderOrchestrator; use Neos\Flow\Annotations as Flow; -use Flowpack\DecoupledContentStore\Core\Domain\ValueObject\ContentReleaseIdentifier; -use Flowpack\DecoupledContentStore\Core\Infrastructure\ContentReleaseLogger; use Neos\Flow\Cli\CommandController; /** @@ -37,7 +37,7 @@ public function orchestrateRenderingCommand(string $contentReleaseIdentifier) InterruptibleProcessRuntime::create($this->nodeRenderOrchestrator->renderContentRelease( $contentReleaseIdentifier, - $logger + $logger, ))->runUntilEnd(); } @@ -50,7 +50,7 @@ public function renderWorkerCommand(string $contentReleaseIdentifier, string $re InterruptibleProcessRuntime::create($this->nodeRenderer->render( $contentReleaseIdentifier, $logger, - $rendererIdentifier + $rendererIdentifier, ))->runUntilEnd(); } } diff --git a/Classes/ContentReleaseManager.php b/Classes/ContentReleaseManager.php index e1bdfb0..58e4f76 100644 --- a/Classes/ContentReleaseManager.php +++ b/Classes/ContentReleaseManager.php @@ -70,7 +70,7 @@ class ContentReleaseManager public function startIncrementalContentRelease( ?string $currentContentReleaseId = null, ?Workspace $workspace = null, - array $additionalVariables = [] + array $additionalVariables = [], ): ContentReleaseIdentifier { $contentReleaseId = ContentReleaseIdentifier::create(); @@ -79,9 +79,9 @@ public function startIncrementalContentRelease( $this->logger->info( sprintf( 'Automatic content releases are paused, so content release %s was not scheduled.', - $contentReleaseId->getIdentifier() + $contentReleaseId->getIdentifier(), ), - LogEnvironment::fromMethodName(__METHOD__) + LogEnvironment::fromMethodName(__METHOD__), ); return $contentReleaseId; @@ -97,8 +97,8 @@ public function startIncrementalContentRelease( 'validate' => true, 'flushContentCache' => false, 'workspaceName' => $workspace !== null ? $workspace->getName() : 'live', - 'accountId' => $this->getAccountId() - ]) + 'accountId' => $this->getAccountId(), + ]), ); return $contentReleaseId; @@ -111,7 +111,7 @@ public function startFullContentRelease( bool $validate = true, ?string $currentContentReleaseId = null, ?Workspace $workspace = null, - array $additionalVariables = [] + array $additionalVariables = [], ): ContentReleaseIdentifier { $contentReleaseId = ContentReleaseIdentifier::create(); $this->prunnerApiService->schedulePipeline( @@ -122,8 +122,8 @@ public function startFullContentRelease( 'validate' => $validate, 'flushContentCache' => true, 'workspaceName' => $workspace !== null ? $workspace->getName() : 'live', - 'accountId' => $this->getAccountId() - ]) + 'accountId' => $this->getAccountId(), + ]), ); return $contentReleaseId; @@ -143,14 +143,14 @@ public function startFullContentRelease( public function startQuickContentRelease( NodeIdentifiers $nodeIdentifiers, ?Workspace $workspace = null, - array $additionalVariables = [] + array $additionalVariables = [], ): ContentReleaseIdentifier { $currentContentReleaseId = $this->resolveCurrentContentReleaseId(null); if ($currentContentReleaseId === self::NO_PREVIOUS_RELEASE) { throw new QuickContentReleaseNotPossibleException( 'There is no content release live at the moment, so there is nothing to publish the given nodes into. ' . 'Run a full content release instead.', - 1786963710 + 1786963710, ); } @@ -163,13 +163,12 @@ public function startQuickContentRelease( // Jobs::waiting() means "never started", which is true of a job cancelled while it was still queued as well. // Such a job stays in prunner's list until it falls out of the pipeline's retention_count - a window only // quick releases consume - so without the isCompleted() guard one cancelled job blocks them all until then. - $queuedQuickReleaseJobs = $quickReleaseJobs - ->waiting() + $queuedQuickReleaseJobs = $quickReleaseJobs->waiting() ->filter(static fn(Job $job): bool => !$job->isCompleted()); if ($quickReleaseJobs->running()->getArray() !== [] || $queuedQuickReleaseJobs->getArray() !== []) { throw new QuickContentReleaseNotPossibleException( 'Another quick content release is still on its way. Wait for it to go live, then publish these nodes.', - 1786963711 + 1786963711, ); } @@ -181,8 +180,8 @@ public function startQuickContentRelease( 'currentContentReleaseId' => $currentContentReleaseId, 'quickPublishNodeIdentifiers' => (string) $nodeIdentifiers, 'workspaceName' => $workspace !== null ? $workspace->getName() : 'live', - 'accountId' => $this->getAccountId() - ]) + 'accountId' => $this->getAccountId(), + ]), ); return $contentReleaseId; @@ -219,7 +218,7 @@ private function runningContentReleaseJobs(): array return array_merge( $jobs->forPipeline(PipelineName::create(self::CONTENT_RELEASE_PIPELINE_NAME))->running()->getArray(), - $jobs->forPipeline(PipelineName::create(self::QUICK_CONTENT_RELEASE_PIPELINE_NAME))->running()->getArray() + $jobs->forPipeline(PipelineName::create(self::QUICK_CONTENT_RELEASE_PIPELINE_NAME))->running()->getArray(), ); } diff --git a/Classes/Controller/BackendController.php b/Classes/Controller/BackendController.php index 5cce8c9..bba9d6c 100644 --- a/Classes/Controller/BackendController.php +++ b/Classes/Controller/BackendController.php @@ -141,7 +141,7 @@ public function indexAction(?string $contentStore = null) $this->view->assign('toggleFromConfigEpoch', $configEpochRedis); $this->view->assign( 'toggleToConfigEpoch', - $configEpochRedis === $currentConfigEpoch ? $previousConfigEpoch : $currentConfigEpoch + $configEpochRedis === $currentConfigEpoch ? $previousConfigEpoch : $currentConfigEpoch, ); $this->view->assign('showToggleConfigEpochButton', $showToggleConfigEpochButton); $automaticReleasePauseState = $this->automaticReleaseSwitchService->getPauseState(); @@ -150,7 +150,7 @@ public function indexAction(?string $contentStore = null) 'automaticReleasePausedAt', $automaticReleasePauseState !== null ? $this->backendDateFormatter->format($automaticReleasePauseState->getPausedAt()) - : null + : null, ); } @@ -159,7 +159,7 @@ public function detailsAction( ?string $contentStore = null, ?string $detailTaskName = '', ?string $prunnerJobId = '', - bool $showAllRenderingErrors = false + bool $showAllRenderingErrors = false, ) { $contentReleaseIdentifier = ContentReleaseIdentifier::fromString($contentReleaseIdentifier); $contentStore = $contentStore @@ -178,7 +178,7 @@ public function detailsAction( $this->view->assign('detailTaskName', $detailTaskName); $this->view->assign('jobLogs', $this->prunnerApiService->loadJobLogs( $prunnerJobId ? PrunnerJobId::fromString($prunnerJobId)->toJobId() : $detailsData->getJob()->getId(), - $detailTaskName + $detailTaskName, )); } elseif ($showAllRenderingErrors && $detailsData->getJob() !== null) { $this->view->assign('workerErrorLogs', $this->workerErrorLogAggregator->aggregate($detailsData->getJob())); @@ -217,7 +217,7 @@ public function removeAction(string $contentReleaseIdentifier, string $redisInst $this->contentReleaseCleaner->removeRelease( $contentReleaseIdentifierToRemove, $redisInstanceIdentifier, - $logger + $logger, ); $this->redirect('index', null, null, ['contentStore' => $redisInstanceIdentifier->getIdentifier()]); @@ -241,7 +241,7 @@ public function switchAction(string $contentReleaseIdentifier, string $redisInst $this->redisReleaseSwitchService->switchContentRelease( $redisInstanceIdentifier, $contentReleaseIdentifier, - $logger + $logger, ); $this->redirect('index', null, null, ['contentStore' => $redisInstanceIdentifier->getIdentifier()]); @@ -249,7 +249,7 @@ public function switchAction(string $contentReleaseIdentifier, string $redisInst public function switchContentReleaseOnOtherInstanceAction( string $targetRedisInstanceIdentifier, - string $contentReleaseIdentifier + string $contentReleaseIdentifier, ) { $redis = $this->redisClientManager->getPrimaryRedis(); $currentContentReleaseId = $redis->get('contentStore:current'); @@ -257,7 +257,7 @@ public function switchContentReleaseOnOtherInstanceAction( $this->prunnerApiService->schedulePipeline(PipelineName::create('manually_transfer_content_release'), [ 'contentReleaseId' => $contentReleaseIdentifier, 'currentContentReleaseId' => $currentContentReleaseId ?: ContentReleaseManager::NO_PREVIOUS_RELEASE, - 'redisInstanceId' => $targetRedisInstanceIdentifier + 'redisInstanceId' => $targetRedisInstanceIdentifier, ]); $this->redirect('index', null, null, ['contentStore' => $targetRedisInstanceIdentifier]); @@ -344,7 +344,7 @@ public function quickPublishPreviewAction(string $nodeIdentifiers, ?string $cont $this->addFlashMessage($exception->getMessage(), '', Message::SEVERITY_ERROR); $this->redirect('quickPublishForm', null, null, [ 'contentStore' => $contentStore, - 'nodeIdentifiers' => $nodeIdentifiers + 'nodeIdentifiers' => $nodeIdentifiers, ]); return null; @@ -369,14 +369,14 @@ public function quickPublishAction(string $nodeIdentifiers, ?string $contentStor try { $contentReleaseIdentifier = $this->contentReleaseManager->startQuickContentRelease(NodeIdentifiers::fromUserInput( - $nodeIdentifiers + $nodeIdentifiers, )); } catch (Exception $exception) { // both the identifier check and the manager phrase their messages for the person reading this page $this->addFlashMessage($exception->getMessage(), '', Message::SEVERITY_ERROR); $this->redirect('quickPublishForm', null, null, [ 'contentStore' => $contentStore, - 'nodeIdentifiers' => $nodeIdentifiers + 'nodeIdentifiers' => $nodeIdentifiers, ]); return null; @@ -399,7 +399,7 @@ private function translateById(string $labelId, array $arguments = []): string null, null, 'Main', - 'Flowpack.DecoupledContentStore' + 'Flowpack.DecoupledContentStore', ); } } diff --git a/Classes/Core/AutomaticReleaseSwitchService.php b/Classes/Core/AutomaticReleaseSwitchService.php index 697c057..d783589 100644 --- a/Classes/Core/AutomaticReleaseSwitchService.php +++ b/Classes/Core/AutomaticReleaseSwitchService.php @@ -69,7 +69,7 @@ public function pause(): void $this->redisClientManager->getPrimaryRedis()->hMset(self::REDIS_KEY, [ 'pausedAt' => (new DateTimeImmutable())->format(DateTimeInterface::ATOM), 'accountId' => $this->getAccountId() ?? '', - 'suppressedReleaseCount' => 0 + 'suppressedReleaseCount' => 0, ]); } @@ -83,7 +83,7 @@ public function countSuppressedRelease(): void $this->redisClientManager->getPrimaryRedis()->eval( self::COUNT_SUPPRESSED_RELEASE_LUA_SCRIPT, [self::REDIS_KEY], - 1 + 1, ); } diff --git a/Classes/Core/ConcurrentBuildLockService.php b/Classes/Core/ConcurrentBuildLockService.php index 7b86c90..3ba511a 100644 --- a/Classes/Core/ConcurrentBuildLockService.php +++ b/Classes/Core/ConcurrentBuildLockService.php @@ -50,7 +50,7 @@ public function ensureAllOtherInProgressContentReleasesWillBeTerminated(ContentR $this->redisClientManager->getPrimaryRedis()->hSet( self::CONTENT_STORE_CONCURRENT_BUILD_LOCK, $metadata->getWorkspaceName(), - (string) $contentReleaseIdentifier + (string) $contentReleaseIdentifier, ); } diff --git a/Classes/Core/Domain/ValueObject/AutomaticReleasePauseState.php b/Classes/Core/Domain/ValueObject/AutomaticReleasePauseState.php index 47a466c..fca6e2c 100644 --- a/Classes/Core/Domain/ValueObject/AutomaticReleasePauseState.php +++ b/Classes/Core/Domain/ValueObject/AutomaticReleasePauseState.php @@ -41,14 +41,14 @@ public static function fromRedisHash(array $redisHash): self if (!array_key_exists('pausedAt', $redisHash)) { throw new InvalidArgumentException( 'The automatic release pause state must contain a "pausedAt" field.', - 1786706446 + 1786706446, ); } return new self( new DateTimeImmutable($redisHash['pausedAt']), - ( $redisHash['accountId'] ?? '' ) !== '' ? $redisHash['accountId'] : null, - (int) ( $redisHash['suppressedReleaseCount'] ?? 0 ) + ($redisHash['accountId'] ?? '') !== '' ? $redisHash['accountId'] : null, + (int) ($redisHash['suppressedReleaseCount'] ?? 0), ); } diff --git a/Classes/Core/Infrastructure/ConsoleStatisticsEventOutput.php b/Classes/Core/Infrastructure/ConsoleStatisticsEventOutput.php index 02d336e..b081e4e 100644 --- a/Classes/Core/Infrastructure/ConsoleStatisticsEventOutput.php +++ b/Classes/Core/Infrastructure/ConsoleStatisticsEventOutput.php @@ -31,10 +31,10 @@ public function writeEvent( ContentReleaseIdentifier $contentReleaseIdentifier, string $prefix, string $event, - array $additionalPayload + array $additionalPayload, ): void { $this->output->writeln( - $prefix . 'STATISTICS EVENT ' . $event . ( $additionalPayload ? ' ' . json_encode($additionalPayload) : '' ) + $prefix . 'STATISTICS EVENT ' . $event . ($additionalPayload ? ' ' . json_encode($additionalPayload) : ''), ); } } diff --git a/Classes/Core/Infrastructure/ContentReleaseLogger.php b/Classes/Core/Infrastructure/ContentReleaseLogger.php index f1f9a66..c903ffe 100644 --- a/Classes/Core/Infrastructure/ContentReleaseLogger.php +++ b/Classes/Core/Infrastructure/ContentReleaseLogger.php @@ -34,7 +34,7 @@ protected function __construct( OutputInterface $output, ContentReleaseIdentifier $contentReleaseIdentifier, StatisticsEventOutputInterface $statisticsEventOutput, - ?RendererIdentifier $rendererIdentifier + ?RendererIdentifier $rendererIdentifier, ) { $this->output = $output; $this->contentReleaseIdentifier = $contentReleaseIdentifier; @@ -50,7 +50,7 @@ protected function __construct( public static function fromConsoleOutput( ConsoleOutput $output, ContentReleaseIdentifier $contentReleaseIdentifier, - StatisticsEventOutputInterface $statisticsEventOutput = new RedisStatisticsEventOutput() + StatisticsEventOutputInterface $statisticsEventOutput = new RedisStatisticsEventOutput(), ): self { return new static($output->getOutput(), $contentReleaseIdentifier, $statisticsEventOutput, null); } @@ -58,7 +58,7 @@ public static function fromConsoleOutput( public static function fromSymfonyOutput( OutputInterface $output, ContentReleaseIdentifier $contentReleaseIdentifier, - StatisticsEventOutputInterface $statisticsEventOutput = new RedisStatisticsEventOutput() + StatisticsEventOutputInterface $statisticsEventOutput = new RedisStatisticsEventOutput(), ): self { return new static($output, $contentReleaseIdentifier, $statisticsEventOutput, null); } @@ -100,7 +100,7 @@ public function logException(\Exception $exception, string $message, array $addi . "\n\n" . $exception->getTraceAsString() . "\n\n" - . json_encode($additionalPayload) + . json_encode($additionalPayload), ); } @@ -119,7 +119,7 @@ public function logStatisticsEvent(string $event, array $additionalPayload = []) $this->contentReleaseIdentifier, $this->logPrefix, $event, - $additionalPayload + $additionalPayload, ); } @@ -129,7 +129,7 @@ public function withRenderer(RendererIdentifier $rendererIdentifier): self $this->output, $this->contentReleaseIdentifier, $this->statisticsEventOutput, - $rendererIdentifier + $rendererIdentifier, ); } } diff --git a/Classes/Core/Infrastructure/RedisClientManager.php b/Classes/Core/Infrastructure/RedisClientManager.php index 3c7822b..b13327f 100644 --- a/Classes/Core/Infrastructure/RedisClientManager.php +++ b/Classes/Core/Infrastructure/RedisClientManager.php @@ -35,18 +35,18 @@ protected function connect(RedisInstanceIdentifier $redisInstanceIdentifier): \R $connected = $redis->connect( $instanceConfig['hostname'], - (int) ( $instanceConfig['port'] ?? 6379 ), - $instanceConfig['timeout'] ?? 0 + (int) ($instanceConfig['port'] ?? 6379), + $instanceConfig['timeout'] ?? 0, ) && $redis->select($instanceConfig['database'] ?? 0); } catch (\Exception $exception) { throw new Exception( sprintf( 'Could not connect to Redis server %s:%d. Detailed reason: see nested exception.', $instanceConfig['hostname'], - $instanceConfig['port'] + $instanceConfig['port'], ), 1630323312, - $exception + $exception, ); } if (!$connected) { @@ -54,9 +54,9 @@ protected function connect(RedisInstanceIdentifier $redisInstanceIdentifier): \R sprintf( 'Could not connect to Redis server %s:%d', $instanceConfig['hostname'], - $instanceConfig['port'] + $instanceConfig['port'], ), - 1467385687 + 1467385687, ); } @@ -99,7 +99,7 @@ public function getRetentionCount(RedisInstanceIdentifier $redisInstanceIdentifi if (!isset($this->configuration[$redisInstanceIdentifier->getIdentifier()]['contentReleaseRetentionCount'])) { throw new \RuntimeException( 'Did not find a configured contentReleaseRetentionCount for Redis ' - . $redisInstanceIdentifier->getIdentifier() + . $redisInstanceIdentifier->getIdentifier(), ); } return $this->configuration[$redisInstanceIdentifier->getIdentifier()]['contentReleaseRetentionCount']; diff --git a/Classes/Core/Infrastructure/RedisContentReleaseSizeService.php b/Classes/Core/Infrastructure/RedisContentReleaseSizeService.php index 216dcde..2479971 100644 --- a/Classes/Core/Infrastructure/RedisContentReleaseSizeService.php +++ b/Classes/Core/Infrastructure/RedisContentReleaseSizeService.php @@ -30,7 +30,7 @@ class RedisContentReleaseSizeService */ public function calculateReleaseSize( RedisInstanceIdentifier $redisInstanceIdentifier, - ContentReleaseIdentifier $contentReleaseIdentifier + ContentReleaseIdentifier $contentReleaseIdentifier, ): float { $redis = $this->redisClientManager->getRedis($redisInstanceIdentifier); $allKeys = $redis->keys('contentStore:' . $contentReleaseIdentifier->getIdentifier() . ':*'); diff --git a/Classes/Core/Infrastructure/RedisStatisticsEventOutput.php b/Classes/Core/Infrastructure/RedisStatisticsEventOutput.php index 7a0200d..8c5d2c1 100644 --- a/Classes/Core/Infrastructure/RedisStatisticsEventOutput.php +++ b/Classes/Core/Infrastructure/RedisStatisticsEventOutput.php @@ -16,7 +16,7 @@ public function writeEvent( ContentReleaseIdentifier $contentReleaseIdentifier, string $prefix, string $event, - array $additionalPayload + array $additionalPayload, ): void { $this->redisStatisticsEventService->addEvent($contentReleaseIdentifier, $prefix, $event, $additionalPayload); } diff --git a/Classes/Core/Infrastructure/RedisStatisticsEventService.php b/Classes/Core/Infrastructure/RedisStatisticsEventService.php index 0e8557b..b01527a 100644 --- a/Classes/Core/Infrastructure/RedisStatisticsEventService.php +++ b/Classes/Core/Infrastructure/RedisStatisticsEventService.php @@ -22,15 +22,15 @@ public function addEvent( ContentReleaseIdentifier $contentReleaseIdentifier, string $prefix, string $event, - array $additionalPayload + array $additionalPayload, ): void { $this->redisClientManager->getPrimaryRedis()->rPush( $this->redisKeyService->getRedisKeyForPostfix($contentReleaseIdentifier, 'statisticsEvents'), json_encode([ 'event' => $event, 'prefix' => $prefix, - 'additionalPayload' => $additionalPayload - ]) + 'additionalPayload' => $additionalPayload, + ]), ); } @@ -45,7 +45,7 @@ public function addEvent( public function countEvents( ContentReleaseIdentifier $contentReleaseIdentifier, array $where, - array $groupBy + array $groupBy, ): array { $redis = $this->redisClientManager->getPrimaryRedis(); $key = $this->redisKeyService->getRedisKeyForPostfix($contentReleaseIdentifier, 'statisticsEvents'); diff --git a/Classes/Core/Infrastructure/StatisticsEventOutputInterface.php b/Classes/Core/Infrastructure/StatisticsEventOutputInterface.php index 0a193d5..39c5706 100644 --- a/Classes/Core/Infrastructure/StatisticsEventOutputInterface.php +++ b/Classes/Core/Infrastructure/StatisticsEventOutputInterface.php @@ -12,6 +12,6 @@ public function writeEvent( ContentReleaseIdentifier $contentReleaseIdentifier, string $prefix, string $event, - array $additionalPayload + array $additionalPayload, ): void; } diff --git a/Classes/Eel/ModuleHelper.php b/Classes/Eel/ModuleHelper.php index 4d992f4..6a8fee9 100644 --- a/Classes/Eel/ModuleHelper.php +++ b/Classes/Eel/ModuleHelper.php @@ -64,11 +64,11 @@ static function (string $line, int $index) use ($lineCount) { $line = preg_replace( '/(DEBUG|WARNING|ERROR|INFO): (.*)/', '$1: $2', - htmlSpecialChars($line) + htmlSpecialChars($line), ); // Add line numbers. The lines are reversed (newest first), so the numbering counts down to 1. - $line = ( $lineCount - $index + 1 ) . ': ' . $line; + $line = ($lineCount - $index + 1) . ': ' . $line; // Insert formatted JSON data if ($jsonData) { @@ -88,7 +88,7 @@ static function (string $line, int $index) use ($lineCount) { return '
' . $line . '
'; }, $lines, - range(1, $lineCount) + range(1, $lineCount), ); return implode("\n", $formattedLines); diff --git a/Classes/Exception.php b/Classes/Exception.php index d0b588f..a8ab4b4 100644 --- a/Classes/Exception.php +++ b/Classes/Exception.php @@ -4,6 +4,4 @@ namespace Flowpack\DecoupledContentStore; -class Exception extends \Neos\Flow\Exception -{ -} +class Exception extends \Neos\Flow\Exception {} diff --git a/Classes/Exception/InvalidReleaseException.php b/Classes/Exception/InvalidReleaseException.php index 4428d6f..2ff6478 100644 --- a/Classes/Exception/InvalidReleaseException.php +++ b/Classes/Exception/InvalidReleaseException.php @@ -6,6 +6,4 @@ use Flowpack\DecoupledContentStore\Exception; -class InvalidReleaseException extends Exception -{ -} +class InvalidReleaseException extends Exception {} diff --git a/Classes/Exception/InvalidSiteConfigurationException.php b/Classes/Exception/InvalidSiteConfigurationException.php index 498826e..9c070fe 100644 --- a/Classes/Exception/InvalidSiteConfigurationException.php +++ b/Classes/Exception/InvalidSiteConfigurationException.php @@ -6,6 +6,4 @@ use Flowpack\DecoupledContentStore\Exception; -class InvalidSiteConfigurationException extends Exception -{ -} +class InvalidSiteConfigurationException extends Exception {} diff --git a/Classes/Exception/InvalidTransferConfigException.php b/Classes/Exception/InvalidTransferConfigException.php index 478d3dd..6e08e2e 100644 --- a/Classes/Exception/InvalidTransferConfigException.php +++ b/Classes/Exception/InvalidTransferConfigException.php @@ -6,6 +6,4 @@ use Flowpack\DecoupledContentStore\Exception; -class InvalidTransferConfigException extends Exception -{ -} +class InvalidTransferConfigException extends Exception {} diff --git a/Classes/Exception/NodeNotFoundException.php b/Classes/Exception/NodeNotFoundException.php index 29a9247..90f390c 100644 --- a/Classes/Exception/NodeNotFoundException.php +++ b/Classes/Exception/NodeNotFoundException.php @@ -6,6 +6,4 @@ use Flowpack\DecoupledContentStore\Exception; -class NodeNotFoundException extends Exception -{ -} +class NodeNotFoundException extends Exception {} diff --git a/Classes/Exception/QuickContentReleaseNotPossibleException.php b/Classes/Exception/QuickContentReleaseNotPossibleException.php index fce4571..4de30e7 100644 --- a/Classes/Exception/QuickContentReleaseNotPossibleException.php +++ b/Classes/Exception/QuickContentReleaseNotPossibleException.php @@ -9,6 +9,4 @@ /** * The message of this exception is written for an editor: it is shown as-is when a quick release cannot be scheduled. */ -class QuickContentReleaseNotPossibleException extends Exception -{ -} +class QuickContentReleaseNotPossibleException extends Exception {} diff --git a/Classes/Exception/RenderingException.php b/Classes/Exception/RenderingException.php index 3a7d300..a6f2536 100644 --- a/Classes/Exception/RenderingException.php +++ b/Classes/Exception/RenderingException.php @@ -23,7 +23,7 @@ public function __construct( NodeInterface $node, $nodeUri, int $code = 0, - ?Exception $previous = null + ?Exception $previous = null, ) { $this->nodeUri = $nodeUri; parent::__construct($message, $code, $previous); diff --git a/Classes/NodeEnumeration/Domain/Dto/EnumeratedNode.php b/Classes/NodeEnumeration/Domain/Dto/EnumeratedNode.php index 0ebe484..52c723a 100644 --- a/Classes/NodeEnumeration/Domain/Dto/EnumeratedNode.php +++ b/Classes/NodeEnumeration/Domain/Dto/EnumeratedNode.php @@ -53,7 +53,7 @@ private function __construct( string $nodeIdentifier, string $nodeTypeName, array $arguments, - string $rendererId = '' + string $rendererId = '', ) { $this->contextPath = $contextPath; $this->nodeIdentifier = $nodeIdentifier; @@ -69,7 +69,7 @@ public static function fromNode(NodeInterface $node, array $arguments = []): sel $node->getIdentifier(), $node->getNodeType()->getName(), $arguments, - '' + '', ); } @@ -84,7 +84,7 @@ public static function fromJsonString(string $enumeratedNodeString): self $tmp['nodeIdentifier'], $tmp['nodeTypeName'] ?? '', $tmp['arguments'], - $tmp['rendererId'] + $tmp['rendererId'], ); } @@ -95,7 +95,7 @@ public function jsonSerialize(): array 'nodeIdentifier' => $this->nodeIdentifier, 'nodeTypeName' => $this->nodeTypeName, 'arguments' => $this->arguments, - 'rendererId' => $this->rendererId + 'rendererId' => $this->rendererId, ]; } @@ -106,7 +106,7 @@ public function getSiteNodeNameFromContextPath(): string } else { throw new \Exception( 'Could not get site node name from context path "' . $this->contextPath . '"', - 1495535171 + 1495535171, ); } } @@ -146,7 +146,7 @@ public function debugString(): string $this->nodeIdentifier, $this->arguments ? http_build_query($this->arguments) . ' ' : '', $this->contextPath, - $this->rendererId + $this->rendererId, ); } diff --git a/Classes/NodeEnumeration/Domain/Repository/RedisEnumerationRepository.php b/Classes/NodeEnumeration/Domain/Repository/RedisEnumerationRepository.php index 2addd4c..8ea0c3a 100644 --- a/Classes/NodeEnumeration/Domain/Repository/RedisEnumerationRepository.php +++ b/Classes/NodeEnumeration/Domain/Repository/RedisEnumerationRepository.php @@ -34,20 +34,20 @@ public function clearDocumentNodesEnumeration(ContentReleaseIdentifier $releaseI { $this->redisClientManager->getPrimaryRedis()->del($this->redisKeyService->getRedisKeyForPostfix( $releaseIdentifier, - 'enumeration:documentNodes' + 'enumeration:documentNodes', )); } public function addDocumentNodesToEnumeration( ContentReleaseIdentifier $releaseIdentifier, - EnumeratedNode ...$enumeration + EnumeratedNode ...$enumeration, ) { $convertedEnumeration = array_map(function (EnumeratedNode $node) { return json_encode($node); }, $enumeration); $this->redisClientManager->getPrimaryRedis()->rPush( $this->redisKeyService->getRedisKeyForPostfix($releaseIdentifier, 'enumeration:documentNodes'), - ...$convertedEnumeration + ...$convertedEnumeration, ); } @@ -59,7 +59,7 @@ public function findAll(ContentReleaseIdentifier $releaseIdentifier): iterable foreach ($this->redisClientManager->getPrimaryRedis()->lRange( $this->redisKeyService->getRedisKeyForPostfix($releaseIdentifier, 'enumeration:documentNodes'), 0, - -1 + -1, ) as $enumeratedNodeString) { yield EnumeratedNode::fromJsonString($enumeratedNodeString); } @@ -70,7 +70,7 @@ public function count(ContentReleaseIdentifier $releaseIdentifier): int $redis = $this->redisClientManager->getPrimaryRedis(); $res = $redis->lLen($this->redisKeyService->getRedisKeyForPostfix( $releaseIdentifier, - 'enumeration:documentNodes' + 'enumeration:documentNodes', )); if (is_int($res)) { return $res; @@ -80,7 +80,7 @@ public function count(ContentReleaseIdentifier $releaseIdentifier): int public function countMultiple( RedisInstanceIdentifier $redisInstanceIdentifier, - ContentReleaseIdentifier ...$releaseIdentifiers + ContentReleaseIdentifier ...$releaseIdentifiers, ): ContentReleaseBatchResult { $result = []; // KEY == contentReleaseIdentifier. VALUE == enumerated count $redis = $this->redisClientManager->getRedis($redisInstanceIdentifier); @@ -89,7 +89,7 @@ public function countMultiple( foreach ($batchedReleaseIdentifiers as $releaseIdentifier) { $redisPipeline->lLen($this->redisKeyService->getRedisKeyForPostfix( $releaseIdentifier, - 'enumeration:documentNodes' + 'enumeration:documentNodes', )); } $res = $redisPipeline->exec(); diff --git a/Classes/NodeEnumeration/Domain/Service/NodeContextCombinator.php b/Classes/NodeEnumeration/Domain/Service/NodeContextCombinator.php index 4fdfb41..567d429 100644 --- a/Classes/NodeEnumeration/Domain/Service/NodeContextCombinator.php +++ b/Classes/NodeEnumeration/Domain/Service/NodeContextCombinator.php @@ -63,7 +63,7 @@ public function nodeInContexts(string $nodeIdentifier, Site $site, string $works if (!$nodeFound) { throw new NodeNotFoundException( 'Could not find node by identifier ' . $nodeIdentifier . ' in any context', - 1467285561 + 1467285561, ); } } @@ -121,7 +121,7 @@ private static function isWithinSiteNode(NodeInterface $node, NodeInterface $sit $nodePath = $node->findNodePath(); $siteNodePath = $siteNode->findNodePath(); - return $nodePath->equals($siteNodePath) || str_starts_with((string)$nodePath, $siteNodePath . '/'); + return $nodePath->equals($siteNodePath) || str_starts_with((string) $nodePath, $siteNodePath . '/'); } /** @@ -147,9 +147,8 @@ public function sites(): Generator public function siteNodeInContexts( Site $site, string $workspaceName = 'live', - ?bool $invisibleContentShown = null - ): Generator - { + ?bool $invisibleContentShown = null, + ): Generator { $allowedContextCombinations = $this->contentDimensionCombinator->getAllAllowedCombinations(); foreach ($allowedContextCombinations as $dimensionContextCombination) { @@ -158,7 +157,7 @@ public function siteNodeInContexts( 'workspaceName' => $workspaceName, 'dimensions' => $dimensionContextCombination, 'targetDimensions' => [], - 'invisibleContentShown' => $invisibleContentShown ?? $this->recurseHiddenContent + 'invisibleContentShown' => $invisibleContentShown ?? $this->recurseHiddenContent, )); $siteNode = $contentContext->getNode('/sites/' . $site->getNodeName()); diff --git a/Classes/NodeEnumeration/NodeEnumerator.php b/Classes/NodeEnumeration/NodeEnumerator.php index d34f610..ea5a0e0 100644 --- a/Classes/NodeEnumeration/NodeEnumerator.php +++ b/Classes/NodeEnumeration/NodeEnumerator.php @@ -54,10 +54,10 @@ class NodeEnumerator public function enumerateAndStoreInRedis( ?Site $site, ContentReleaseLogger $contentReleaseLogger, - ContentReleaseIdentifier $releaseIdentifier + ContentReleaseIdentifier $releaseIdentifier, ): void { $contentReleaseLogger->info('Starting content release', [ - 'contentReleaseIdentifier' => $releaseIdentifier->jsonSerialize() + 'contentReleaseIdentifier' => $releaseIdentifier->jsonSerialize(), ]); // set content release status to running @@ -66,13 +66,13 @@ public function enumerateAndStoreInRedis( $this->redisContentReleaseService->setContentReleaseMetadata( $releaseIdentifier, $newMetadata, - RedisInstanceIdentifier::primary() + RedisInstanceIdentifier::primary(), ); $this->redisEnumerationRepository->clearDocumentNodesEnumeration($releaseIdentifier); foreach (GeneratorUtility::createArrayBatch( $this->enumerateAll($site, $contentReleaseLogger, $newMetadata->getWorkspaceName()), - 100 + 100, ) as $enumeration) { $this->concurrentBuildLockService->assertNoOtherContentReleaseWasStarted($releaseIdentifier); // $enumeration is an array of EnumeratedNode, with at most 100 elements in it. @@ -98,7 +98,7 @@ public function enumerateAndStoreInRedis( public function emitNodesEnumerated( array $enumeration, ContentReleaseIdentifier $releaseIdentifier, - ContentReleaseLogger $contentReleaseLogger + ContentReleaseLogger $contentReleaseLogger, ): void { foreach ($enumeration as $enumeratedNode) { $this->emitNodeEnumerated($enumeratedNode, $releaseIdentifier, $contentReleaseLogger); @@ -112,7 +112,7 @@ public function emitNodesEnumerated( private function enumerateAll( ?Site $site, ContentReleaseLogger $contentReleaseLogger, - string $workspaceName + string $workspaceName, ): iterable { $combinator = new NodeContextCombinator(); @@ -121,7 +121,7 @@ private function enumerateAll( $queueSite = function (Site $site) use ($combinator, $nodeTypeFilter, $contentReleaseLogger, $workspaceName) { $contentReleaseLogger->debug('Publishing site', [ 'name' => $site->getName(), - 'domain' => $site->getFirstActiveDomain() + 'domain' => $site->getFirstActiveDomain(), ]); foreach ($combinator->siteNodeInContexts($site, $workspaceName) as $siteNode) { @@ -129,7 +129,7 @@ private function enumerateAll( $dimensionValues = $siteNode->getContext()->getDimensions(); $contentReleaseLogger->debug('Publishing dimension combination', [ - 'dimensionValues' => $dimensionValues + 'dimensionValues' => $dimensionValues, ]); $nodeQuery = new FlowQuery([$siteNode]); @@ -142,17 +142,17 @@ private function enumerateAll( $skipReason = $this->documentNodeFilter->skipReason($nodeToEnumerate, $siteNode); if ($skipReason !== null) { $contentReleaseLogger->debug('Skipping node from publishing, because it is ' . $skipReason, [ - 'node' => $contextPath + 'node' => $contextPath, ]); continue; } $contentReleaseLogger->debug('Registering node for publishing', [ - 'node' => $contextPath + 'node' => $contextPath, ]); foreach ($this->nodeRenderingExtensionManager->enumerateDocumentNode( - $nodeToEnumerate + $nodeToEnumerate, ) as $enumeratedNode) { yield $enumeratedNode; } @@ -161,7 +161,7 @@ private function enumerateAll( $contentReleaseLogger->debug(sprintf( 'Finished enumerating site %s in %dms', $site->getName(), - ( microtime(true) - $startTime ) * 1000 + (microtime(true) - $startTime) * 1000, )); }; @@ -190,7 +190,6 @@ private function enumerateAll( protected function emitNodeEnumerated( EnumeratedNode $enumeratedNode, ContentReleaseIdentifier $releaseIdentifier, - ContentReleaseLogger $contentReleaseLogger - ) { - } + ContentReleaseLogger $contentReleaseLogger, + ) {} } diff --git a/Classes/NodeRendering/Dto/DocumentNodeCacheKey.php b/Classes/NodeRendering/Dto/DocumentNodeCacheKey.php index c5dfad2..d32f723 100644 --- a/Classes/NodeRendering/Dto/DocumentNodeCacheKey.php +++ b/Classes/NodeRendering/Dto/DocumentNodeCacheKey.php @@ -53,7 +53,7 @@ public static function fromNodeAndArguments(NodeInterface $node, array $argument $node->getIdentifier(), $node->getContext()->getDimensions(), $node->getWorkspace()->getName(), - $arguments + $arguments, ); } @@ -63,7 +63,7 @@ public static function fromEnumeratedNode(EnumeratedNode $enumeratedNode) $enumeratedNode->getNodeIdentifier(), $enumeratedNode->getDimensionsFromContextPath(), $enumeratedNode->getWorkspaceNameFromContextPath(), - $enumeratedNode->getArguments() + $enumeratedNode->getArguments(), ); } @@ -77,8 +77,8 @@ public function redisKeyName(): string 'doc--%s-%s-%s', $this->nodeIdentifier, json_encode($this->dimensions), - json_encode($this->arguments) - ) + json_encode($this->arguments), + ), ); } diff --git a/Classes/NodeRendering/Dto/RenderedDocumentFromContentCache.php b/Classes/NodeRendering/Dto/RenderedDocumentFromContentCache.php index 5d68ca2..b20b8c7 100644 --- a/Classes/NodeRendering/Dto/RenderedDocumentFromContentCache.php +++ b/Classes/NodeRendering/Dto/RenderedDocumentFromContentCache.php @@ -35,7 +35,7 @@ private function __construct( string $fullContent, DocumentNodeCacheValues $documentNodeCacheValues, bool $isComplete, - string $incompleteReason + string $incompleteReason, ) { $this->fullContent = $fullContent; $this->documentNodeCacheValues = $documentNodeCacheValues; @@ -50,7 +50,7 @@ public static function createIncomplete(string $reason): self public static function createWithFullContent( string $fullContent, - DocumentNodeCacheValues $documentNodeCacheValues + DocumentNodeCacheValues $documentNodeCacheValues, ): self { return new self($fullContent, $documentNodeCacheValues, true, ''); } diff --git a/Classes/NodeRendering/Dto/RenderingStatistics.php b/Classes/NodeRendering/Dto/RenderingStatistics.php index 447c08c..f3f850d 100644 --- a/Classes/NodeRendering/Dto/RenderingStatistics.php +++ b/Classes/NodeRendering/Dto/RenderingStatistics.php @@ -92,7 +92,7 @@ public function jsonSerialize(): array 'remainingJobs' => $this->remainingJobs, 'totalJobs' => $this->totalJobs, 'renderingsPerSecond' => $this->renderingsPerSecond, - 'svgSparkline' => $this->svgSparkline + 'svgSparkline' => $this->svgSparkline, ]; } } diff --git a/Classes/NodeRendering/Extensibility/ContentReleaseWriterInterface.php b/Classes/NodeRendering/Extensibility/ContentReleaseWriterInterface.php index d7bb74e..004f28b 100644 --- a/Classes/NodeRendering/Extensibility/ContentReleaseWriterInterface.php +++ b/Classes/NodeRendering/Extensibility/ContentReleaseWriterInterface.php @@ -26,6 +26,6 @@ interface ContentReleaseWriterInterface public function processRenderedDocument( ContentReleaseIdentifier $contentReleaseIdentifier, RenderedDocumentFromContentCache $renderedDocumentFromContentCache, - ContentReleaseLogger $logger + ContentReleaseLogger $logger, ): void; } diff --git a/Classes/NodeRendering/Extensibility/ContentReleaseWriters/GzipWriter.php b/Classes/NodeRendering/Extensibility/ContentReleaseWriters/GzipWriter.php index 28b020a..adf9ffc 100644 --- a/Classes/NodeRendering/Extensibility/ContentReleaseWriters/GzipWriter.php +++ b/Classes/NodeRendering/Extensibility/ContentReleaseWriters/GzipWriter.php @@ -4,13 +4,13 @@ namespace Flowpack\DecoupledContentStore\NodeRendering\Extensibility\ContentReleaseWriters; -use Flowpack\DecoupledContentStore\Core\RedisKeyService; -use Neos\Flow\Annotations as Flow; use Flowpack\DecoupledContentStore\Core\Domain\ValueObject\ContentReleaseIdentifier; use Flowpack\DecoupledContentStore\Core\Infrastructure\ContentReleaseLogger; use Flowpack\DecoupledContentStore\Core\Infrastructure\RedisClientManager; +use Flowpack\DecoupledContentStore\Core\RedisKeyService; use Flowpack\DecoupledContentStore\NodeRendering\Dto\RenderedDocumentFromContentCache; use Flowpack\DecoupledContentStore\NodeRendering\Extensibility\ContentReleaseWriterInterface; +use Neos\Flow\Annotations as Flow; /** * Takes the fully rendered document and writes it to the content release. @@ -34,14 +34,14 @@ class GzipWriter implements ContentReleaseWriterInterface public function processRenderedDocument( ContentReleaseIdentifier $contentReleaseIdentifier, RenderedDocumentFromContentCache $renderedDocumentFromContentCache, - ContentReleaseLogger $logger + ContentReleaseLogger $logger, ): void { $compressedContent = gzencode($renderedDocumentFromContentCache->getFullContent(), 9); $redis = $this->redisClientManager->getPrimaryRedis(); $redis->hSet( $this->redisKeyService->getRedisKeyForPostfix($contentReleaseIdentifier, 'renderedDocuments'), $renderedDocumentFromContentCache->getUrl(), - $compressedContent + $compressedContent, ); // Published URLs, lexicographically sorted @@ -50,7 +50,7 @@ public function processRenderedDocument( $redis->zAdd( $this->redisKeyService->getRedisKeyForPostfix($contentReleaseIdentifier, 'meta:urls'), 0, - $renderedDocumentFromContentCache->getUrl() + $renderedDocumentFromContentCache->getUrl(), ); } } diff --git a/Classes/NodeRendering/Extensibility/ContentReleaseWriters/LegacyWriter.php b/Classes/NodeRendering/Extensibility/ContentReleaseWriters/LegacyWriter.php index c0e9eff..3d034f2 100644 --- a/Classes/NodeRendering/Extensibility/ContentReleaseWriters/LegacyWriter.php +++ b/Classes/NodeRendering/Extensibility/ContentReleaseWriters/LegacyWriter.php @@ -4,13 +4,13 @@ namespace Flowpack\DecoupledContentStore\NodeRendering\Extensibility\ContentReleaseWriters; -use Flowpack\DecoupledContentStore\Core\RedisKeyService; -use Neos\Flow\Annotations as Flow; use Flowpack\DecoupledContentStore\Core\Domain\ValueObject\ContentReleaseIdentifier; use Flowpack\DecoupledContentStore\Core\Infrastructure\ContentReleaseLogger; use Flowpack\DecoupledContentStore\Core\Infrastructure\RedisClientManager; +use Flowpack\DecoupledContentStore\Core\RedisKeyService; use Flowpack\DecoupledContentStore\NodeRendering\Dto\RenderedDocumentFromContentCache; use Flowpack\DecoupledContentStore\NodeRendering\Extensibility\ContentReleaseWriterInterface; +use Neos\Flow\Annotations as Flow; use Ramsey\Uuid\Uuid; /** @@ -41,7 +41,7 @@ class LegacyWriter implements ContentReleaseWriterInterface public function processRenderedDocument( ContentReleaseIdentifier $contentReleaseIdentifier, RenderedDocumentFromContentCache $renderedDocumentFromContentCache, - ContentReleaseLogger $logger + ContentReleaseLogger $logger, ): void { $urlKey = $renderedDocumentFromContentCache->getLegacyUrlKey(); $metadataUrlKey = $renderedDocumentFromContentCache->getLegacyMetadataKey(); @@ -65,7 +65,7 @@ public function processRenderedDocument( $redis->zAdd( $this->redisKeyService->getRedisKeyForPostfix($contentReleaseIdentifier, 'meta:urls'), 0, - $renderedDocumentFromContentCache->getUrl() + $renderedDocumentFromContentCache->getUrl(), ); } } diff --git a/Classes/NodeRendering/Extensibility/DocumentEnumerators/DefaultEnumerator.php b/Classes/NodeRendering/Extensibility/DocumentEnumerators/DefaultEnumerator.php index eefd8e8..843f461 100644 --- a/Classes/NodeRendering/Extensibility/DocumentEnumerators/DefaultEnumerator.php +++ b/Classes/NodeRendering/Extensibility/DocumentEnumerators/DefaultEnumerator.php @@ -10,14 +10,12 @@ class DefaultEnumerator implements DocumentEnumeratorInterface { - public function __construct(array $options = []) - { - } + public function __construct(array $options = []) {} public function enumerateDocumentNode(NodeInterface $documentNode): iterable { return [ - EnumeratedNode::fromNode($documentNode) + EnumeratedNode::fromNode($documentNode), ]; } } diff --git a/Classes/NodeRendering/Extensibility/DocumentEnumerators/LimitEnumerator.php b/Classes/NodeRendering/Extensibility/DocumentEnumerators/LimitEnumerator.php index 4b08469..4f67b52 100644 --- a/Classes/NodeRendering/Extensibility/DocumentEnumerators/LimitEnumerator.php +++ b/Classes/NodeRendering/Extensibility/DocumentEnumerators/LimitEnumerator.php @@ -20,7 +20,7 @@ class LimitEnumerator implements DocumentEnumeratorInterface private ?string $nodePathSegmentFilter = null; public function __construct( - array $options = [] + array $options = [], ) { $this->limit = $options['limit'] ?? null; $this->uriPathSegmentFilter = $options['uriPathSegmentFilter'] ?? null; @@ -52,7 +52,7 @@ public function enumerateDocumentNode(NodeInterface $documentNode): iterable } return [ - EnumeratedNode::fromNode($documentNode) + EnumeratedNode::fromNode($documentNode), ]; } } diff --git a/Classes/NodeRendering/Extensibility/DocumentMetadataGeneratorInterface.php b/Classes/NodeRendering/Extensibility/DocumentMetadataGeneratorInterface.php index c692b43..9101054 100644 --- a/Classes/NodeRendering/Extensibility/DocumentMetadataGeneratorInterface.php +++ b/Classes/NodeRendering/Extensibility/DocumentMetadataGeneratorInterface.php @@ -23,6 +23,6 @@ public function generateMetadata( NodeInterface $node, array $arguments, ControllerContext $controllerContext, - DocumentNodeCacheValues $cacheValues + DocumentNodeCacheValues $cacheValues, ): DocumentNodeCacheValues; } diff --git a/Classes/NodeRendering/Extensibility/DocumentRendererInterface.php b/Classes/NodeRendering/Extensibility/DocumentRendererInterface.php index e81a974..ef62710 100644 --- a/Classes/NodeRendering/Extensibility/DocumentRendererInterface.php +++ b/Classes/NodeRendering/Extensibility/DocumentRendererInterface.php @@ -25,6 +25,6 @@ public function tryToExtractRenderingForEnumeratedNodeFromContentCache(Enumerate public function renderDocumentNodeVariant( NodeInterface $node, EnumeratedNode $enumeratedNode, - ContentReleaseLogger $contentReleaseLogger + ContentReleaseLogger $contentReleaseLogger, ): void; } diff --git a/Classes/NodeRendering/Extensibility/DocumentRenderers/FusionHtmlRenderer.php b/Classes/NodeRendering/Extensibility/DocumentRenderers/FusionHtmlRenderer.php index fc16583..ccf2227 100644 --- a/Classes/NodeRendering/Extensibility/DocumentRenderers/FusionHtmlRenderer.php +++ b/Classes/NodeRendering/Extensibility/DocumentRenderers/FusionHtmlRenderer.php @@ -31,19 +31,19 @@ class FusionHtmlRenderer implements DocumentRendererInterface public function tryToExtractRenderingForEnumeratedNodeFromContentCache(EnumeratedNode $enumeratedNode): RenderedDocumentFromContentCache { return $this->redisContentCacheReader->tryToExtractRenderingForEnumeratedNodeFromContentCache(DocumentNodeCacheKey::fromEnumeratedNode( - $enumeratedNode + $enumeratedNode, )); } public function renderDocumentNodeVariant( NodeInterface $node, EnumeratedNode $enumeratedNode, - ContentReleaseLogger $contentReleaseLogger + ContentReleaseLogger $contentReleaseLogger, ): void { $this->documentRenderer->renderDocumentNodeVariant( $node, $enumeratedNode->getArguments(), - $contentReleaseLogger + $contentReleaseLogger, ); } } diff --git a/Classes/NodeRendering/Extensibility/NodeRenderingExtensionManager.php b/Classes/NodeRendering/Extensibility/NodeRenderingExtensionManager.php index e5043d6..aa7c28f 100644 --- a/Classes/NodeRendering/Extensibility/NodeRenderingExtensionManager.php +++ b/Classes/NodeRendering/Extensibility/NodeRenderingExtensionManager.php @@ -65,7 +65,7 @@ public function enumerateDocumentNode(NodeInterface $documentNode): iterable DocumentEnumeratorInterface::class, 'enumeratorClassName', 'enumeratorOptions', - true + true, ); } foreach ($this->documentEnumerators as $rendererId => $documentEnumerator) { @@ -80,14 +80,14 @@ public function enumerateDocumentNode(NodeInterface $documentNode): iterable public function tryToExtractRenderingForEnumeratedNodeFromContentCache(EnumeratedNode $enumeratedNode): RenderedDocumentFromContentCache { return $this->rendererFor($enumeratedNode)->tryToExtractRenderingForEnumeratedNodeFromContentCache( - $enumeratedNode + $enumeratedNode, ); } public function renderDocumentNodeVariant( NodeInterface $node, EnumeratedNode $enumeratedNode, - ContentReleaseLogger $contentReleaseLogger + ContentReleaseLogger $contentReleaseLogger, ): void { $this->rendererFor($enumeratedNode)->renderDocumentNodeVariant($node, $enumeratedNode, $contentReleaseLogger); } @@ -99,12 +99,12 @@ protected function rendererFor(EnumeratedNode $enumeratedNode): DocumentRenderer $this->configuredDocumentRenderers, DocumentRendererInterface::class, 'rendererClassName', - preserveKey: true + preserveKey: true, ); } if (!array_key_exists($enumeratedNode->rendererId, $this->documentRenderers)) { throw new \RuntimeException( - 'No renderer found for renderer ID ' . $enumeratedNode->rendererId . ' - should never happen!' + 'No renderer found for renderer ID ' . $enumeratedNode->rendererId . ' - should never happen!', ); } return $this->documentRenderers[$enumeratedNode->rendererId]; @@ -123,12 +123,12 @@ public function runDocumentMetadataGenerators( NodeInterface $node, array $arguments, ControllerContext $controllerContext, - DocumentNodeCacheValues $cacheValues + DocumentNodeCacheValues $cacheValues, ): DocumentNodeCacheValues { if (!isset($this->documentMetadataGenerators)) { $this->documentMetadataGenerators = self::instantiateExtensions( $this->configuredDocumentMetadataGenerators, - DocumentMetadataGeneratorInterface::class + DocumentMetadataGeneratorInterface::class, ); } foreach ($this->documentMetadataGenerators as $documentMetadataGenerator) { @@ -137,7 +137,7 @@ public function runDocumentMetadataGenerators( $node, $arguments, $controllerContext, - $cacheValues + $cacheValues, ); } return $cacheValues; @@ -153,13 +153,13 @@ public function addRenderedDocumentToContentRelease( ContentReleaseIdentifier $contentReleaseIdentifier, EnumeratedNode $enumeratedNode, RenderedDocumentFromContentCache $renderedDocumentFromContentCache, - ContentReleaseLogger $logger + ContentReleaseLogger $logger, ): void { if (!isset($this->contentReleaseWriters[$enumeratedNode->rendererId])) { $this->contentReleaseWriters[$enumeratedNode->rendererId] = self::instantiateExtensions( $this->configuredDocumentRenderers[$enumeratedNode->rendererId]['contentReleaseWriters'], ContentReleaseWriterInterface::class, - optionsKey: 'options' + optionsKey: 'options', ); } foreach ($this->contentReleaseWriters[$enumeratedNode->rendererId] as $contentReleaseWriter) { @@ -167,7 +167,7 @@ public function addRenderedDocumentToContentRelease( $contentReleaseWriter->processRenderedDocument( $contentReleaseIdentifier, $renderedDocumentFromContentCache, - $logger + $logger, ); } } @@ -177,7 +177,7 @@ private static function instantiateExtensions( string $extensionInterfaceName, string $classNameKey = 'className', ?string $optionsKey = null, - bool $preserveKey = false + bool $preserveKey = false, ): array { $instantiatedExtensions = []; foreach ($configuration as $k => $extensionConfig) { @@ -192,7 +192,7 @@ private static function instantiateExtensions( } if (!$instance instanceof $extensionInterfaceName) { throw new \RuntimeException( - 'Extension ' . get_class($instance) . ' does not implement ' . $extensionInterfaceName + 'Extension ' . get_class($instance) . ' does not implement ' . $extensionInterfaceName, ); } diff --git a/Classes/NodeRendering/Infrastructure/RedisContentCacheReader.php b/Classes/NodeRendering/Infrastructure/RedisContentCacheReader.php index a57881f..ae36022 100644 --- a/Classes/NodeRendering/Infrastructure/RedisContentCacheReader.php +++ b/Classes/NodeRendering/Infrastructure/RedisContentCacheReader.php @@ -54,7 +54,7 @@ public function tryToExtractRenderingForEnumeratedNodeFromContentCache(DocumentN $serializedCacheValues = $redis->get($documentNodeCacheKey->fullyQualifiedRedisKeyName($identifierPrefix)); if ($serializedCacheValues === false) { return RenderedDocumentFromContentCache::createIncomplete( - 'No Redis Key "' . $documentNodeCacheKey->redisKeyName() . '" found.' + 'No Redis Key "' . $documentNodeCacheKey->redisKeyName() . '" found.', ); } $documentNodeCacheValues = DocumentNodeCacheValues::fromJsonString($serializedCacheValues); @@ -180,7 +180,7 @@ protected function getRedis(): \Redis $packageManager = $this->objectManager->get(PackageManager::class); $flowPackage = $packageManager->getPackage('Neos.Flow'); preg_match('/^(\d+\.\d+)/', $flowPackage->getInstalledVersion(), $versionMatches); - $flowMajorVersion = (int) ( $versionMatches[1] ?? '0' ); + $flowMajorVersion = (int) ($versionMatches[1] ?? '0'); $backend = $this->contentCache->getBackend(); @@ -194,7 +194,7 @@ protected function getRedis(): \Redis if (get_class($backend) === 'Sandstorm\OptimizedRedisCacheBackend\OptimizedRedisCacheBackend') { $reflProp = new \ReflectionProperty( \Sandstorm\OptimizedRedisCacheBackend\OptimizedRedisCacheBackend::class, - 'redis' + 'redis', ); $reflProp->setAccessible(true); $this->redis = $reflProp->getValue($backend); @@ -204,7 +204,7 @@ protected function getRedis(): \Redis throw new \RuntimeException( 'The cache backend for "Neos_Fusion_Content" must be an OptimizedRedisCacheBackend, but is ' . get_class($backend), - 1622570000 + 1622570000, ); } } diff --git a/Classes/NodeRendering/Infrastructure/RedisRenderingErrorManager.php b/Classes/NodeRendering/Infrastructure/RedisRenderingErrorManager.php index 0c1c9de..05b9695 100644 --- a/Classes/NodeRendering/Infrastructure/RedisRenderingErrorManager.php +++ b/Classes/NodeRendering/Infrastructure/RedisRenderingErrorManager.php @@ -32,17 +32,17 @@ class RedisRenderingErrorManager public function registerRenderingError( ContentReleaseIdentifier $contentReleaseIdentifier, array $additionalData, - \Exception $exception + \Exception $exception, ): void { $this->redisClientManager->getPrimaryRedis()->sAdd( $this->redisKeyService->getRedisKeyForPostfix($contentReleaseIdentifier, 'renderingErrors'), - $exception->getMessage() . ' - ' . json_encode($additionalData) + $exception->getMessage() . ' - ' . json_encode($additionalData), ); } public function getRenderingErrors( ContentReleaseIdentifier $contentReleaseIdentifier, - ?RedisInstanceIdentifier $redisInstanceIdentifier = null + ?RedisInstanceIdentifier $redisInstanceIdentifier = null, ): array { $redisInstanceIdentifier = $redisInstanceIdentifier ?: RedisInstanceIdentifier::primary(); return $this->redisClientManager @@ -54,13 +54,13 @@ public function flush(ContentReleaseIdentifier $contentReleaseIdentifier): void { $this->redisClientManager->getPrimaryRedis()->del($this->redisKeyService->getRedisKeyForPostfix( $contentReleaseIdentifier, - 'renderingErrors' + 'renderingErrors', )); } public function countMultipleErrors( RedisInstanceIdentifier $redisInstanceIdentifier, - ContentReleaseIdentifier ...$releaseIdentifiers + ContentReleaseIdentifier ...$releaseIdentifiers, ): ContentReleaseBatchResult { $result = []; // KEY == contentReleaseIdentifier. VALUE == count of error entries $redis = $this->redisClientManager->getRedis($redisInstanceIdentifier); @@ -69,7 +69,7 @@ public function countMultipleErrors( foreach ($batchedReleaseIdentifiers as $releaseIdentifier) { $redisPipeline->scard($this->redisKeyService->getRedisKeyForPostfix( $releaseIdentifier, - 'renderingErrors' + 'renderingErrors', )); } $res = $redisPipeline->exec(); diff --git a/Classes/NodeRendering/Infrastructure/RedisRenderingQueue.php b/Classes/NodeRendering/Infrastructure/RedisRenderingQueue.php index 627825e..2dede72 100644 --- a/Classes/NodeRendering/Infrastructure/RedisRenderingQueue.php +++ b/Classes/NodeRendering/Infrastructure/RedisRenderingQueue.php @@ -33,23 +33,20 @@ class RedisRenderingQueue */ public function appendRenderingJob( ContentReleaseIdentifier $contentReleaseIdentifier, - EnumeratedNode $enumeratedNode + EnumeratedNode $enumeratedNode, ) { $encodedNode = json_encode($enumeratedNode, JSON_THROW_ON_ERROR); $this->redisClientManager->getPrimaryRedis()->rPush( $this->redisKeyService->getRedisKeyForPostfix($contentReleaseIdentifier, 'renderingJobQueue'), - $encodedNode + $encodedNode, ); } public function numberOfQueuedJobs(ContentReleaseIdentifier $contentReleaseIdentifier): int { - return ( - $this->redisClientManager - ->getPrimaryRedis() - ->lLen($this->redisKeyService->getRedisKeyForPostfix($contentReleaseIdentifier, 'renderingJobQueue')) - ?? 0 - ); + return $this->redisClientManager + ->getPrimaryRedis() + ->lLen($this->redisKeyService->getRedisKeyForPostfix($contentReleaseIdentifier, 'renderingJobQueue')) ?? 0; } public function numberOfRenderingsInProgress(ContentReleaseIdentifier $contentReleaseIdentifier): int @@ -57,14 +54,16 @@ public function numberOfRenderingsInProgress(ContentReleaseIdentifier $contentRe return ( $this->redisClientManager ->getPrimaryRedis() - ->hLen($this->redisKeyService->getRedisKeyForPostfix($contentReleaseIdentifier, 'inProgressRenderings')) - ?? 0 + ->hLen($this->redisKeyService->getRedisKeyForPostfix( + $contentReleaseIdentifier, + 'inProgressRenderings', + )) ?? 0 ); } public function fetchAndReserveNextRenderingJob( ContentReleaseIdentifier $contentReleaseIdentifier, - RendererIdentifier $rendererIdentifier + RendererIdentifier $rendererIdentifier, ): ?EnumeratedNode { $redis = $this->redisClientManager->getPrimaryRedis(); @@ -89,9 +88,9 @@ public function fetchAndReserveNextRenderingJob( array( $this->redisKeyService->getRedisKeyForPostfix($contentReleaseIdentifier, 'renderingJobQueue'), $this->redisKeyService->getRedisKeyForPostfix($contentReleaseIdentifier, 'inProgressRenderings'), - $rendererIdentifier->string() + $rendererIdentifier->string(), ), - 2 + 2, ); if ($nextEntry === false && $redis->getLastError() !== null) { throw new \Exception('Redis operation EVAL failed: ' . $redis->getLastError(), 1471442667); @@ -115,12 +114,12 @@ public function fetchAndReserveNextRenderingJob( */ public function registerRenderingAttempt( ContentReleaseIdentifier $contentReleaseIdentifier, - EnumeratedNode $enumeratedNode + EnumeratedNode $enumeratedNode, ): int { return (int) $this->redisClientManager->getPrimaryRedis()->hIncrBy( $this->redisKeyService->getRedisKeyForPostfix($contentReleaseIdentifier, 'renderAttempts'), json_encode($enumeratedNode, JSON_THROW_ON_ERROR), - 1 + 1, ); } @@ -134,7 +133,7 @@ public function registerRenderingAttempt( public function removeRenderingJobFromReservedList( ContentReleaseIdentifier $contentReleaseIdentifier, EnumeratedNode $enumeratedNode, - RendererIdentifier $rendererIdentifier + RendererIdentifier $rendererIdentifier, ): bool { // Defensive Programming: It might be that the job has been claimed by another worker in the meantime (no clue how this might have happened though) $script = " @@ -160,9 +159,9 @@ public function removeRenderingJobFromReservedList( array( $this->redisKeyService->getRedisKeyForPostfix($contentReleaseIdentifier, 'inProgressRenderings'), json_encode($enumeratedNode, JSON_THROW_ON_ERROR), - $rendererIdentifier->string() + $rendererIdentifier->string(), ), - 1 + 1, ); } @@ -171,7 +170,7 @@ public function flush(ContentReleaseIdentifier $contentReleaseIdentifier) $this->redisClientManager->getPrimaryRedis()->del( $this->redisKeyService->getRedisKeyForPostfix($contentReleaseIdentifier, 'renderingJobQueue'), $this->redisKeyService->getRedisKeyForPostfix($contentReleaseIdentifier, 'inProgressRenderings'), - $this->redisKeyService->getRedisKeyForPostfix($contentReleaseIdentifier, 'renderAttempts') + $this->redisKeyService->getRedisKeyForPostfix($contentReleaseIdentifier, 'renderAttempts'), ); } } diff --git a/Classes/NodeRendering/Infrastructure/RedisRenderingTimeStatisticsStore.php b/Classes/NodeRendering/Infrastructure/RedisRenderingTimeStatisticsStore.php index b8c9b17..52d68fd 100644 --- a/Classes/NodeRendering/Infrastructure/RedisRenderingTimeStatisticsStore.php +++ b/Classes/NodeRendering/Infrastructure/RedisRenderingTimeStatisticsStore.php @@ -32,17 +32,17 @@ class RedisRenderingTimeStatisticsStore public function addStatisticsIteration( ContentReleaseIdentifier $contentReleaseIdentifier, - ?RenderingStatistics $renderingStatistics + ?RenderingStatistics $renderingStatistics, ) { $this->redisClientManager->getPrimaryRedis()->rPush( $this->redisKeyService->getRedisKeyForPostfix($contentReleaseIdentifier, 'renderingStatistics'), - json_encode($renderingStatistics) + json_encode($renderingStatistics), ); } public function replaceLastStatisticsIteration( ContentReleaseIdentifier $contentReleaseIdentifier, - RenderingStatistics $renderingStatistics + RenderingStatistics $renderingStatistics, ) { $this->redisClientManager ->getPrimaryRedis() @@ -52,12 +52,12 @@ public function replaceLastStatisticsIteration( public function getRenderingStatistics( ContentReleaseIdentifier $contentReleaseIdentifier, - RedisInstanceIdentifier $redisInstanceIdentifier + RedisInstanceIdentifier $redisInstanceIdentifier, ): array { return $this->redisClientManager->getRedis($redisInstanceIdentifier)->lRange( $this->redisKeyService->getRedisKeyForPostfix($contentReleaseIdentifier, 'renderingStatistics'), 0, - -1 + -1, ); } @@ -65,13 +65,13 @@ public function flush(ContentReleaseIdentifier $contentReleaseIdentifier) { $this->redisClientManager->getPrimaryRedis()->del($this->redisKeyService->getRedisKeyForPostfix( $contentReleaseIdentifier, - 'renderingStatistics' + 'renderingStatistics', )); } public function countMultipleRenderingStatistics( RedisInstanceIdentifier $redisInstanceIdentifier, - ContentReleaseIdentifier ...$releaseIdentifiers + ContentReleaseIdentifier ...$releaseIdentifiers, ): ContentReleaseBatchResult { $result = []; // KEY == contentReleaseIdentifier. VALUE == count of statistics entries (= count of iterations) $redis = $this->redisClientManager->getRedis($redisInstanceIdentifier); @@ -80,7 +80,7 @@ public function countMultipleRenderingStatistics( foreach ($batchedReleaseIdentifiers as $releaseIdentifier) { $redisPipeline->llen($this->redisKeyService->getRedisKeyForPostfix( $releaseIdentifier, - 'renderingStatistics' + 'renderingStatistics', )); } $res = $redisPipeline->exec(); @@ -93,7 +93,7 @@ public function countMultipleRenderingStatistics( public function getLastRenderingStatisticsEntry( RedisInstanceIdentifier $redisInstanceIdentifier, - ContentReleaseIdentifier ...$releaseIdentifiers + ContentReleaseIdentifier ...$releaseIdentifiers, ): ContentReleaseBatchResult { $result = []; // KEY == contentReleaseIdentifier. VALUE == last rendering statistics entry) $redis = $this->redisClientManager->getRedis($redisInstanceIdentifier); @@ -102,7 +102,7 @@ public function getLastRenderingStatisticsEntry( foreach ($batchedReleaseIdentifiers as $releaseIdentifier) { $redisPipeline->lindex( $this->redisKeyService->getRedisKeyForPostfix($releaseIdentifier, 'renderingStatistics'), - -1 + -1, ); } $res = $redisPipeline->exec(); @@ -115,7 +115,7 @@ public function getLastRenderingStatisticsEntry( public function getFirstRenderingStatisticsEntry( RedisInstanceIdentifier $redisInstanceIdentifier, - ContentReleaseIdentifier ...$releaseIdentifiers + ContentReleaseIdentifier ...$releaseIdentifiers, ): ContentReleaseBatchResult { $result = []; // KEY == contentReleaseIdentifier. VALUE == first rendering statistics entry) $redis = $this->redisClientManager->getRedis($redisInstanceIdentifier); @@ -124,7 +124,7 @@ public function getFirstRenderingStatisticsEntry( foreach ($batchedReleaseIdentifiers as $releaseIdentifier) { $redisPipeline->lindex( $this->redisKeyService->getRedisKeyForPostfix($releaseIdentifier, 'renderingStatistics'), - 0 + 0, ); } $res = $redisPipeline->exec(); diff --git a/Classes/NodeRendering/InterruptibleProcessRuntime.php b/Classes/NodeRendering/InterruptibleProcessRuntime.php index 8f0d03f..c3f890e 100644 --- a/Classes/NodeRendering/InterruptibleProcessRuntime.php +++ b/Classes/NodeRendering/InterruptibleProcessRuntime.php @@ -109,7 +109,7 @@ public function runUntilEventEncountered(string ...$eventClassNames): ?Interrupt // stop iterating the iterator in all cases return $this->handleExitEvent($currentEvent); } - $shortName = new \ReflectionClass($currentEvent)->getShortName(); + $shortName = (new \ReflectionClass($currentEvent))->getShortName(); foreach ($eventClassNames as $eventClassName) { if ($eventClassName === $shortName || is_a($currentEvent, $eventClassName)) { // stop here, can be restarted lateron. We still need to continue to the next event here. diff --git a/Classes/NodeRendering/InterruptibleProcessRuntimeEventInterface.php b/Classes/NodeRendering/InterruptibleProcessRuntimeEventInterface.php index b2e6fbc..c1b7ef2 100644 --- a/Classes/NodeRendering/InterruptibleProcessRuntimeEventInterface.php +++ b/Classes/NodeRendering/InterruptibleProcessRuntimeEventInterface.php @@ -7,6 +7,4 @@ /** * Marker interface for Interruptible Process Runtime Events */ -interface InterruptibleProcessRuntimeEventInterface -{ -} +interface InterruptibleProcessRuntimeEventInterface {} diff --git a/Classes/NodeRendering/NodeRenderOrchestrator.php b/Classes/NodeRendering/NodeRenderOrchestrator.php index 6f6f131..50a6fa1 100644 --- a/Classes/NodeRendering/NodeRenderOrchestrator.php +++ b/Classes/NodeRendering/NodeRenderOrchestrator.php @@ -118,7 +118,7 @@ class NodeRenderOrchestrator */ public function renderContentRelease( ContentReleaseIdentifier $contentReleaseIdentifier, - ContentReleaseLogger $contentReleaseLogger + ContentReleaseLogger $contentReleaseLogger, ): \Generator { $releaseMetadata = $this->redisContentReleaseService->fetchMetadataForContentRelease($contentReleaseIdentifier); $renderStatus = $releaseMetadata->getStatus(); @@ -127,7 +127,7 @@ public function renderContentRelease( $contentReleaseLogger->error( 'Release has already completed with status ' . $renderStatus->getDisplayName() - . ', so we cannot render again.' + . ', so we cannot render again.', ); yield ExitEvent::createWithStatusCode(self::EXIT_ERRORSTATUSCODE_RELEASE_ALREADY_COMPLETED); return; @@ -142,12 +142,12 @@ public function renderContentRelease( if ($this->redisEnumerationRepository->count($contentReleaseIdentifier) === 0) { $contentReleaseLogger->error( - 'Content Enumeration is empty. This is dangerous; we never want this to go live. Exiting.' + 'Content Enumeration is empty. This is dangerous; we never want this to go live. Exiting.', ); $this->redisContentReleaseService->setContentReleaseMetadata( $contentReleaseIdentifier, $releaseMetadata->withStatus(NodeRenderingCompletionStatus::failed()), - RedisInstanceIdentifier::primary() + RedisInstanceIdentifier::primary(), ); yield ExitEvent::createWithStatusCode(self::EXIT_ERRORSTATUSCODE_EMPTY_ENUMERATION); return; @@ -163,12 +163,12 @@ public function renderContentRelease( $i++; if ($i > 10) { $contentReleaseLogger->error( - 'FAILED to build a complete content release after 10 rendering attempts. Exiting.' + 'FAILED to build a complete content release after 10 rendering attempts. Exiting.', ); $this->redisContentReleaseService->setContentReleaseMetadata( $contentReleaseIdentifier, $releaseMetadata->withStatus(NodeRenderingCompletionStatus::failed()), - RedisInstanceIdentifier::primary() + RedisInstanceIdentifier::primary(), ); yield ExitEvent::createWithStatusCode(self::EXIT_ERRORSTATUSCODE_RETRY_LIMIT_REACHED); return; @@ -180,7 +180,7 @@ public function renderContentRelease( $this->redisRenderingStatisticsStore->addStatisticsIteration($contentReleaseIdentifier, RenderingStatistics::create( 0, 0, - [] + [], )); // goTroughEnumeratedNodesFillContentReleaseAndCheckWhatStillNeedsToBeDone @@ -190,12 +190,12 @@ public function renderContentRelease( $renderedDocumentFromContentCache = $this->nodeRenderingExtensionManager->tryToExtractRenderingForEnumeratedNodeFromContentCache( - $enumeratedNode + $enumeratedNode, ); if ($renderedDocumentFromContentCache->isComplete()) { $contentReleaseLogger->debug('Node fully rendered, adding to content release', [ 'url' => $renderedDocumentFromContentCache->getUrl(), - 'node' => $enumeratedNode + 'node' => $enumeratedNode, ]); // NOTE: Eventually consistent (TODO describe) // If wanted more fully consistent, move to bottom.... @@ -203,13 +203,13 @@ public function renderContentRelease( $contentReleaseIdentifier, $enumeratedNode, $renderedDocumentFromContentCache, - $contentReleaseLogger + $contentReleaseLogger, ); } else { $contentReleaseLogger->debug('Scheduling rendering for Node, as it was not found or its content is incomplete: ' . $renderedDocumentFromContentCache->getIncompleteReason(), [ 'url' => $renderedDocumentFromContentCache->getUrl(), - 'node' => $enumeratedNode + 'node' => $enumeratedNode, ]); // the rendered document was not found, or has holes. so we need to re-render. $nodesScheduledForRendering[] = $enumeratedNode; @@ -221,25 +221,24 @@ public function renderContentRelease( // we have NO nodes scheduled for rendering anymore, so that means we FINISHED successfully. $contentReleaseLogger->info(sprintf( 'Everything rendered completely in %d seconds. Finishing RenderOrchestrator', - time() - $startTime + time() - $startTime, )); // The release is complete now, so this is the point where we can determine its size once. Calculating // it is expensive, which is why the Backend UI relies on this stored value instead of re-calculating it. $contentReleaseSize = $this->redisContentReleaseSizeService->calculateReleaseSize( RedisInstanceIdentifier::primary(), - $contentReleaseIdentifier + $contentReleaseIdentifier, ); $contentReleaseLogger->info(sprintf('Content release size: %.2f MB', $contentReleaseSize)); // info to all renderers that we finished, and they should terminate themselves gracefully. $this->redisContentReleaseService->setContentReleaseMetadata( $contentReleaseIdentifier, - $releaseMetadata - ->withStatus(NodeRenderingCompletionStatus::success()) + $releaseMetadata->withStatus(NodeRenderingCompletionStatus::success()) ->withEndTime(new \DateTimeImmutable()) ->withContentReleaseSize($contentReleaseSize), - RedisInstanceIdentifier::primary() + RedisInstanceIdentifier::primary(), ); // Exit successfully. @@ -252,7 +251,7 @@ public function renderContentRelease( // and (because no exception happened) leaves no trace anywhere. So we register a rendering error naming // these nodes, which makes them visible in the Backend UI. $scheduledNodes = array_map(fn(EnumeratedNode $enumeratedNode) => json_encode( - $enumeratedNode + $enumeratedNode, ), $nodesScheduledForRendering); sort($scheduledNodes); $identicalIterationCount = $scheduledNodes === $previouslyScheduledNodes ? $identicalIterationCount + 1 : 1; @@ -265,19 +264,19 @@ public function renderContentRelease( ['node' => $enumeratedNode->debugString()], new \Exception(sprintf( 'This node was scheduled for rendering %d times in a row without ever becoming complete in the content cache. Check the render worker logs for this node - most likely no "doc--..." mapping entry is written for it.', - self::MAX_ITERATIONS_WITHOUT_PROGRESS - )) + self::MAX_ITERATIONS_WITHOUT_PROGRESS, + )), ); } $this->redisContentReleaseService->setContentReleaseMetadata( $contentReleaseIdentifier, $releaseMetadata->withStatus(NodeRenderingCompletionStatus::failed()), - RedisInstanceIdentifier::primary() + RedisInstanceIdentifier::primary(), ); $contentReleaseLogger->error(sprintf( 'The same %d nodes were scheduled for rendering %d iterations in a row without any progress. EXITING now.', count($nodesScheduledForRendering), - self::MAX_ITERATIONS_WITHOUT_PROGRESS + self::MAX_ITERATIONS_WITHOUT_PROGRESS, )); yield ExitEvent::createWithStatusCode(self::EXIT_ERRORSTATUSCODE_RENDERING_ERRORS); return; @@ -305,12 +304,12 @@ public function renderContentRelease( $this->redisRenderingStatisticsStore->replaceLastStatisticsIteration($contentReleaseIdentifier, RenderingStatistics::create( $remainingJobsCount, $totalJobsCount, - $renderingsPerSecondDataPoints + $renderingsPerSecondDataPoints, )); sleep(1); $waitTimer++; - if (( $waitTimer % 10 ) === 0) { + if (($waitTimer % 10) === 0) { $previousRemainingJobs = $remainingJobsCount; $remainingJobsCount = $this->redisRenderingQueue->numberOfQueuedJobs($contentReleaseIdentifier); $jobsWorkedThroughOverLastTenSeconds = $previousRemainingJobs - $remainingJobsCount; @@ -319,7 +318,7 @@ public function renderContentRelease( $contentReleaseLogger->debug('Waiting... ', [ 'numberOfQueuedJobs' => $remainingJobsCount, 'numberOfRenderingsInProgress' => - $this->redisRenderingQueue->numberOfRenderingsInProgress($contentReleaseIdentifier) + $this->redisRenderingQueue->numberOfRenderingsInProgress($contentReleaseIdentifier), ]); $this->concurrentBuildLockService->assertNoOtherContentReleaseWasStarted($contentReleaseIdentifier); @@ -337,12 +336,12 @@ public function renderContentRelease( $this->redisContentReleaseService->setContentReleaseMetadata( $contentReleaseIdentifier, $releaseMetadata->withStatus(NodeRenderingCompletionStatus::failed()), - RedisInstanceIdentifier::primary() + RedisInstanceIdentifier::primary(), ); $contentReleaseLogger->error('In this iteration, there happened ' . $amountOfRenderingErrors . ' rendering errors. EXITING now, as there is no chance of completing the content release successfully.', [ - $renderingErrors + $renderingErrors, ]); yield ExitEvent::createWithStatusCode(self::EXIT_ERRORSTATUSCODE_RENDERING_ERRORS); return; @@ -352,7 +351,7 @@ public function renderContentRelease( $this->redisRenderingStatisticsStore->replaceLastStatisticsIteration($contentReleaseIdentifier, RenderingStatistics::create( $remainingJobsCount, $totalJobsCount, - $renderingsPerSecondDataPoints + $renderingsPerSecondDataPoints, )); yield RenderingIterationCompletedEvent::create(); diff --git a/Classes/NodeRendering/NodeRenderer.php b/Classes/NodeRendering/NodeRenderer.php index 5990148..d9f1447 100644 --- a/Classes/NodeRendering/NodeRenderer.php +++ b/Classes/NodeRendering/NodeRenderer.php @@ -136,7 +136,7 @@ class NodeRenderer public function render( ContentReleaseIdentifier $contentReleaseIdentifier, ContentReleaseLogger $contentReleaseLogger, - RendererIdentifier $rendererIdentifier + RendererIdentifier $rendererIdentifier, ) { $contentReleaseLogger = $contentReleaseLogger->withRenderer($rendererIdentifier); @@ -153,14 +153,14 @@ public function render( $enumeratedNode = $this->redisRenderingQueue->fetchAndReserveNextRenderingJob( $contentReleaseIdentifier, - $rendererIdentifier + $rendererIdentifier, ); if ($enumeratedNode === null) { yield QueueEmptyEvent::create(); // the queue is currently empty, but this does not necessarily mean that rendering is finished. Maybe the NodeRenderOrchestrator is still // determining what needs to be done. We just need to wait a bit and retry. $contentReleaseLogger->debug( - 'Rendering queue currently empty; we wait a bit see if there is work for us.' + 'Rendering queue currently empty; we wait a bit see if there is work for us.', ); sleep(2); $this->concurrentBuildLockService->assertNoOtherContentReleaseWasStarted($contentReleaseIdentifier); @@ -169,7 +169,7 @@ public function render( $renderingAttempt = $this->redisRenderingQueue->registerRenderingAttempt( $contentReleaseIdentifier, - $enumeratedNode + $enumeratedNode, ); try { @@ -177,7 +177,7 @@ public function render( $enumeratedNode, $contentReleaseIdentifier, $contentReleaseLogger, - $renderingAttempt + $renderingAttempt, ); // BUGFIX: Because rendering a document node can update Thumbnails and their connected Persistent Resource // objects (= Doctrine Entities), we need to *persist* these changes. Otherwise, we will have broken @@ -188,14 +188,14 @@ public function render( $removalSuccess = $this->redisRenderingQueue->removeRenderingJobFromReservedList( $contentReleaseIdentifier, $enumeratedNode, - $rendererIdentifier + $rendererIdentifier, ); if ($removalSuccess === false) { $contentReleaseLogger->warn( 'Node could not be removed from reserved-list, because it was claimed by some other worker in the meantime. We don not know yet how this case might happen.', [ - 'node' => $enumeratedNode->debugString() - ] + 'node' => $enumeratedNode->debugString(), + ], ); } } @@ -205,15 +205,15 @@ public function render( if ( static::CHECK_FOR_CONCURRENT_RELEASES_RENDER_COUNT > 0 - && ( $i % static::CHECK_FOR_CONCURRENT_RELEASES_RENDER_COUNT ) === 0 + && ($i % static::CHECK_FOR_CONCURRENT_RELEASES_RENDER_COUNT) === 0 ) { $this->concurrentBuildLockService->assertNoOtherContentReleaseWasStarted($contentReleaseIdentifier); } - if (( $i % static::RESTART_AFTER_RENDER_COUNT ) === 0) { + if (($i % static::RESTART_AFTER_RENDER_COUNT) === 0) { $contentReleaseLogger->info(sprintf( 'Restarting after %d renders.', - static::RESTART_AFTER_RENDER_COUNT + static::RESTART_AFTER_RENDER_COUNT, )); yield ExitEvent::createWithStatusCode(193); return; @@ -244,7 +244,7 @@ protected function renderDocumentNodeVariant( EnumeratedNode $enumeratedNode, ContentReleaseIdentifier $contentReleaseIdentifier, ContentReleaseLogger $contentReleaseLogger, - int $renderingAttempt = 1 + int $renderingAttempt = 1, ) { $nodeWasFound = false; try { @@ -265,13 +265,13 @@ protected function renderDocumentNodeVariant( 'nodeIdentifier' => $node->getIdentifier(), 'workspaceName' => $enumeratedNode->getWorkspaceNameFromContextPath(), 'dimensions' => $enumeratedNode->getDimensionsFromContextPath(), - 'arguments' => $enumeratedNode->getArguments() + 'arguments' => $enumeratedNode->getArguments(), ]); $this->nodeRenderingExtensionManager->renderDocumentNodeVariant( $node, $enumeratedNode, - $contentReleaseLogger + $contentReleaseLogger, ); } @@ -284,14 +284,14 @@ protected function renderDocumentNodeVariant( $exception->getPrevious(), 'Exception getting document node variant for rendering', array( - 'node' => $enumeratedNode->debugString() - ) + 'node' => $enumeratedNode->debugString(), + ), ); $this->redisRenderingErrorManager->registerRenderingError( $contentReleaseIdentifier, ['node' => $enumeratedNode->debugString()], - $exception->getPrevious() + $exception->getPrevious(), ); } catch (RenderingException $exception) { $contentReleaseLogger->logException( @@ -299,24 +299,24 @@ protected function renderDocumentNodeVariant( 'Exception while rendering document node variant', array( 'node' => $enumeratedNode->debugString(), - 'nodeUri' => $exception->getNodeUri() - ) + 'nodeUri' => $exception->getNodeUri(), + ), ); $this->redisRenderingErrorManager->registerRenderingError( $contentReleaseIdentifier, ['node' => $enumeratedNode->debugString(), 'nodeUri' => $exception->getNodeUri()], - $exception->getPrevious() + $exception->getPrevious(), ); } catch (\Exception $exception) { $contentReleaseLogger->logException($exception, 'Exception while rendering document node variant', array( - 'node' => $enumeratedNode->debugString() + 'node' => $enumeratedNode->debugString(), )); $this->redisRenderingErrorManager->registerRenderingError( $contentReleaseIdentifier, ['node' => $enumeratedNode->debugString()], - $exception + $exception, ); } @@ -331,8 +331,8 @@ protected function renderDocumentNodeVariant( $contentReleaseIdentifier, ['node' => $enumeratedNode->debugString()], new \Exception( - 'We could not load a node which was part of the enumeration. At this point, the content release will definitely fail with no further possibility of recovery. Thus, we are exiting the rendering with an error' - ) + 'We could not load a node which was part of the enumeration. At this point, the content release will definitely fail with no further possibility of recovery. Thus, we are exiting the rendering with an error', + ), ); $this->contentReleaseManager->startIncrementalContentRelease(); } @@ -353,7 +353,7 @@ private function flushContentCacheForNode( NodeInterface $node, EnumeratedNode $enumeratedNode, int $renderingAttempt, - ContentReleaseLogger $contentReleaseLogger + ContentReleaseLogger $contentReleaseLogger, ): void { if (!$this->flushDocumentCacheOnRetry) { return; @@ -368,11 +368,11 @@ private function flushContentCacheForNode( sprintf( 'Rendering attempt %d for this node; flushed %d content cache entries before re-rendering it.', $renderingAttempt, - $flushedEntriesCount + $flushedEntriesCount, ), [ - 'node' => $enumeratedNode->debugString() - ] + 'node' => $enumeratedNode->debugString(), + ], ); } @@ -389,7 +389,7 @@ protected function fetchRenderableNode(EnumeratedNode $enumeratedNode): ?NodeInt 'workspaceName' => $enumeratedNode->getWorkspaceNameFromContextPath(), 'currentSite' => $site, 'currentDomain' => $site->getFirstActiveDomain(), - 'dimensions' => $enumeratedNode->getDimensionsFromContextPath() + 'dimensions' => $enumeratedNode->getDimensionsFromContextPath(), ]); return $context->getNodeByIdentifier($enumeratedNode->getNodeIdentifier()); } diff --git a/Classes/NodeRendering/NodeRenderingUriService.php b/Classes/NodeRendering/NodeRenderingUriService.php index 9b50573..20e666a 100644 --- a/Classes/NodeRendering/NodeRenderingUriService.php +++ b/Classes/NodeRendering/NodeRenderingUriService.php @@ -65,9 +65,9 @@ public function buildNodeUri(NodeInterface $node, array $arguments): string sprintf( 'Domain %s for site %s has no scheme defined', $primaryDomain->getHostname(), - $currentSite->getNodeName() + $currentSite->getNodeName(), ), - 1666684523 + 1666684523, ); } @@ -77,7 +77,7 @@ public function buildNodeUri(NodeInterface $node, array $arguments): string $baseControllerContext = $this->buildControllerContextAndSetBaseUri( $primaryDomain->__toString(), $node, - $arguments + $arguments, ); $format = $arguments['@format'] ?? 'html'; $uri = $this->linkingService->createNodeUri( @@ -90,7 +90,7 @@ public function buildNodeUri(NodeInterface $node, array $arguments): string '', false, [], - false + false, ); return self::removeQueryPartFromUri($uri); } @@ -127,7 +127,7 @@ private function buildFakeRequest(string $uri, NodeInterface $node): ActionReque $httpRequest = new ServerRequest('GET', $uri); $routingParameters = RouteParameters::createEmpty()->withParameter( 'requestUriHost', - $httpRequest->getUri()->getHost() + $httpRequest->getUri()->getHost(), ); $httpRequest = $httpRequest->withAttribute(ServerRequestAttributes::ROUTING_PARAMETERS, $routingParameters); diff --git a/Classes/NodeRendering/Render/CustomFusionView.php b/Classes/NodeRendering/Render/CustomFusionView.php index dd4a75d..bf8af7a 100644 --- a/Classes/NodeRendering/Render/CustomFusionView.php +++ b/Classes/NodeRendering/Render/CustomFusionView.php @@ -138,7 +138,7 @@ protected function getFusionRuntime(TraversableNodeInterface $currentSiteNode) // !!*WHICH CHANGES FOR EVERY DOCUMENT*!! $this->fusionRuntimePerSiteNode[$currentSiteNodeContextPath] = new Runtime( $fusionObjectTree, - $this->controllerContext + $this->controllerContext, ); } $this->fusionRuntime = $this->fusionRuntimePerSiteNode[$currentSiteNodeContextPath]; @@ -158,7 +158,7 @@ protected function getFusionRuntime(TraversableNodeInterface $currentSiteNode) // but I felt this would be an additional safeguard against problems with the cache (e.g. content leaking through dimensions or pages) $this->runtimeContentCacheAccessor->setValue( $this->fusionRuntime, - new RuntimeContentCache($this->fusionRuntime) + new RuntimeContentCache($this->fusionRuntime), ); // after replacing the RuntimeContentCache, we again need to enable the content cache explicitly. diff --git a/Classes/NodeRendering/Render/DocumentRenderer.php b/Classes/NodeRendering/Render/DocumentRenderer.php index 799b04d..69ac7c4 100644 --- a/Classes/NodeRendering/Render/DocumentRenderer.php +++ b/Classes/NodeRendering/Render/DocumentRenderer.php @@ -77,7 +77,7 @@ class DocumentRenderer public function renderDocumentNodeVariant( NodeInterface $node, array $arguments, - ContentReleaseLogger $contentReleaseLogger + ContentReleaseLogger $contentReleaseLogger, ): string { $this->cacheUrlMappingAspect->beforeDocumentRendering($contentReleaseLogger); $nodeUri = $this->nodeRenderingUriService->buildNodeUri($node, $arguments); @@ -91,7 +91,7 @@ public function renderDocumentNodeVariant( $node, $nodeUri, 1491378709, - $exception + $exception, ); } finally { $this->cacheUrlMappingAspect->afterDocumentRendering(); @@ -114,7 +114,7 @@ protected function renderDocumentView( NodeInterface $node, $uri, array $requestArguments, - ContentReleaseLogger $contentReleaseLogger + ContentReleaseLogger $contentReleaseLogger, ): string { $this->isRendering = true; @@ -127,7 +127,7 @@ protected function renderDocumentView( if ($baseUri === '') { throw new Exception\InvalidSiteConfigurationException( 'Cannot render content without active domain for site "' . $site->getName() . '"', - 1467289645 + 1467289645, ); } @@ -136,7 +136,7 @@ protected function renderDocumentView( $controllerContext = $this->nodeRenderingUriService->buildControllerContextAndSetBaseUri( $uri, $node, - $requestArguments + $requestArguments, ); /** @var ActionRequest $request */ $request = $controllerContext->getRequest(); @@ -146,7 +146,7 @@ protected function renderDocumentView( MultisiteFileSystemSymlinkTarget::injectBaseUriIntoRelevantResourcePublishingTargets( $resourceBaseUri, - $this->resourceManager + $this->resourceManager, ); $this->fusionView->setFusionPath('documentRendering'); @@ -191,7 +191,7 @@ private static function wrapInHttpMessage(string $output, ActionResponse $respon } // Finally, we build the HTTP response. - return 'HTTP/1.1' . ( empty($headerLines) ? "\r\n" : implode("\r\n", $headerLines) ) . "\r\n" . $output; + return 'HTTP/1.1' . (empty($headerLines) ? "\r\n" : implode("\r\n", $headerLines)) . "\r\n" . $output; } /** diff --git a/Classes/NodeRendering/Render/ExtractedExceptionDto.php b/Classes/NodeRendering/Render/ExtractedExceptionDto.php index b88ba49..e9b2fa2 100644 --- a/Classes/NodeRendering/Render/ExtractedExceptionDto.php +++ b/Classes/NodeRendering/Render/ExtractedExceptionDto.php @@ -56,8 +56,8 @@ public function __toString() { return ( $this->getMessage() - . ( !empty($this->getStackTrace()) ? "\n{$this->getStackTrace()}" : '' ) - . ( !empty($this->getReferenceCode()) ? "\n(reference code {$this->getReferenceCode()})" : '' ) + . (!empty($this->getStackTrace()) ? "\n{$this->getStackTrace()}" : '') + . (!empty($this->getReferenceCode()) ? "\n(reference code {$this->getReferenceCode()})" : '') ); } } diff --git a/Classes/NodeRendering/Render/RenderExceptionExtractor.php b/Classes/NodeRendering/Render/RenderExceptionExtractor.php index 2627398..0caab65 100644 --- a/Classes/NodeRendering/Render/RenderExceptionExtractor.php +++ b/Classes/NodeRendering/Render/RenderExceptionExtractor.php @@ -52,7 +52,7 @@ public static function extractRenderingException($content) return new ExtractedExceptionDto( $matches['message'], $matches['stackTrace'], - $matches['referenceCode'] ?? '' + $matches['referenceCode'] ?? '', ); } return null; diff --git a/Classes/Package.php b/Classes/Package.php index 0860414..cdb1315 100644 --- a/Classes/Package.php +++ b/Classes/Package.php @@ -23,7 +23,7 @@ public function boot(Bootstrap $bootstrap) Workspace::class, 'afterNodePublishing', IncrementalContentReleaseHandler::class, - 'nodePublished' + 'nodePublished', ); // NASTY WORKAROUND - explanation follows. @@ -38,11 +38,10 @@ public function boot(Bootstrap $bootstrap) $dispatcher->connect('Neos\Flow\Mvc\Dispatcher', 'afterControllerInvocation', function ( $request, $response, - $controller + $controller, ) use ($bootstrap) { if ($controller instanceof ControllerInterface) { - $bootstrap - ->getObjectManager() + $bootstrap->getObjectManager() ->get(IncrementalContentReleaseHandler::class) ->startContentReleaseIfNodesWerePublishedBefore(); } diff --git a/Classes/PrepareContentRelease/Dto/ContentReleaseMetadata.php b/Classes/PrepareContentRelease/Dto/ContentReleaseMetadata.php index 6202af1..2c4fc93 100644 --- a/Classes/PrepareContentRelease/Dto/ContentReleaseMetadata.php +++ b/Classes/PrepareContentRelease/Dto/ContentReleaseMetadata.php @@ -57,7 +57,7 @@ private function __construct( ?array $manualTransferJobIds = [], string $workspaceName = 'live', ?string $accountId = 'cli', - ?float $contentReleaseSize = null + ?float $contentReleaseSize = null, ) { $this->prunnerJobId = $prunnerJobId; $this->startTime = $startTime; @@ -74,7 +74,7 @@ public static function create( PrunnerJobId $prunnerJobId, \DateTimeInterface $startTime, string $workspace = 'live', - string $accountId = 'cli' + string $accountId = 'cli', ): self { return new self( $prunnerJobId, @@ -84,7 +84,7 @@ public static function create( NodeRenderingCompletionStatus::scheduled(), [], $workspace, - $accountId + $accountId, ); } @@ -110,12 +110,13 @@ public static function fromJsonString($metadataEncoded, ContentReleaseIdentifier ? \DateTimeImmutable::createFromFormat(\DateTime::RFC3339_EXTENDED, $tmp['switchTime']) : null, NodeRenderingCompletionStatus::fromString($tmp['status']), - isset($tmp['manualTransferJobIds']) ? array_map(function (string $item) { + isset($tmp['manualTransferJobIds']) + ? array_map(function (string $item) { return PrunnerJobId::fromString($item); }, json_decode($tmp['manualTransferJobIds'])) : [], $tmp['workspaceName'] ?? 'live', key_exists('accountId', $tmp) ? $tmp['accountId'] : 'cli', - isset($tmp['contentReleaseSize']) ? (float) $tmp['contentReleaseSize'] : null + isset($tmp['contentReleaseSize']) ? (float) $tmp['contentReleaseSize'] : null, ); } @@ -130,7 +131,7 @@ public function jsonSerialize(): array 'manualTransferJobIds' => json_encode($this->manualTransferJobIds), 'workspaceName' => $this->workspaceName, 'accountId' => $this->accountId, - 'contentReleaseSize' => $this->contentReleaseSize + 'contentReleaseSize' => $this->contentReleaseSize, ]; } @@ -145,7 +146,7 @@ public function withEndTime(\DateTimeInterface $endTime): self $this->manualTransferJobIds, $this->workspaceName, $this->accountId, - $this->contentReleaseSize + $this->contentReleaseSize, ); } @@ -160,7 +161,7 @@ public function withSwitchTime(\DateTimeInterface $switchTime): self $this->manualTransferJobIds, $this->workspaceName, $this->accountId, - $this->contentReleaseSize + $this->contentReleaseSize, ); } @@ -175,7 +176,7 @@ public function withStatus(NodeRenderingCompletionStatus $status): self $this->manualTransferJobIds, $this->workspaceName, $this->accountId, - $this->contentReleaseSize + $this->contentReleaseSize, ); } @@ -192,7 +193,7 @@ public function withAdditionalManualTransferJobId(PrunnerJobId $prunnerJobId): s $manualTransferIdArray, $this->workspaceName, $this->accountId, - $this->contentReleaseSize + $this->contentReleaseSize, ); } @@ -207,7 +208,7 @@ public function withContentReleaseSize(float $contentReleaseSize): self $this->manualTransferJobIds, $this->workspaceName, $this->accountId, - $contentReleaseSize + $contentReleaseSize, ); } diff --git a/Classes/PrepareContentRelease/Infrastructure/RedisContentReleaseService.php b/Classes/PrepareContentRelease/Infrastructure/RedisContentReleaseService.php index 2504b33..1d31147 100644 --- a/Classes/PrepareContentRelease/Infrastructure/RedisContentReleaseService.php +++ b/Classes/PrepareContentRelease/Infrastructure/RedisContentReleaseService.php @@ -43,26 +43,26 @@ public function createContentRelease( PrunnerJobId $prunnerJobId, ContentReleaseLogger $contentReleaseLogger, string $workspaceName = 'live', - string $accountId = 'cli' + string $accountId = 'cli', ): void { $redis = $this->redisClientManager->getPrimaryRedis(); // Check there is no existing release with the same identifier $existingRelease = $redis->get($this->redisKeyService->getRedisKeyForPostfix( $contentReleaseIdentifier, - 'meta:info' + 'meta:info', )); if ($existingRelease) { $contentReleaseLogger->error(sprintf( 'Content Release "%s" already exists', - $contentReleaseIdentifier->getIdentifier() + $contentReleaseIdentifier->getIdentifier(), )); throw new \RuntimeException( sprintf( 'Content Release "%s" already exists, cannot create a release with the same identifier', - $contentReleaseIdentifier->getIdentifier() + $contentReleaseIdentifier->getIdentifier(), ), - 1689750292 + 1689750292, ); } @@ -73,7 +73,7 @@ public function createContentRelease( $redis->zAdd('contentStore:registeredReleases', 0, $contentReleaseIdentifier->getIdentifier()); $redis->set( $this->redisKeyService->getRedisKeyForPostfix($contentReleaseIdentifier, 'meta:info'), - json_encode($metadata) + json_encode($metadata), ); $redis->exec(); } catch (\Exception $e) { @@ -83,37 +83,37 @@ public function createContentRelease( $contentReleaseLogger->info( sprintf('Registered Content Release %s', $contentReleaseIdentifier->getIdentifier()), [ - 'metadata' => $metadata - ] + 'metadata' => $metadata, + ], ); } public function setContentReleaseMetadata( ContentReleaseIdentifier $contentReleaseIdentifier, ContentReleaseMetadata $metadata, - RedisInstanceIdentifier $redisInstanceIdentifier + RedisInstanceIdentifier $redisInstanceIdentifier, ): void { $this->redisClientManager->getRedis($redisInstanceIdentifier)->set( $this->redisKeyService->getRedisKeyForPostfix($contentReleaseIdentifier, 'meta:info'), - json_encode($metadata) + json_encode($metadata), ); } public function registerManualTransferJob( ContentReleaseIdentifier $contentReleaseIdentifier, PrunnerJobId $prunnerJobId, - ContentReleaseLogger $contentReleaseLogger + ContentReleaseLogger $contentReleaseLogger, ): void { $releaseMetadata = $this->fetchMetadataForContentRelease($contentReleaseIdentifier); $this->setContentReleaseMetadata( $contentReleaseIdentifier, $releaseMetadata->withAdditionalManualTransferJobId($prunnerJobId), - RedisInstanceIdentifier::primary() + RedisInstanceIdentifier::primary(), ); $contentReleaseLogger->info(sprintf( 'Register new pipeline for release %s', - $contentReleaseIdentifier->getIdentifier() + $contentReleaseIdentifier->getIdentifier(), )); } @@ -135,13 +135,13 @@ public function fetchAllReleaseIds(RedisInstanceIdentifier $redisInstanceIdentif public function fetchMetadataForContentRelease( ContentReleaseIdentifier $contentReleaseIdentifier, - ?RedisInstanceIdentifier $redisInstanceIdentifier = null + ?RedisInstanceIdentifier $redisInstanceIdentifier = null, ): ?ContentReleaseMetadata { $redisInstanceIdentifier = $redisInstanceIdentifier ?: RedisInstanceIdentifier::primary(); $redis = $this->redisClientManager->getRedis($redisInstanceIdentifier); $metadataEncoded = $redis->get($this->redisKeyService->getRedisKeyForPostfix( $contentReleaseIdentifier, - 'meta:info' + 'meta:info', )); if (!$metadataEncoded) { return null; @@ -151,7 +151,7 @@ public function fetchMetadataForContentRelease( public function fetchMetadataForContentReleases( RedisInstanceIdentifier $redisInstanceIdentifier, - ContentReleaseIdentifier ...$releaseIdentifiers + ContentReleaseIdentifier ...$releaseIdentifiers, ): ContentReleaseBatchResult { $redis = $this->redisClientManager->getRedis($redisInstanceIdentifier); $result = []; // KEY == contentReleaseIdentifier. VALUE == enumerated count diff --git a/Classes/QuickPublish/ContentReleaseScope.php b/Classes/QuickPublish/ContentReleaseScope.php index fc8229d..96aad8e 100644 --- a/Classes/QuickPublish/ContentReleaseScope.php +++ b/Classes/QuickPublish/ContentReleaseScope.php @@ -41,7 +41,7 @@ public function getChangedUrls(ContentReleaseIdentifier $contentReleaseIdentifie ->getPrimaryRedis() ->sMembers($this->redisKeyService->getRedisKeyForPostfix( $contentReleaseIdentifier, - self::CHANGED_URLS_POSTFIX + self::CHANGED_URLS_POSTFIX, )); // a quick release which changed nothing is never published, so an empty set means there is no scope @@ -63,7 +63,7 @@ public function setChangedUrls(ContentReleaseIdentifier $contentReleaseIdentifie $this->redisClientManager->getPrimaryRedis()->sAdd( $this->redisKeyService->getRedisKeyForPostfix($contentReleaseIdentifier, self::CHANGED_URLS_POSTFIX), - ...$changedUrls + ...$changedUrls, ); } diff --git a/Classes/QuickPublish/Dto/QuickPublishPreviewRow.php b/Classes/QuickPublish/Dto/QuickPublishPreviewRow.php index d694677..4c03333 100644 --- a/Classes/QuickPublish/Dto/QuickPublishPreviewRow.php +++ b/Classes/QuickPublish/Dto/QuickPublishPreviewRow.php @@ -36,7 +36,7 @@ private function __construct( string $dimensions, string $nodeTypeName, ?string $backendUri, - ?string $skipReason + ?string $skipReason, ) { $this->nodeIdentifier = $nodeIdentifier; $this->title = $title; @@ -54,7 +54,7 @@ public static function forNode( string $dimensions, string $nodeTypeName, ?string $backendUri, - ?string $skipReason + ?string $skipReason, ): self { return new self($nodeIdentifier, $title, $nodePath, $dimensions, $nodeTypeName, $backendUri, $skipReason); } diff --git a/Classes/QuickPublish/Infrastructure/RedisReleaseCopyService.php b/Classes/QuickPublish/Infrastructure/RedisReleaseCopyService.php index ac5a887..bfb36c5 100644 --- a/Classes/QuickPublish/Infrastructure/RedisReleaseCopyService.php +++ b/Classes/QuickPublish/Infrastructure/RedisReleaseCopyService.php @@ -53,15 +53,15 @@ public function copyReleaseWithin( RedisInstanceIdentifier $redisInstanceIdentifier, ContentReleaseIdentifier $sourceContentReleaseIdentifier, ContentReleaseIdentifier $targetContentReleaseIdentifier, - ContentReleaseLogger $contentReleaseLogger + ContentReleaseLogger $contentReleaseLogger, ): void { if ($sourceContentReleaseIdentifier->equals($targetContentReleaseIdentifier)) { throw new InvalidReleaseException( sprintf( 'Cannot copy content release %s onto itself.', - $sourceContentReleaseIdentifier->getIdentifier() + $sourceContentReleaseIdentifier->getIdentifier(), ), - 1786953585 + 1786953585, ); } @@ -73,7 +73,7 @@ public function copyReleaseWithin( 'Copying content release %s to %s within redis %s', $sourceContentReleaseIdentifier->getIdentifier(), $targetContentReleaseIdentifier->getIdentifier(), - $redisInstanceIdentifier->getIdentifier() + $redisInstanceIdentifier->getIdentifier(), )); $redisKeyPostfixesForEachRelease = RedisKeyPostfixesForEachRelease::fromArray($this->redisKeyPostfixesForEachReleaseConfiguration); @@ -83,11 +83,11 @@ public function copyReleaseWithin( foreach ($redisKeyPostfixesForEachRelease->getKeysToCopyOnQuickRelease() as $redisKeyPostfix) { $sourceKey = $this->redisKeyService->getRedisKeyForPostfix( $sourceContentReleaseIdentifier, - $redisKeyPostfix->getRedisKeyPostfix() + $redisKeyPostfix->getRedisKeyPostfix(), ); $targetKey = $this->redisKeyService->getRedisKeyForPostfix( $targetContentReleaseIdentifier, - $redisKeyPostfix->getRedisKeyPostfix() + $redisKeyPostfix->getRedisKeyPostfix(), ); if (!$redis->exists($sourceKey)) { @@ -100,7 +100,7 @@ public function copyReleaseWithin( 'COPY: ' . $targetKey . ' already exists and is replaced - ' - . 'the release was copied into after something already wrote to it.' + . 'the release was copied into after something already wrote to it.', ); } @@ -108,7 +108,7 @@ public function copyReleaseWithin( if ($redis->copy($sourceKey, $targetKey, ['replace' => true]) !== true) { throw new InvalidReleaseException( 'COPY: Could not copy ' . $sourceKey . ' to ' . $targetKey . '.', - 1786953586 + 1786953586, ); } $copiedKeyCount++; @@ -116,7 +116,7 @@ public function copyReleaseWithin( $contentReleaseLogger->info(sprintf( 'COPY: Copied key %s (time: %2.3f)', $targetKey, - microtime(true) - $keyStartTime + microtime(true) - $keyStartTime, )); } @@ -124,7 +124,7 @@ public function copyReleaseWithin( 'COPY: Copied %d keys from content release %s (total time: %2.3f)', $copiedKeyCount, $sourceContentReleaseIdentifier->getIdentifier(), - microtime(true) - $startTime + microtime(true) - $startTime, )); } @@ -144,9 +144,9 @@ private function assertServerSupportsCopy(Redis $redis): void 'Copying a content release needs the redis COPY command, which requires redis %s or newer. ' . 'This server reports version "%s".', self::MINIMUM_REDIS_VERSION, - $redisVersion + $redisVersion, ), - 1786953587 + 1786953587, ); } } @@ -161,11 +161,11 @@ private function assertServerSupportsCopy(Redis $redis): void private function assertSourceReleaseCanBeBuiltUpon( Redis $redis, RedisInstanceIdentifier $redisInstanceIdentifier, - ContentReleaseIdentifier $sourceContentReleaseIdentifier + ContentReleaseIdentifier $sourceContentReleaseIdentifier, ): void { $metadata = $this->redisContentReleaseService->fetchMetadataForContentRelease( $sourceContentReleaseIdentifier, - $redisInstanceIdentifier + $redisInstanceIdentifier, ); if ($metadata === null) { @@ -174,9 +174,9 @@ private function assertSourceReleaseCanBeBuiltUpon( 'Content release %s does not exist in redis %s, so it cannot be copied. Run a full content release ' . 'instead.', $sourceContentReleaseIdentifier->getIdentifier(), - $redisInstanceIdentifier->getIdentifier() + $redisInstanceIdentifier->getIdentifier(), ), - 1786953588 + 1786953588, ); } @@ -186,9 +186,9 @@ private function assertSourceReleaseCanBeBuiltUpon( 'Content release %s has the status "%s" instead of "success", so it cannot be copied. Run a full ' . 'content release instead.', $sourceContentReleaseIdentifier->getIdentifier(), - $metadata->getStatus()->getStatus() + $metadata->getStatus()->getStatus(), ), - 1786953589 + 1786953589, ); } @@ -204,7 +204,7 @@ private function assertSourceReleaseCanBeBuiltUpon( $requiredKey = $this->redisKeyService->getRedisKeyForPostfix( $sourceContentReleaseIdentifier, - $requiredPostfix->getRedisKeyPostfix() + $requiredPostfix->getRedisKeyPostfix(), ); if (!$redis->exists($requiredKey)) { throw new InvalidReleaseException( @@ -212,9 +212,9 @@ private function assertSourceReleaseCanBeBuiltUpon( 'Required redis key %s does not exist, so content release %s cannot be copied. Run a full ' . 'content release instead.', $requiredKey, - $sourceContentReleaseIdentifier->getIdentifier() + $sourceContentReleaseIdentifier->getIdentifier(), ), - 1786953590 + 1786953590, ); } } diff --git a/Classes/QuickPublish/QuickPublishNodeEnumerator.php b/Classes/QuickPublish/QuickPublishNodeEnumerator.php index c2007ab..ebb1d85 100644 --- a/Classes/QuickPublish/QuickPublishNodeEnumerator.php +++ b/Classes/QuickPublish/QuickPublishNodeEnumerator.php @@ -72,11 +72,11 @@ final class QuickPublishNodeEnumerator public function enumerateGivenNodesAndStoreInRedis( NodeIdentifiers $nodeIdentifiers, ContentReleaseLogger $contentReleaseLogger, - ContentReleaseIdentifier $releaseIdentifier + ContentReleaseIdentifier $releaseIdentifier, ): void { $contentReleaseLogger->info('Starting quick content release', [ 'contentReleaseIdentifier' => $releaseIdentifier->jsonSerialize(), - 'nodeIdentifiers' => $nodeIdentifiers->jsonSerialize() + 'nodeIdentifiers' => $nodeIdentifiers->jsonSerialize(), ]); $currentMetadata = $this->redisContentReleaseService->fetchMetadataForContentRelease($releaseIdentifier); @@ -84,9 +84,9 @@ public function enumerateGivenNodesAndStoreInRedis( throw new InvalidReleaseException( sprintf( 'Content release %s does not exist, so its nodes cannot be enumerated.', - $releaseIdentifier->getIdentifier() + $releaseIdentifier->getIdentifier(), ), - 1786958512 + 1786958512, ); } @@ -94,7 +94,7 @@ public function enumerateGivenNodesAndStoreInRedis( $this->redisContentReleaseService->setContentReleaseMetadata( $releaseIdentifier, $newMetadata, - RedisInstanceIdentifier::primary() + RedisInstanceIdentifier::primary(), ); $this->redisEnumerationRepository->clearDocumentNodesEnumeration($releaseIdentifier); @@ -102,7 +102,7 @@ public function enumerateGivenNodesAndStoreInRedis( $nodesToRender = $this->enumerateGivenNodes( $nodeIdentifiers, $contentReleaseLogger, - $newMetadata->getWorkspaceName() ?? 'live' + $newMetadata->getWorkspaceName() ?? 'live', ); // a quick release which renders nothing publishes exactly the release it was copied from - which looks like @@ -113,15 +113,15 @@ public function enumerateGivenNodesAndStoreInRedis( 'None of the given nodes can be published (%s), so content release %s would only repeat the release ' . 'it was built on.', (string) $nodeIdentifiers, - $releaseIdentifier->getIdentifier() + $releaseIdentifier->getIdentifier(), ), - 1786958513 + 1786958513, ); } foreach (GeneratorUtility::createArrayBatch( array_map(static fn(array $nodeToRender): EnumeratedNode => $nodeToRender[1], $nodesToRender), - 100 + 100, ) as $enumeration) { $this->concurrentBuildLockService->assertNoOtherContentReleaseWasStarted($releaseIdentifier); $this->redisEnumerationRepository->addDocumentNodesToEnumeration($releaseIdentifier, ...$enumeration); @@ -150,7 +150,7 @@ public function enumerateGivenNodesAndStoreInRedis( private function writeChangedUrls( array $nodesToRender, ContentReleaseIdentifier $releaseIdentifier, - ContentReleaseLogger $contentReleaseLogger + ContentReleaseLogger $contentReleaseLogger, ): void { $changedUrls = []; foreach ($nodesToRender as [$node, $enumeratedNode]) { @@ -160,7 +160,7 @@ private function writeChangedUrls( $this->contentReleaseScope->setChangedUrls($releaseIdentifier, $changedUrls); $contentReleaseLogger->info('Content release is scoped to the URLs it renders', [ - 'changedUrls' => $changedUrls + 'changedUrls' => $changedUrls, ]); } @@ -172,7 +172,7 @@ private function writeChangedUrls( private function enumerateGivenNodes( NodeIdentifiers $nodeIdentifiers, ContentReleaseLogger $contentReleaseLogger, - string $workspaceName + string $workspaceName, ): array { $nodesToRender = []; @@ -193,7 +193,7 @@ private function enumerateGivenNodes( if ($skipReason !== null) { // warn rather than debug: somebody asked for this node by hand and will not see it change $contentReleaseLogger->warn('Skipping node from publishing, because it is ' . $skipReason, [ - 'node' => $contextPath + 'node' => $contextPath, ]); continue; } @@ -201,7 +201,7 @@ private function enumerateGivenNodes( $contentReleaseLogger->info('Registering node for publishing', ['node' => $contextPath]); foreach ($this->nodeRenderingExtensionManager->enumerateDocumentNode( - $nodeToEnumerate + $nodeToEnumerate, ) as $enumeratedNode) { $nodesToRender[] = [$nodeToEnumerate, $enumeratedNode]; } @@ -214,7 +214,7 @@ private function enumerateGivenNodes( // nothing at all can be published still fails, in enumerateGivenNodesAndStoreInRedis() $contentReleaseLogger->warn( 'Skipping node from publishing, because it is not found in any site and dimension', - ['node' => $nodeIdentifier] + ['node' => $nodeIdentifier], ); } } @@ -230,7 +230,7 @@ private function enumerateGivenNodes( private function flushContentCacheForNode( NodeInterface $node, string $nodeIdentifier, - ContentReleaseLogger $contentReleaseLogger + ContentReleaseLogger $contentReleaseLogger, ): void { $flushedEntriesCount = 0; foreach ($this->cachingHelper->nodeTag($node) as $tag) { @@ -240,7 +240,7 @@ private function flushContentCacheForNode( $contentReleaseLogger->info(sprintf( 'Flushed %d content cache entries for node %s before re-rendering it', $flushedEntriesCount, - $nodeIdentifier + $nodeIdentifier, )); } } diff --git a/Classes/QuickPublish/QuickPublishPreviewService.php b/Classes/QuickPublish/QuickPublishPreviewService.php index b01bcbf..4f1e330 100644 --- a/Classes/QuickPublish/QuickPublishPreviewService.php +++ b/Classes/QuickPublish/QuickPublishPreviewService.php @@ -44,11 +44,11 @@ public function preview(NodeIdentifiers $nodeIdentifiers, ControllerContext $con $rows[] = QuickPublishPreviewRow::forNode( $nodeIdentifier, $node->getLabel(), - $node instanceof TraversableNodeInterface ? (string)$node->findNodePath() : '', + $node instanceof TraversableNodeInterface ? (string) $node->findNodePath() : '', self::describeDimensions($node), $node->getNodeType()->getName(), $this->backendUri($node, $controllerContext), - $this->documentNodeFilter->skipReasonForNamedNode($node, $siteNode) + $this->documentNodeFilter->skipReasonForNamedNode($node, $siteNode), ); } @@ -70,8 +70,7 @@ public function countPublishedRows(array $rows): int private function backendUri(NodeInterface $node, ControllerContext $controllerContext): string { - return $controllerContext - ->getUriBuilder() + return $controllerContext->getUriBuilder() ->reset() ->uriFor('index', ['node' => $node->getContextPath()], 'Backend', 'Neos.Neos.Ui'); } diff --git a/Classes/ReleaseSwitch/Infrastructure/RedisReleaseSwitchService.php b/Classes/ReleaseSwitch/Infrastructure/RedisReleaseSwitchService.php index 4b9d272..2663946 100644 --- a/Classes/ReleaseSwitch/Infrastructure/RedisReleaseSwitchService.php +++ b/Classes/ReleaseSwitch/Infrastructure/RedisReleaseSwitchService.php @@ -51,7 +51,7 @@ class RedisReleaseSwitchService public function switchContentRelease( RedisInstanceIdentifier $redisInstanceIdentifier, ContentReleaseIdentifier $contentReleaseIdentifier, - ContentReleaseLogger $contentReleaseLogger + ContentReleaseLogger $contentReleaseLogger, ) { $redis = $this->redisClient->getRedis($redisInstanceIdentifier); $current = $redis->get('contentStore:current'); @@ -61,12 +61,12 @@ public function switchContentRelease( if (!in_array($contentReleaseIdentifier->getIdentifier(), $redis->zRevRangeByLex( 'contentStore:registeredReleases', '+', - '-' + '-', ))) { $contentReleaseLogger->error( 'Content release identifier ' . $contentReleaseIdentifier->getIdentifier() - . ' is not listed in current releases thus we do not switch.' + . ' is not listed in current releases thus we do not switch.', ); return; } @@ -77,11 +77,11 @@ public function switchContentRelease( if ($requiredPostfix->shouldTransfer($redisInstanceIdentifier)) { $key = $this->redisKeyService->getRedisKeyForPostfix( $contentReleaseIdentifier, - $requiredPostfix->getRedisKeyPostfix() + $requiredPostfix->getRedisKeyPostfix(), ); if (!$redis->exists($key)) { $contentReleaseLogger->error( - 'Required redis key ' . $key . ' does not exist for release thus we do not switch.' + 'Required redis key ' . $key . ' does not exist for release thus we do not switch.', ); $hasError = true; } @@ -99,14 +99,14 @@ public function switchContentRelease( $this->redisContentReleaseService->setContentReleaseMetadata( $contentReleaseIdentifier, $releaseMetadata->withSwitchTime(new \DateTimeImmutable()), - $redisInstanceIdentifier + $redisInstanceIdentifier, ); $contentReleaseLogger->info(sprintf( 'Switched redis %s from content release %s to %s', $redisInstanceIdentifier->getIdentifier(), $current, - $contentReleaseIdentifier->getIdentifier() + $contentReleaseIdentifier->getIdentifier(), )); } diff --git a/Classes/Transfer/ContentReleaseCleaner.php b/Classes/Transfer/ContentReleaseCleaner.php index c97e01a..f7855c6 100644 --- a/Classes/Transfer/ContentReleaseCleaner.php +++ b/Classes/Transfer/ContentReleaseCleaner.php @@ -60,18 +60,18 @@ class ContentReleaseCleaner public function removeOldReleases( RedisInstanceIdentifier $redisInstanceIdentifier, ContentReleaseIdentifier $contentReleaseIdentifierOfUpcomingRelease, - ContentReleaseLogger $contentReleaseLogger + ContentReleaseLogger $contentReleaseLogger, ): void { $contentReleaseLogger->info( 'Removing old releases in Redis ' . $redisInstanceIdentifier->getIdentifier() - . '. First, checking which releases to keep:' + . '. First, checking which releases to keep:', ); $currentRelease = $this->redisReleaseSwitchService->getCurrentRelease($redisInstanceIdentifier); if (!$currentRelease) { $contentReleaseLogger->error( - 'We did not find a current release in Content Store; so to be safe, we will NOT remove anything.' + 'We did not find a current release in Content Store; so to be safe, we will NOT remove anything.', ); return; } @@ -103,7 +103,7 @@ public function removeOldReleases( // -> We accept potential Redis out of memory errors in this case. if ( $this->redisContentReleaseService->fetchMetadataForContentRelease( - $id + $id, )->getStatus()->getStatus() === NodeRenderingCompletionStatus::success()->getStatus() && count($this->redisRenderingErrorManager->getRenderingErrors($id)) === 0 ) { @@ -113,7 +113,7 @@ public function removeOldReleases( // we always want to keep $currentRelease and $contentReleaseIdentifierOfUpcomingRelease; thus // we need to remove 2 from $contentReleasesToKeep - $shouldRemoveRelease = $healthyReleaseCounter > ( $contentReleasesToKeep - 2 ); + $shouldRemoveRelease = $healthyReleaseCounter > ($contentReleasesToKeep - 2); if ($shouldRemoveRelease) { $releasesToRemove[] = $id; @@ -137,14 +137,14 @@ public function removeOldReleases( public function removeRelease( ContentReleaseIdentifier $contentReleaseIdentifierToRemove, RedisInstanceIdentifier $redisIdentifier, - ContentReleaseLogger $contentReleaseLogger + ContentReleaseLogger $contentReleaseLogger, ) { $redis = $this->redisClientManager->getRedis($redisIdentifier); $currentRelease = $this->redisReleaseSwitchService->getCurrentRelease($redisIdentifier); if (!$currentRelease) { $contentReleaseLogger->error( - 'We did not find a current release in Content Store; so to be safe, we will NOT remove anything.' + 'We did not find a current release in Content Store; so to be safe, we will NOT remove anything.', ); return; } @@ -159,7 +159,7 @@ public function removeRelease( foreach ($redisKeyPostfixesForEachRelease->getRedisKeyPostfixes() as $redisKeyPostfix) { $redisKey = $this->redisKeyService->getRedisKeyForPostfix( $contentReleaseIdentifierToRemove, - $redisKeyPostfix->getRedisKeyPostfix() + $redisKeyPostfix->getRedisKeyPostfix(), ); $contentReleaseLogger->debug(' - Removing ' . $redisKey); $redis->del($redisKey); diff --git a/Classes/Transfer/ContentReleaseSynchronizer.php b/Classes/Transfer/ContentReleaseSynchronizer.php index 5e85160..98713b4 100644 --- a/Classes/Transfer/ContentReleaseSynchronizer.php +++ b/Classes/Transfer/ContentReleaseSynchronizer.php @@ -38,11 +38,11 @@ class ContentReleaseSynchronizer public function syncToTarget( RedisInstanceIdentifier $targetRedisIdentifier, ContentReleaseIdentifier $contentReleaseIdentifier, - ContentReleaseLogger $contentReleaseLogger + ContentReleaseLogger $contentReleaseLogger, ): void { $contentReleaseLogger->info( 'Syncing Content Release ' . $contentReleaseIdentifier->getIdentifier() . ' to target ' - . $targetRedisIdentifier->getIdentifier() + . $targetRedisIdentifier->getIdentifier(), ); if ($targetRedisIdentifier->isPrimary()) { @@ -58,7 +58,7 @@ public function syncToTarget( foreach ($redisKeyPostfixesForEachRelease->getKeysToTransfer($targetRedisIdentifier) as $redisKeyPostfix) { $redisKey = $this->redisKeyService->getRedisKeyForPostfix( $contentReleaseIdentifier, - $redisKeyPostfix->getRedisKeyPostfix() + $redisKeyPostfix->getRedisKeyPostfix(), ); $contentReleaseLogger->info($redisKey); if ($redisKeyPostfix->isRequired() && !$sourceRedis->exists($redisKey)) { @@ -72,9 +72,9 @@ public function syncToTarget( $targetRedis, $this->redisKeyService->getRedisKeyForPostfix( $contentReleaseIdentifier, - $redisKeyPostfix->getRedisKeyPostfix() + $redisKeyPostfix->getRedisKeyPostfix(), ), - $contentReleaseLogger + $contentReleaseLogger, ); } else { $this->transferKey( @@ -82,9 +82,9 @@ public function syncToTarget( $targetRedis, $this->redisKeyService->getRedisKeyForPostfix( $contentReleaseIdentifier, - $redisKeyPostfix->getRedisKeyPostfix() + $redisKeyPostfix->getRedisKeyPostfix(), ), - $contentReleaseLogger + $contentReleaseLogger, ); } } @@ -101,20 +101,20 @@ protected function transferKey( \Redis $sourceRedis, \Redis $targetRedis, string $keyToTransfer, - ContentReleaseLogger $contentReleaseLogger + ContentReleaseLogger $contentReleaseLogger, ) { $contentReleaseLogger->debug('SYNC: Attempting to transfer ' . $keyToTransfer); if (!$sourceRedis->exists($keyToTransfer)) { $contentReleaseLogger->info( - 'SYNC: Skipping ' . $keyToTransfer . ', as it does not exist on the source side' + 'SYNC: Skipping ' . $keyToTransfer . ', as it does not exist on the source side', ); return; } if ($targetRedis->exists($keyToTransfer)) { $contentReleaseLogger->warn( - 'SYNC: Skipping ' . $keyToTransfer . ', as it DOES exist on the target side (and we do not override!)' + 'SYNC: Skipping ' . $keyToTransfer . ', as it DOES exist on the target side (and we do not override!)', ); return; } @@ -130,7 +130,7 @@ protected function transferKey( $keyToTransfer, strlen($serializedValue), $exportTime - $startTime, - $importTime - $exportTime + $importTime - $exportTime, )); } @@ -138,13 +138,13 @@ protected function transferHashKeyIncrementally( \Redis $sourceRedis, \Redis $targetRedis, string $keyToTransfer, - ContentReleaseLogger $contentReleaseLogger + ContentReleaseLogger $contentReleaseLogger, ) { $contentReleaseLogger->debug('SYNC: (INCREMENTAL) Attempting to transfer ' . $keyToTransfer); if (!$sourceRedis->exists($keyToTransfer)) { $contentReleaseLogger->info( - 'SYNC: (INCREMENTAL) Skipping ' . $keyToTransfer . ', as it does not exist on the source side' + 'SYNC: (INCREMENTAL) Skipping ' . $keyToTransfer . ', as it does not exist on the source side', ); return; } @@ -152,7 +152,7 @@ protected function transferHashKeyIncrementally( $contentReleaseLogger->warn( 'SYNC: (INCREMENTAL) WARNING: ' . $keyToTransfer - . ', exists on the target side; we try to copy all values into it.' + . ', exists on the target side; we try to copy all values into it.', ); } @@ -161,13 +161,13 @@ protected function transferHashKeyIncrementally( 'SYNC: (INCREMENTAL) !!! transferHashKeyIncrementally should only be used with hashes, but ' . $keyToTransfer . ' is of type ' - . $sourceRedis->type($keyToTransfer) + . $sourceRedis->type($keyToTransfer), ); throw new \RuntimeException( '!!! transferHashKeyIncrementally should only be used with hashes, but ' . $keyToTransfer . ' is of type ' - . $sourceRedis->type($keyToTransfer) + . $sourceRedis->type($keyToTransfer), ); } @@ -203,7 +203,7 @@ protected function transferHashKeyIncrementally( . ' - expected ' . $expectedNumberOfHashItems . ', actual: ' - . $actualNumberOfHashItems + . $actualNumberOfHashItems, ); throw new \RuntimeException( '!!!! Number of hash items mismatch for key ' @@ -211,7 +211,7 @@ protected function transferHashKeyIncrementally( . ' - expected ' . $expectedNumberOfHashItems . ', actual: ' - . $actualNumberOfHashItems + . $actualNumberOfHashItems, ); } @@ -220,7 +220,7 @@ protected function transferHashKeyIncrementally( $keyToTransfer, $actualNumberOfHashItems, $numberOfBatches, - $endTime - $startTime + $endTime - $startTime, )); } } diff --git a/Classes/Transfer/Dto/RedisKeyPostfixForEachRelease.php b/Classes/Transfer/Dto/RedisKeyPostfixForEachRelease.php index bafe7f8..5b652f2 100644 --- a/Classes/Transfer/Dto/RedisKeyPostfixForEachRelease.php +++ b/Classes/Transfer/Dto/RedisKeyPostfixForEachRelease.php @@ -34,7 +34,7 @@ private function __construct( $transfer, string $transferMode, bool $isRequired, - bool $copyOnQuickRelease + bool $copyOnQuickRelease, ) { if (!in_array($transferMode, [self::TRANSFER_MODE_HASH_INCREMENTAL, self::TRANSFER_MODE_DUMP])) { throw new \RuntimeException('TransferMode ' . $transferMode . ' not supported.'); @@ -42,7 +42,7 @@ private function __construct( if (is_bool($transfer)) { $this->transfer = [ - '*' => $transfer + '*' => $transfer, ]; } else { $this->transfer = $transfer; @@ -64,7 +64,7 @@ public static function fromArray(array $in): self // keys registered before quick releases existed do not carry the flag, and not copying them is the safe // default: a key which should have been copied shows up as missing content, a key which should not have // been copied describes a different release - $in['copyOnQuickRelease'] ?? false + $in['copyOnQuickRelease'] ?? false, ); } diff --git a/Classes/Transfer/Resource/RemoteResourceSynchronizer.php b/Classes/Transfer/Resource/RemoteResourceSynchronizer.php index dc62ab5..ca67df9 100644 --- a/Classes/Transfer/Resource/RemoteResourceSynchronizer.php +++ b/Classes/Transfer/Resource/RemoteResourceSynchronizer.php @@ -36,7 +36,7 @@ public function synchronize(ContentReleaseLogger $logger): void 'follow_symlinks' => true, 'times' => true, 'recursive' => true, - 'show_output' => false + 'show_output' => false, ]); $logger->debug('Syncing resources from ' . $origin); @@ -64,7 +64,7 @@ public function synchronize(ContentReleaseLogger $logger): void if ($port !== 22) { // NOTE: it seems that when using setSshOptions, we also need to specify host and username etc... This is not yet done, as we normally run on port 22. $rsync->setSshOptions([ - 'port' => $port + 'port' => $port, ]); } diff --git a/Classes/Transfer/Resource/Target/MultisiteFileSystemSymlinkTarget.php b/Classes/Transfer/Resource/Target/MultisiteFileSystemSymlinkTarget.php index e5ca375..ef9458f 100644 --- a/Classes/Transfer/Resource/Target/MultisiteFileSystemSymlinkTarget.php +++ b/Classes/Transfer/Resource/Target/MultisiteFileSystemSymlinkTarget.php @@ -25,7 +25,7 @@ class MultisiteFileSystemSymlinkTarget extends FileSystemSymlinkTarget */ public static function injectBaseUriIntoRelevantResourcePublishingTargets( string $baseUri, - ResourceManager $resourceManager + ResourceManager $resourceManager, ) { // Make sure the base URI ends with a slash $baseUri = rtrim($baseUri, '/') . '/'; diff --git a/Classes/Utility/GeneratorUtility.php b/Classes/Utility/GeneratorUtility.php index 28b63a2..8dc4f7f 100644 --- a/Classes/Utility/GeneratorUtility.php +++ b/Classes/Utility/GeneratorUtility.php @@ -19,7 +19,7 @@ public static function createArrayBatch(iterable $iterable, int $chunkSize): ite foreach ($iterable as $item) { $i++; $accumulator[] = $item; - if (( $i % $chunkSize ) === 0) { + if (($i % $chunkSize) === 0) { yield $accumulator; $accumulator = []; diff --git a/Classes/Utility/Sparkline.php b/Classes/Utility/Sparkline.php index e4ce553..67c3cd1 100644 --- a/Classes/Utility/Sparkline.php +++ b/Classes/Utility/Sparkline.php @@ -21,7 +21,7 @@ private static function getY($max, $height, $diff, $value) return round(floatval($height + $diff), 2); } - return round(floatval($height - ( ( $value * $height ) / $max ) + $diff), 2); + return round(floatval($height - (($value * $height) / $max) + $diff), 2); } private static function buildElement($tag, $attrs) @@ -39,7 +39,7 @@ public static function sparkline( $values, $lineColor = '#aaa', $fillColor = 'none', - $options = null + $options = null, ): string { if (count($values) <= 1) { return ''; @@ -56,7 +56,7 @@ public static function sparkline( $strokeWidth = $options['strokeWidth']; $width = $options['width']; $fullHeight = $options['height']; - $height = $fullHeight - ( $strokeWidth * 2 ); + $height = $fullHeight - ($strokeWidth * 2); $max = max($values); $lastItemIndex = count($values) - 1; $offset = $width / $lastItemIndex; @@ -74,14 +74,14 @@ public static function sparkline( 'd' => $pathCoords, 'fill' => 'none', 'stroke-width' => $strokeWidth, - 'stroke' => $lineColor + 'stroke' => $lineColor, ]); $fillCoords = "{$pathCoords} V {$fullHeight} L 0 {$fullHeight} Z"; $fill = self::buildElement('path', [ 'class' => 'sparkline--fill', 'd' => $fillCoords, 'stroke' => 'none', - 'fill' => $fillColor + 'fill' => $fillColor, ]); $svg .= $fill; $svg .= $path; diff --git a/Tests/Behavior/Features/Bootstrap/FeatureContext.php b/Tests/Behavior/Features/Bootstrap/FeatureContext.php index 8cad297..10fd495 100644 --- a/Tests/Behavior/Features/Bootstrap/FeatureContext.php +++ b/Tests/Behavior/Features/Bootstrap/FeatureContext.php @@ -67,8 +67,9 @@ // The content repository keeps its step definitions in a directory no autoloader knows about, so the file has to be // included by hand. Composer knows where the package was installed, which holds wherever this package itself sits - // inside a Neos installation as well as in a checkout of its own. -require_once InstalledVersions::getInstallPath('neos/content-repository') - . '/Tests/Behavior/Features/Bootstrap/NodeOperationsTrait.php'; +require_once + InstalledVersions::getInstallPath('neos/content-repository') + . '/Tests/Behavior/Features/Bootstrap/NodeOperationsTrait.php'; /** * Features context @@ -281,8 +282,8 @@ public function validatingContentReleaseSucceeds($contentReleaseIdentifier) Assert::assertCount( 0, $redisRenderingErrorManager->getRenderingErrors(ContentReleaseIdentifier::fromString( - $contentReleaseIdentifier - )) + $contentReleaseIdentifier, + )), ); } @@ -316,7 +317,7 @@ private function copyContentRelease($sourceContentReleaseIdentifier, $targetCont $bufferedOutput = new BufferedOutput(); $contentReleaseLogger = ContentReleaseLogger::fromSymfonyOutput( $bufferedOutput, - $targetContentReleaseIdentifier + $targetContentReleaseIdentifier, ); try { @@ -324,7 +325,7 @@ private function copyContentRelease($sourceContentReleaseIdentifier, $targetCont RedisInstanceIdentifier::primary(), $sourceContentReleaseIdentifier, $targetContentReleaseIdentifier, - $contentReleaseLogger + $contentReleaseLogger, ); } finally { echo $bufferedOutput->fetch(); @@ -364,7 +365,7 @@ private function enumerateGivenNodes($nodeIdentifiers, $contentReleaseIdentifier $quickPublishNodeEnumerator->enumerateGivenNodesAndStoreInRedis( NodeIdentifiers::fromCommaSeparatedString($nodeIdentifiers), $contentReleaseLogger, - $contentReleaseIdentifier + $contentReleaseIdentifier, ); } finally { echo $bufferedOutput->fetch(); @@ -400,12 +401,12 @@ public function theEnumerationContainsNode($contentReleaseIdentifier, $expectedC $redisEnumerationRepository = $this->getObjectManager()->get(RedisEnumerationRepository::class); $iterable = $redisEnumerationRepository->findAll($contentReleaseIdentifier); $enumerationAsArray = iterator_to_array( - ( function () use ($iterable) { + (function () use ($iterable) { yield from $iterable; - } )() + })(), ); - Assert::assertCount((int)$expectedCount, $enumerationAsArray); + Assert::assertCount((int) $expectedCount, $enumerationAsArray); } /** @@ -419,11 +420,11 @@ public function iRunTheRenderOrchestratorControlLoopOnceForContentRelease($conte $this->renderOrchestratorProcessBufferedOutput = new BufferedOutput(); $contentReleaseLogger = ContentReleaseLogger::fromSymfonyOutput( $this->renderOrchestratorProcessBufferedOutput, - $contentReleaseIdentifier + $contentReleaseIdentifier, ); $this->renderOrchestratorProcess = InterruptibleProcessRuntime::createForTesting($nodeRenderOrchestrator->renderContentRelease( $contentReleaseIdentifier, - $contentReleaseLogger + $contentReleaseLogger, )); $this->renderOrchestratorProcessLastEvent = $this->renderOrchestratorProcess->runUntilEventEncountered(RenderingQueueFilledEvent::class); @@ -446,18 +447,18 @@ public function iExpectTheRenderOrchestratorControlLoopToExitWithStatusCode($exp { Assert::assertNotNull( $this->renderOrchestratorProcessLastEvent, - 'renderOrchestratorProcessLastEvent cannot be null' + 'renderOrchestratorProcessLastEvent cannot be null', ); Assert::assertInstanceOf( ExitEvent::class, $this->renderOrchestratorProcessLastEvent, - 'renderOrchestratorProcessLastEvent needs to be an ExitEvent' + 'renderOrchestratorProcessLastEvent needs to be an ExitEvent', ); assert($this->renderOrchestratorProcessLastEvent instanceof ExitEvent); Assert::assertEquals( $expectedStatusCode, $this->renderOrchestratorProcessLastEvent->getStatusCode(), - 'Status Code Mismatch' + 'Status Code Mismatch', ); } @@ -469,8 +470,7 @@ public function iExpectTheContentReleaseToHaveTheCompletionStatusFailed($content $contentReleaseIdentifier = ContentReleaseIdentifier::fromString($contentReleaseIdentifier); $redisContentReleaseService = $this->objectManager->get(RedisContentReleaseService::class); assert($redisContentReleaseService instanceof RedisContentReleaseService); - $renderStatus = $redisContentReleaseService - ->fetchMetadataForContentRelease($contentReleaseIdentifier) + $renderStatus = $redisContentReleaseService->fetchMetadataForContentRelease($contentReleaseIdentifier) ->getStatus(); Assert::isTrue($renderStatus->isFailed(), 'Completion Status should be failed'); Assert::isFalse($renderStatus->isSuccessful(), 'Completion Status should not be successful'); @@ -484,8 +484,7 @@ public function iExpectTheContentReleaseToHaveTheCompletionStatusSuccess($conten $contentReleaseIdentifier = ContentReleaseIdentifier::fromString($contentReleaseIdentifier); $redisContentReleaseService = $this->objectManager->get(RedisContentReleaseService::class); assert($redisContentReleaseService instanceof RedisContentReleaseService); - $renderStatus = $redisContentReleaseService - ->fetchMetadataForContentRelease($contentReleaseIdentifier) + $renderStatus = $redisContentReleaseService->fetchMetadataForContentRelease($contentReleaseIdentifier) ->getStatus(); Assert::isTrue($renderStatus->isSuccessful(), 'Completion Status should be success'); Assert::isFalse($renderStatus->isFailed(), 'Completion Status should not be failed'); @@ -505,7 +504,7 @@ public function iRunTheRendererForContentReleaseUntilTheQueueIsEmpty($contentRel $renderProcess = InterruptibleProcessRuntime::createForTesting($nodeRenderer->render( $contentReleaseIdentifier, $contentReleaseLogger, - RendererIdentifier::fromString('rdr') + RendererIdentifier::fromString('rdr'), )); $renderProcess->runUntilEventEncountered(QueueEmptyEvent::class); @@ -526,7 +525,7 @@ public function iRunTheRendererForContentReleaseForRenders($contentReleaseIdenti $renderProcess = InterruptibleProcessRuntime::createForTesting($nodeRenderer->render( $contentReleaseIdentifier, $contentReleaseLogger, - RendererIdentifier::fromString('rdr') + RendererIdentifier::fromString('rdr'), )); for ($i = 0; $i < $expectedRenderCount; $i++) { @@ -562,7 +561,7 @@ public function duringRenderingOfContentReleaseSomeErrorsOccured($contentRelease $contentReleaseIdentifier = ContentReleaseIdentifier::fromString($contentReleaseIdentifier); $redisRenderingErrorManager = $this->getObjectManager()->get(RedisRenderingErrorManager::class); $renderingErrors = $redisRenderingErrorManager->getRenderingErrors($contentReleaseIdentifier); - Assert::assertCount((int)$expectedNumberOfErrors, $renderingErrors); + Assert::assertCount((int) $expectedNumberOfErrors, $renderingErrors); } private const DEFAULT_NODETYPES_CONFIG = << 0) { $configuration = Arrays::arrayMergeRecursiveOverrule( $this->nodeTypesConfiguration, - Yaml::parse($nodeTypesConfiguration->getRaw()) + Yaml::parse($nodeTypesConfiguration->getRaw()), ); } else { $combined = self::DEFAULT_NODETYPES_CONFIG . $nodeTypesConfiguration->getRaw(); $this->nodeTypesConfiguration = Yaml::parse( - self::DEFAULT_NODETYPES_CONFIG . $nodeTypesConfiguration->getRaw() + self::DEFAULT_NODETYPES_CONFIG . $nodeTypesConfiguration->getRaw(), ); $configuration = $this->nodeTypesConfiguration; } @@ -611,7 +610,7 @@ public function iExpectTheContentReleaseToContainTheFollowingContentForUriAtCssS $contentReleaseIdentifier, $uri, $cssSelector, - PyStringNode $expected + PyStringNode $expected, ) { $contentReleaseIdentifier = ContentReleaseIdentifier::fromString($contentReleaseIdentifier); $redisClient = $this->getObjectManager()->get(RedisClientManager::class); @@ -619,7 +618,7 @@ public function iExpectTheContentReleaseToContainTheFollowingContentForUriAtCssS $actualContent = $redisClient->getPrimaryRedis()->hGet( $redisKeyService->getRedisKeyForPostfix($contentReleaseIdentifier, 'renderedDocuments'), - $uri + $uri, ); Assert::assertIsString($actualContent, 'Did not find rendered document'); $actualContentDecompressed = gzdecode($actualContent); @@ -636,7 +635,7 @@ public function iExpectTheContentReleaseToContainTheFollowingHtmlContentForUriAt $contentReleaseIdentifier, $uri, $cssSelector, - PyStringNode $expected + PyStringNode $expected, ) { $contentReleaseIdentifier = ContentReleaseIdentifier::fromString($contentReleaseIdentifier); $redisClient = $this->getObjectManager()->get(RedisClientManager::class); @@ -644,7 +643,7 @@ public function iExpectTheContentReleaseToContainTheFollowingHtmlContentForUriAt $actualContent = $redisClient->getPrimaryRedis()->hGet( $redisKeyService->getRedisKeyForPostfix($contentReleaseIdentifier, 'renderedDocuments'), - $uri + $uri, ); Assert::assertIsString($actualContent, 'Did not find rendered document'); $actualContentDecompressed = gzdecode($actualContent); @@ -664,7 +663,7 @@ public function iExpectTheContentReleaseToNotContainAnythingForUri($contentRelea $redisKeyService = $this->getObjectManager()->get(RedisKeyService::class); $actualContent = $redisClient->getPrimaryRedis()->hGet( $redisKeyService->getRedisKeyForPostfix($contentReleaseIdentifier, 'renderedDocuments'), - $uri + $uri, ); Assert::assertFalse($actualContent); } diff --git a/Tests/Behavior/Fixtures/StubPrunnerApiService.php b/Tests/Behavior/Fixtures/StubPrunnerApiService.php index e8d0e2c..1768cf8 100644 --- a/Tests/Behavior/Fixtures/StubPrunnerApiService.php +++ b/Tests/Behavior/Fixtures/StubPrunnerApiService.php @@ -16,13 +16,13 @@ class StubPrunnerApiService extends PrunnerApiService public function schedulePipeline( PipelineName $pipeline, array $variables, - ?QueuePartitionName $queuePartition = null + ?QueuePartitionName $queuePartition = null, ): JobId { $this->calls[] = [ 'method' => 'schedulePipeline', 'pipeline' => $pipeline, 'variables' => $variables, - 'queuePartition' => $queuePartition + 'queuePartition' => $queuePartition, ]; return JobId::create('STUB' . count($this->calls)); diff --git a/Tests/Unit/BackendUi/AutomaticReleaseStatusDataSourceTest.php b/Tests/Unit/BackendUi/AutomaticReleaseStatusDataSourceTest.php index ea8a7df..b57bb85 100644 --- a/Tests/Unit/BackendUi/AutomaticReleaseStatusDataSourceTest.php +++ b/Tests/Unit/BackendUi/AutomaticReleaseStatusDataSourceTest.php @@ -23,7 +23,7 @@ public function testTheIdentifierIsTheOneTheContentModuleScriptRequests(): void { self::assertSame( 'flowpack-decoupledcontentstore-automatic-release-status', - AutomaticReleaseStatusDataSource::getIdentifier() + AutomaticReleaseStatusDataSource::getIdentifier(), ); } @@ -38,15 +38,15 @@ public function testTheWarningIsPublishedAsAReadyMadeMessage(): void $pauseState = AutomaticReleasePauseState::fromRedisHash([ 'pausedAt' => '2026-08-13T09:15:00+02:00', 'accountId' => 'admin', - 'suppressedReleaseCount' => '4' + 'suppressedReleaseCount' => '4', ]); self::assertSame( [ 'paused' => true, - 'message' => 'translated: automaticReleases.paused.contentModuleWarning' + 'message' => 'translated: automaticReleases.paused.contentModuleWarning', ], - $this->buildDataSource($pauseState)->getData() + $this->buildDataSource($pauseState)->getData(), ); } @@ -54,12 +54,11 @@ public function testTheTimestampAndTheWaitingCountAreHandedToTheTranslation(): v { $pauseState = AutomaticReleasePauseState::fromRedisHash([ 'pausedAt' => '2026-08-13T09:15:00+02:00', - 'suppressedReleaseCount' => '4' + 'suppressedReleaseCount' => '4', ]); $translator = $this->createMock(Translator::class); - $translator - ->expects(self::once()) + $translator->expects(self::once()) ->method('translateById') ->with( 'automaticReleases.paused.contentModuleWarning', @@ -67,7 +66,7 @@ public function testTheTimestampAndTheWaitingCountAreHandedToTheTranslation(): v null, null, 'Main', - 'Flowpack.DecoupledContentStore' + 'Flowpack.DecoupledContentStore', ); $this->buildDataSource($pauseState, $translator)->getData(); @@ -75,15 +74,14 @@ public function testTheTimestampAndTheWaitingCountAreHandedToTheTranslation(): v private function buildDataSource( ?AutomaticReleasePauseState $pauseState, - ?Translator $translator = null + ?Translator $translator = null, ): AutomaticReleaseStatusDataSource { $automaticReleaseSwitchService = $this->createMock(AutomaticReleaseSwitchService::class); $automaticReleaseSwitchService->method('getPauseState')->willReturn($pauseState); if ($translator === null) { $translator = $this->createMock(Translator::class); - $translator - ->method('translateById') + $translator->method('translateById') ->willReturnCallback(static fn(string $labelId): string => 'translated: ' . $labelId); } diff --git a/Tests/Unit/ContentReleaseManagerTest.php b/Tests/Unit/ContentReleaseManagerTest.php index e613bcf..c5705ee 100644 --- a/Tests/Unit/ContentReleaseManagerTest.php +++ b/Tests/Unit/ContentReleaseManagerTest.php @@ -94,8 +94,8 @@ public function testAQuickReleaseIsScheduledEvenWhilePaused(): void static fn(array $variables): bool => ( $variables['currentContentReleaseId'] === '5' && $variables['quickPublishNodeIdentifiers'] === self::NODE_IDENTIFIER - ) - ) + ), + ), ); $this->buildContentReleaseManager()->startQuickContentRelease($this->nodeIdentifiers()); @@ -169,7 +169,7 @@ private function nodeIdentifiers(): NodeIdentifiers private function jobsResponse( string $pipeline, bool $started, - bool $canceled = false + bool $canceled = false, ): PipelinesAndJobsResponse { return PipelinesAndJobsResponse::fromJsonArray([ 'pipelines' => [], @@ -183,9 +183,9 @@ private function jobsResponse( 'errored' => false, 'created' => '2026-08-17T10:00:00+02:00', 'start' => $started ? '2026-08-17T10:00:01+02:00' : null, - 'user' => 'test' - ] - ] + 'user' => 'test', + ], + ], ]); } diff --git a/Tests/Unit/Core/AutomaticReleaseSwitchServiceTest.php b/Tests/Unit/Core/AutomaticReleaseSwitchServiceTest.php index b573ac1..bcb38fb 100644 --- a/Tests/Unit/Core/AutomaticReleaseSwitchServiceTest.php +++ b/Tests/Unit/Core/AutomaticReleaseSwitchServiceTest.php @@ -37,13 +37,12 @@ public function testASuppressedReleaseIsCountedWithoutEverCreatingTheKey(): void // between the caller's isPaused() check and the count - and pruning never reaches that key $redis = $this->createMock(Redis::class); $redis->expects(self::never())->method('hIncrBy'); - $redis - ->expects(self::once()) + $redis->expects(self::once()) ->method('eval') ->with( self::stringContains('HEXISTS'), self::equalTo([self::REDIS_KEY]), - self::equalTo(1) + self::equalTo(1), ); $this->buildService($redis)->countSuppressedRelease(); @@ -63,8 +62,7 @@ public function testPausingRecordsTheTimestampAndAnEmptyCounter(): void { $redis = $this->createMock(Redis::class); $redis->method('hExists')->willReturn(false); - $redis - ->expects(self::once()) + $redis->expects(self::once()) ->method('hMSet') ->with(self::REDIS_KEY, self::callback(static function (array $hash): bool { return ( @@ -88,12 +86,11 @@ public function testThereIsNoPauseStateWhileTheSwitchIsNotSet(): void public function testThePauseStateIsReadFromTheHash(): void { $redis = $this->createMock(Redis::class); - $redis - ->method('hGetAll') + $redis->method('hGetAll') ->willReturn([ 'pausedAt' => '2026-08-13T09:15:00+02:00', 'accountId' => 'admin', - 'suppressedReleaseCount' => '4' + 'suppressedReleaseCount' => '4', ]); $pauseState = $this->buildService($redis)->getPauseState(); diff --git a/Tests/Unit/Core/Domain/ValueObject/AutomaticReleasePauseStateTest.php b/Tests/Unit/Core/Domain/ValueObject/AutomaticReleasePauseStateTest.php index a708512..71c3b36 100644 --- a/Tests/Unit/Core/Domain/ValueObject/AutomaticReleasePauseStateTest.php +++ b/Tests/Unit/Core/Domain/ValueObject/AutomaticReleasePauseStateTest.php @@ -18,7 +18,7 @@ public function testAllFieldsAreReadFromTheHash(): void $pauseState = AutomaticReleasePauseState::fromRedisHash([ 'pausedAt' => '2026-08-13T09:15:00+02:00', 'accountId' => 'admin', - 'suppressedReleaseCount' => '7' + 'suppressedReleaseCount' => '7', ]); self::assertSame('2026-08-13T09:15:00+02:00', $pauseState->getPausedAt()->format(\DateTimeInterface::ATOM)); @@ -32,7 +32,7 @@ public function testAnEmptyAccountIdBecomesNull(): void $pauseState = AutomaticReleasePauseState::fromRedisHash([ 'pausedAt' => '2026-08-13T09:15:00+02:00', 'accountId' => '', - 'suppressedReleaseCount' => '0' + 'suppressedReleaseCount' => '0', ]); self::assertNull($pauseState->getAccountId()); @@ -41,7 +41,7 @@ public function testAnEmptyAccountIdBecomesNull(): void public function testTheCounterDefaultsToZero(): void { $pauseState = AutomaticReleasePauseState::fromRedisHash([ - 'pausedAt' => '2026-08-13T09:15:00+02:00' + 'pausedAt' => '2026-08-13T09:15:00+02:00', ]); self::assertSame(0, $pauseState->getSuppressedReleaseCount()); diff --git a/Tests/Unit/NodeEnumeration/Domain/Service/DocumentNodeFilterTest.php b/Tests/Unit/NodeEnumeration/Domain/Service/DocumentNodeFilterTest.php index 5225144..21f4f93 100644 --- a/Tests/Unit/NodeEnumeration/Domain/Service/DocumentNodeFilterTest.php +++ b/Tests/Unit/NodeEnumeration/Domain/Service/DocumentNodeFilterTest.php @@ -42,7 +42,7 @@ public function testNegatedNodeTypesAreCombinedWithAndInsteadOfOr(): void { self::assertSame( '[instanceof Neos.Neos:Document][!instanceof Neos.Neos:Shortcut]', - self::buildNodeTypeFilter(['Neos.Neos:Document', '!Neos.Neos:Shortcut']) + self::buildNodeTypeFilter(['Neos.Neos:Document', '!Neos.Neos:Shortcut']), ); } @@ -55,7 +55,7 @@ public function testFilterPartsAreNotJoinedByComma(): void 'Neos.Neos:Document', '!Neos.Neos:Shortcut', '!My.Package:Bar', - '!My.Package:Baz' + '!My.Package:Baz', ]); self::assertStringNotContainsString(',', $filter); @@ -64,7 +64,7 @@ public function testFilterPartsAreNotJoinedByComma(): void . '[!instanceof Neos.Neos:Shortcut]' . '[!instanceof My.Package:Bar]' . '[!instanceof My.Package:Baz]', - $filter + $filter, ); } @@ -74,7 +74,7 @@ public function testPositiveFiltersAreOrderedFirstEvenIfConfiguredAfterExclusion // so positive filters must be ordered first regardless of the configured order. self::assertSame( '[instanceof Neos.Neos:Document][!instanceof Neos.Neos:Shortcut]', - self::buildNodeTypeFilter(['!Neos.Neos:Shortcut', 'Neos.Neos:Document']) + self::buildNodeTypeFilter(['!Neos.Neos:Shortcut', 'Neos.Neos:Document']), ); } @@ -83,7 +83,7 @@ public function testSurroundingWhitespaceOfConfiguredEntriesIsIgnored(): void // The "!" is detected after trimming, so a padded exclusion still excludes. self::assertSame( '[instanceof Neos.Neos:Document][!instanceof Neos.Neos:Shortcut]', - self::buildNodeTypeFilter([' Neos.Neos:Document ', "\t!Neos.Neos:Shortcut\n"]) + self::buildNodeTypeFilter([' Neos.Neos:Document ', "\t!Neos.Neos:Shortcut\n"]), ); } @@ -91,7 +91,7 @@ public function testEmptyEntriesAreSkipped(): void { self::assertSame( '[instanceof Neos.Neos:Document]', - self::buildNodeTypeFilter(['Neos.Neos:Document', '', ' ']) + self::buildNodeTypeFilter(['Neos.Neos:Document', '', ' ']), ); } @@ -100,7 +100,7 @@ public function testExclusionOnlyWhitelistFallsBackToTheDefaultNodeType(): void // Without a positive filter, find() would throw exception 1436884196. self::assertSame( '[instanceof Neos.Neos:Document][!instanceof Neos.Neos:Shortcut]', - self::buildNodeTypeFilter(['!Neos.Neos:Shortcut']) + self::buildNodeTypeFilter(['!Neos.Neos:Shortcut']), ); } @@ -119,7 +119,7 @@ public function testADocumentBelowAHiddenPageIsNotPublished(): void self::assertSame( 'below a hidden page', - $this->buildDocumentNodeFilter()->skipReasonForNamedNode($node, $siteNode) + $this->buildDocumentNodeFilter()->skipReasonForNamedNode($node, $siteNode), ); } @@ -143,7 +143,7 @@ public function testAPageHiddenByItsDatesRatherThanByItsFlagHidesWhatIsBelowItTo self::assertSame( 'below a hidden page', - $this->buildDocumentNodeFilter()->skipReasonForNamedNode($node, $siteNode) + $this->buildDocumentNodeFilter()->skipReasonForNamedNode($node, $siteNode), ); } diff --git a/Tests/Unit/QuickPublish/ContentReleaseScopeTest.php b/Tests/Unit/QuickPublish/ContentReleaseScopeTest.php index 1775589..63e51c0 100644 --- a/Tests/Unit/QuickPublish/ContentReleaseScopeTest.php +++ b/Tests/Unit/QuickPublish/ContentReleaseScopeTest.php @@ -32,31 +32,29 @@ public function testAReleaseWhichWasRenderedAsAWholeHasNoScope(): void public function testAQuickReleaseIsScopedToTheUrlsItRendered(): void { $redis = $this->createMock(\Redis::class); - $redis - ->method('sMembers') + $redis->method('sMembers') ->with(self::CHANGED_URLS_KEY) ->willReturn([ 'http://test.de/de', - 'http://test.de/de/nested' + 'http://test.de/de/nested', ]); self::assertSame( ['http://test.de/de', 'http://test.de/de/nested'], - $this->buildContentReleaseScope($redis)->getChangedUrls($this->contentReleaseIdentifier()) + $this->buildContentReleaseScope($redis)->getChangedUrls($this->contentReleaseIdentifier()), ); } public function testTheScopeIsStoredWithTheReleaseItBelongsTo(): void { $redis = $this->createMock(\Redis::class); - $redis - ->expects(self::once()) + $redis->expects(self::once()) ->method('sAdd') ->with(self::CHANGED_URLS_KEY, 'http://test.de/de', 'http://test.de/de/nested'); $this->buildContentReleaseScope($redis)->setChangedUrls($this->contentReleaseIdentifier(), [ 'http://test.de/de', - 'http://test.de/de/nested' + 'http://test.de/de/nested', ]); } @@ -76,7 +74,7 @@ public function testPublishedUrlsAreCountedFromTheUrlIndexRatherThanTheEnumerati self::assertSame( 18015, - $this->buildContentReleaseScope($redis)->countPublishedUrls($this->contentReleaseIdentifier()) + $this->buildContentReleaseScope($redis)->countPublishedUrls($this->contentReleaseIdentifier()), ); } @@ -100,15 +98,15 @@ private function buildContentReleaseScope(\Redis $redis): ContentReleaseScope 'transfer' => true, 'transferMode' => 'dump', 'isRequired' => true, - 'copyOnQuickRelease' => true + 'copyOnQuickRelease' => true, ], 'quickPublishChangedUrls' => [ 'redisKeyPostfix' => 'quickPublish:changedUrls', 'transfer' => false, 'transferMode' => 'dump', 'isRequired' => false, - 'copyOnQuickRelease' => false - ] + 'copyOnQuickRelease' => false, + ], ]); $contentReleaseScope = new ContentReleaseScope(); diff --git a/Tests/Unit/QuickPublish/Dto/NodeIdentifiersTest.php b/Tests/Unit/QuickPublish/Dto/NodeIdentifiersTest.php index aa327ad..7661ce0 100644 --- a/Tests/Unit/QuickPublish/Dto/NodeIdentifiersTest.php +++ b/Tests/Unit/QuickPublish/Dto/NodeIdentifiersTest.php @@ -30,7 +30,7 @@ public function testSurroundingWhitespaceAndEmptyEntriesAreIgnored(): void { // the identifiers arrive from a textarea, one per line $nodeIdentifiers = NodeIdentifiers::fromCommaSeparatedString( - ' ' . self::IDENTIFIER . " ,\n,\t" . self::OTHER_IDENTIFIER . ',' + ' ' . self::IDENTIFIER . " ,\n,\t" . self::OTHER_IDENTIFIER . ',', ); self::assertSame([self::IDENTIFIER, self::OTHER_IDENTIFIER], $nodeIdentifiers->jsonSerialize()); @@ -71,7 +71,7 @@ public static function notAnIdentifier(): array 'a node path' => ['/sites/test/products'], 'too short' => ['3239baee-3e7f-785c-0853-f4302ef325'], 'no hyphens' => ['3239baee3e7f785c0853f4302ef32570'], - 'a quoted identifier' => ['"' . self::IDENTIFIER . '"'] + 'a quoted identifier' => ['"' . self::IDENTIFIER . '"'], ]; } @@ -86,7 +86,7 @@ public function testAnEmptyListIsRefused(): void public function testTheBackendFormAcceptsOneIdentifierPerLine(): void { $nodeIdentifiers = NodeIdentifiers::fromUserInput( - ' ' . self::IDENTIFIER . "\r\n\n" . self::OTHER_IDENTIFIER . " \n" + ' ' . self::IDENTIFIER . "\r\n\n" . self::OTHER_IDENTIFIER . " \n", ); self::assertSame([self::IDENTIFIER, self::OTHER_IDENTIFIER], $nodeIdentifiers->jsonSerialize()); @@ -113,7 +113,7 @@ public function testTheListIsHandedToThePipelineAsItWasRead(): void // the pipeline passes it on as a prunner variable self::assertSame( self::IDENTIFIER . ',' . self::OTHER_IDENTIFIER, - (string) NodeIdentifiers::fromCommaSeparatedString(self::IDENTIFIER . ' , ' . self::OTHER_IDENTIFIER) + (string) NodeIdentifiers::fromCommaSeparatedString(self::IDENTIFIER . ' , ' . self::OTHER_IDENTIFIER), ); } } diff --git a/Tests/Unit/QuickPublish/Infrastructure/RedisReleaseCopyServiceTest.php b/Tests/Unit/QuickPublish/Infrastructure/RedisReleaseCopyServiceTest.php index 3d11337..12651f4 100644 --- a/Tests/Unit/QuickPublish/Infrastructure/RedisReleaseCopyServiceTest.php +++ b/Tests/Unit/QuickPublish/Infrastructure/RedisReleaseCopyServiceTest.php @@ -30,7 +30,7 @@ final class RedisReleaseCopyServiceTest extends UnitTestCase private const SOURCE_KEYS = [ 'contentStore:5:data', 'contentStore:5:meta:urls', - 'contentStore:5:renderingJobQueue' + 'contentStore:5:renderingJobQueue', ]; /** @@ -46,9 +46,9 @@ public function testOnlyTheFlaggedKeysAreCopied(): void self::assertSame( [ ['contentStore:5:data', 'contentStore:6:data'], - ['contentStore:5:meta:urls', 'contentStore:6:meta:urls'] + ['contentStore:5:meta:urls', 'contentStore:6:meta:urls'], ], - $this->copiedKeys + $this->copiedKeys, ); } @@ -123,7 +123,7 @@ public function testAReleaseIsNotCopiedOntoItself(): void private function copyRelease( \Redis $redis, RedisContentReleaseService $redisContentReleaseService, - string $targetContentReleaseIdentifier = '6' + string $targetContentReleaseIdentifier = '6', ): void { $redisClientManager = $this->createMock(RedisClientManager::class); $redisClientManager->method('getRedis')->willReturn($redis); @@ -141,7 +141,7 @@ private function copyRelease( RedisInstanceIdentifier::primary(), ContentReleaseIdentifier::fromString('5'), ContentReleaseIdentifier::fromString($targetContentReleaseIdentifier), - ContentReleaseLogger::fromSymfonyOutput(new BufferedOutput(), ContentReleaseIdentifier::fromString('6')) + ContentReleaseLogger::fromSymfonyOutput(new BufferedOutput(), ContentReleaseIdentifier::fromString('6')), ); } @@ -156,8 +156,7 @@ private function buildRedis(array $existingKeys = self::SOURCE_KEYS, string $red $redis->method('exists')->willReturnCallback(static fn(string $key): int => in_array($key, $existingKeys, true) ? 1 : 0); - $redis - ->method('copy') + $redis->method('copy') ->willReturnCallback(function (string $sourceKey, string $targetKey): bool { $this->copiedKeys[] = [$sourceKey, $targetKey]; return true; @@ -170,11 +169,11 @@ private function buildRedis(array $existingKeys = self::SOURCE_KEYS, string $red * @return RedisContentReleaseService&MockObject */ private function buildRedisContentReleaseService( - ?NodeRenderingCompletionStatus $status = null + ?NodeRenderingCompletionStatus $status = null, ): RedisContentReleaseService { $metadata = ContentReleaseMetadata::create( PrunnerJobId::fromString('job'), - new \DateTimeImmutable() + new \DateTimeImmutable(), )->withStatus($status ?? NodeRenderingCompletionStatus::success()); $redisContentReleaseService = $this->createMock(RedisContentReleaseService::class); @@ -194,29 +193,29 @@ private static function keyConfiguration(): array 'transfer' => true, 'transferMode' => 'hash_incremental', 'isRequired' => true, - 'copyOnQuickRelease' => true + 'copyOnQuickRelease' => true, ], 'metaUrls' => [ 'redisKeyPostfix' => 'meta:urls', 'transfer' => true, 'transferMode' => 'dump', 'isRequired' => true, - 'copyOnQuickRelease' => true + 'copyOnQuickRelease' => true, ], 'renderingJobQueue' => [ 'redisKeyPostfix' => 'renderingJobQueue', 'transfer' => false, 'transferMode' => 'dump', 'isRequired' => false, - 'copyOnQuickRelease' => false + 'copyOnQuickRelease' => false, ], 'enumerationDocumentNodes' => [ 'redisKeyPostfix' => 'enumeration:documentNodes', 'transfer' => true, 'transferMode' => 'dump', 'isRequired' => true, - 'copyOnQuickRelease' => false - ] + 'copyOnQuickRelease' => false, + ], ]; } } diff --git a/Tests/Unit/Transfer/Dto/RedisKeyPostfixesForEachReleaseTest.php b/Tests/Unit/Transfer/Dto/RedisKeyPostfixesForEachReleaseTest.php index 7eb1a58..fc1bf37 100644 --- a/Tests/Unit/Transfer/Dto/RedisKeyPostfixesForEachReleaseTest.php +++ b/Tests/Unit/Transfer/Dto/RedisKeyPostfixesForEachReleaseTest.php @@ -17,7 +17,7 @@ public function testOnlyTheFlaggedKeysAreCopied(): void $redisKeyPostfixes = RedisKeyPostfixesForEachRelease::fromArray([ 'renderedDocuments' => self::keyConfiguration('renderedDocuments', true), 'renderingJobQueue' => self::keyConfiguration('renderingJobQueue', false), - 'metaUrls' => self::keyConfiguration('meta:urls', true) + 'metaUrls' => self::keyConfiguration('meta:urls', true), ]); self::assertSame(['renderedDocuments', 'meta:urls'], self::copiedPostfixes($redisKeyPostfixes)); @@ -30,7 +30,7 @@ public function testAKeyWhichDoesNotKnowAboutQuickReleasesIsNotCopied(): void unset($configurationWithoutTheFlag['copyOnQuickRelease']); $redisKeyPostfixes = RedisKeyPostfixesForEachRelease::fromArray([ - 'renderedDocuments' => $configurationWithoutTheFlag + 'renderedDocuments' => $configurationWithoutTheFlag, ]); self::assertSame([], self::copiedPostfixes($redisKeyPostfixes)); @@ -58,7 +58,7 @@ private static function keyConfiguration(string $redisKeyPostfix, bool $copyOnQu 'transfer' => true, 'transferMode' => 'dump', 'isRequired' => true, - 'copyOnQuickRelease' => $copyOnQuickRelease + 'copyOnQuickRelease' => $copyOnQuickRelease, ]; } } diff --git a/mago.toml b/mago.toml new file mode 100644 index 0000000..36a4fc5 --- /dev/null +++ b/mago.toml @@ -0,0 +1,26 @@ +#:schema https://mago.carthage.software/1.46.0/schema.json +# Welcome to Mago! +# For full documentation, see https://mago.carthage.software/1.46.0/en/tools/overview/ +version = "1" +php-version = "8.1.0" + +[source] +workspace = "." +paths = ["Classes/", "Tests/"] +includes = ["vendor"] +excludes = [] + +[source.glob] +literal-separator = true + +[formatter] +preset = "default" +preserve-breaking-member-access-chain = true +preserve-breaking-member-access-chain-first-method-on-same-line = true +preserve-breaking-argument-list = true +preserve-breaking-array-like = true +preserve-breaking-parameter-list = true +preserve-breaking-attribute-list = true +preserve-breaking-conditional-expression = true +preserve-breaking-condition-expression = true +preserve-redundant-logical-binary-expression-parentheses = true