From fce0295e651785716b1f151c2812ae7844eb033d Mon Sep 17 00:00:00 2001 From: Matthias Vogel Date: Tue, 4 Nov 2025 14:50:39 +0100 Subject: [PATCH] [BUGFIX] fix all Implicitly marked null parameter (PHP 8.4) --- Classes/Controller/AbstractFluxController.php | 2 +- .../Form/Transformation/FormDataTransformer.php | 2 +- .../AbstractChimeraConfigurationManager.php | 4 ++-- .../Overrides/LocalizationController.php | 2 +- Classes/Integration/PreviewView.php | 6 +++--- Classes/Provider/ProviderResolver.php | 4 ++-- Tests/Mock/ExpressionBuilder.php | 14 +++++++------- Tests/Mock/QueryBuilder.php | 14 +++++++------- Tests/Unit/Form/AbstractFormTest.php | 2 +- 9 files changed, 25 insertions(+), 25 deletions(-) diff --git a/Classes/Controller/AbstractFluxController.php b/Classes/Controller/AbstractFluxController.php index d8e37b54e..dab515129 100644 --- a/Classes/Controller/AbstractFluxController.php +++ b/Classes/Controller/AbstractFluxController.php @@ -285,7 +285,7 @@ protected function resolveView(): ViewInterface /** * @return \Psr\Http\Message\ResponseInterface|Response */ - protected function createHtmlResponse(string $html = null) + protected function createHtmlResponse(?string $html = null) { if (method_exists($this, 'htmlResponse')) { return parent::htmlResponse($html); diff --git a/Classes/Form/Transformation/FormDataTransformer.php b/Classes/Form/Transformation/FormDataTransformer.php index d2a55ba83..6affbdbbb 100644 --- a/Classes/Form/Transformation/FormDataTransformer.php +++ b/Classes/Form/Transformation/FormDataTransformer.php @@ -46,7 +46,7 @@ public function __construct(FlexFormService $flexFormService, DataTransformerReg */ public function convertFlexFormContentToArray( string $flexFormContent, - Form $form = null, + ?Form $form = null, ?string $languagePointer = 'lDEF', ?string $valuePointer = 'vDEF' ): array { diff --git a/Classes/Integration/Overrides/AbstractChimeraConfigurationManager.php b/Classes/Integration/Overrides/AbstractChimeraConfigurationManager.php index 4e5250635..f901b01b8 100644 --- a/Classes/Integration/Overrides/AbstractChimeraConfigurationManager.php +++ b/Classes/Integration/Overrides/AbstractChimeraConfigurationManager.php @@ -24,8 +24,8 @@ abstract class AbstractChimeraConfigurationManager extends ConfigurationManager public function getConfiguration( string $configurationType, - string $extensionName = null, - string $pluginName = null + ?string $extensionName = null, + ?string $pluginName = null ): array { $configurationManager = $this->resolveConfigurationManager(); diff --git a/Classes/Integration/Overrides/LocalizationController.php b/Classes/Integration/Overrides/LocalizationController.php index a1ee328dd..47b614e68 100644 --- a/Classes/Integration/Overrides/LocalizationController.php +++ b/Classes/Integration/Overrides/LocalizationController.php @@ -24,7 +24,7 @@ class LocalizationController extends \TYPO3\CMS\Backend\Controller\Page\Localiza */ public function getRecordLocalizeSummary( ServerRequestInterface $request, - ResponseInterface $response = null + ?ResponseInterface $response = null ): ResponseInterface { $params = $request->getQueryParams(); if (!isset($params['pageId'], $params['destLanguageId'], $params['languageId'])) { diff --git a/Classes/Integration/PreviewView.php b/Classes/Integration/PreviewView.php index e92606a56..fcf810678 100644 --- a/Classes/Integration/PreviewView.php +++ b/Classes/Integration/PreviewView.php @@ -45,7 +45,7 @@ class PreviewView extends TemplateView protected ConfigurationManagerInterface $configurationManager; protected WorkspacesAwareRecordService $workspacesAwareRecordService; - public function __construct(RenderingContextInterface $context = null) + public function __construct(?RenderingContextInterface $context = null) { parent::__construct($context); @@ -94,7 +94,7 @@ public function getPreview(ProviderInterface $provider, array $row, bool $withou )['preview']; } - protected function getPreviewOptions(Form $form = null): array + protected function getPreviewOptions(?Form $form = null): array { if (!is_object($form) || !$form->hasOption(PreviewOption::PREVIEW)) { return [ @@ -116,7 +116,7 @@ protected function getOptionToggle(array $options = []): bool return (boolean) ($options[PreviewOption::TOGGLE] ?? true); } - protected function renderPreviewSection(ProviderInterface $provider, array $row, Form $form = null): ?string + protected function renderPreviewSection(ProviderInterface $provider, array $row, ?Form $form = null): ?string { $templatePathAndFilename = $provider->getTemplatePathAndFilename($row); if (!$templatePathAndFilename) { diff --git a/Classes/Provider/ProviderResolver.php b/Classes/Provider/ProviderResolver.php index 66c329900..01a554682 100644 --- a/Classes/Provider/ProviderResolver.php +++ b/Classes/Provider/ProviderResolver.php @@ -47,7 +47,7 @@ public function resolvePageProvider(array $row): ?ProviderInterface public function resolvePrimaryConfigurationProvider( ?string $table, ?string $fieldName, - array $row = null, + ?array $row = null, ?string $extensionKey = null, array $interfaces = [ProviderInterface::class] ) { @@ -66,7 +66,7 @@ public function resolvePrimaryConfigurationProvider( public function resolveConfigurationProviders( ?string $table, ?string $fieldName, - array $row = null, + ?array $row = null, ?string $extensionKey = null, array $interfaces = [ProviderInterface::class] ) { diff --git a/Tests/Mock/ExpressionBuilder.php b/Tests/Mock/ExpressionBuilder.php index 8d80067a9..cff77cbb6 100644 --- a/Tests/Mock/ExpressionBuilder.php +++ b/Tests/Mock/ExpressionBuilder.php @@ -112,37 +112,37 @@ public function bitAnd(string $fieldName, int $value): string return __FUNCTION__; } - public function min(string $fieldName, string $alias = null): string + public function min(string $fieldName, ?string $alias = null): string { return __FUNCTION__; } - public function max(string $fieldName, string $alias = null): string + public function max(string $fieldName, ?string $alias = null): string { return __FUNCTION__; } - public function avg(string $fieldName, string $alias = null): string + public function avg(string $fieldName, ?string $alias = null): string { return __FUNCTION__; } - public function sum(string $fieldName, string $alias = null): string + public function sum(string $fieldName, ?string $alias = null): string { return __FUNCTION__; } - public function count(string $fieldName, string $alias = null): string + public function count(string $fieldName, ?string $alias = null): string { return __FUNCTION__; } - public function length(string $fieldName, string $alias = null): string + public function length(string $fieldName, ?string $alias = null): string { return __FUNCTION__; } - protected function calculation(string $aggregateName, string $fieldName, string $alias = null): string + protected function calculation(string $aggregateName, string $fieldName, ?string $alias = null): string { return __FUNCTION__; } diff --git a/Tests/Mock/QueryBuilder.php b/Tests/Mock/QueryBuilder.php index 0ed83728f..7fc7fb52e 100644 --- a/Tests/Mock/QueryBuilder.php +++ b/Tests/Mock/QueryBuilder.php @@ -20,12 +20,12 @@ public function count(string $item): self return $this; } - public function delete(string $delete, string $alias = null): self + public function delete(string $delete, ?string $alias = null): self { return $this; } - public function update(string $update, string $alias = null): self + public function update(string $update, ?string $alias = null): self { return $this; } @@ -61,7 +61,7 @@ public function expr(): ExpressionBuilder return $this->expressionBuilder; } - public function createNamedParameter($value, $type = Connection::PARAM_STR, string $placeHolder = null): string + public function createNamedParameter($value, $type = Connection::PARAM_STR, ?string $placeHolder = null): string { return 'p'; } @@ -91,7 +91,7 @@ public function addSelectLiteral(string ...$selects): self return $this; } - public function from(string $from, string $alias = null): self + public function from(string $from, ?string $alias = null): self { return $this; } @@ -111,7 +111,7 @@ public function setFirstResult(int $firstResult): self return $this; } - public function join(string $fromAlias, string $join, string $alias, string $condition = null): self + public function join(string $fromAlias, string $join, string $alias, ?string $condition = null): self { return $this; } @@ -136,12 +136,12 @@ public function groupBy(...$groupBy): self return $this; } - public function orderBy(string $fieldName, string $order = null): self + public function orderBy(string $fieldName, ?string $order = null): self { return $this; } - public function addOrderBy(string $fieldName, string $order = null): self + public function addOrderBy(string $fieldName, ?string $order = null): self { return $this; } diff --git a/Tests/Unit/Form/AbstractFormTest.php b/Tests/Unit/Form/AbstractFormTest.php index 602d22eee..6a8033590 100644 --- a/Tests/Unit/Form/AbstractFormTest.php +++ b/Tests/Unit/Form/AbstractFormTest.php @@ -115,7 +115,7 @@ protected function getObjectClassName(): string /** * @test */ - public function canChainAllChainableSetters(array $chainPropertiesAndValues = null): FormInterface + public function canChainAllChainableSetters(?array $chainPropertiesAndValues = null): FormInterface { if (null === $chainPropertiesAndValues) { $chainPropertiesAndValues = $this->chainProperties;