diff --git a/Build/php-cs-fixer/config.php b/Build/php-cs-fixer/config.php index 57ebfa08..755b1ae4 100644 --- a/Build/php-cs-fixer/config.php +++ b/Build/php-cs-fixer/config.php @@ -56,6 +56,10 @@ 'no_unused_imports' => true, 'no_useless_else' => true, 'no_useless_nullsafe_operator' => true, + 'nullable_type_declaration' => [ + 'syntax' => 'question_mark', + ], + 'nullable_type_declaration_for_default_null_value' => true, 'ordered_imports' => ['imports_order' => ['class', 'function', 'const'], 'sort_algorithm' => 'alpha'], 'php_unit_construct' => ['assertions' => ['assertEquals', 'assertSame', 'assertNotEquals', 'assertNotSame']], 'php_unit_mock_short_will_return' => true, diff --git a/Classes/Composer/ComposerPackageManager.php b/Classes/Composer/ComposerPackageManager.php index c06015af..467783b4 100644 --- a/Classes/Composer/ComposerPackageManager.php +++ b/Classes/Composer/ComposerPackageManager.php @@ -47,7 +47,7 @@ final class ComposerPackageManager private static string $publicPath = ''; - private static PackageInfo|null $rootPackage = null; + private static ?PackageInfo $rootPackage = null; /** * @var array diff --git a/Classes/Core/BaseTestCase.php b/Classes/Core/BaseTestCase.php index 5ae2a0e4..37a9c44c 100644 --- a/Classes/Core/BaseTestCase.php +++ b/Classes/Core/BaseTestCase.php @@ -108,7 +108,7 @@ protected function tearDown(): void */ protected function getAccessibleMock( string $originalClassName, - array|null $methods = [], + ?array $methods = [], array $arguments = [], string $mockClassName = '', bool $callOriginalConstructor = true, diff --git a/Classes/Core/Functional/Framework/DataHandling/ActionService.php b/Classes/Core/Functional/Framework/DataHandling/ActionService.php index 210d99b7..79f67354 100644 --- a/Classes/Core/Functional/Framework/DataHandling/ActionService.php +++ b/Classes/Core/Functional/Framework/DataHandling/ActionService.php @@ -111,7 +111,7 @@ public function createNewRecords(int $pageId, array $tableRecordData): array * modifyRecord('tt_content', 42, ['hidden' => '1']); // Modify a single record * modifyRecord('tt_content', 42, ['hidden' => '1'], ['tx_irre_table' => [4]]); // Modify a record and delete a child */ - public function modifyRecord(string $tableName, int $uid, array $recordData, array $deleteTableRecordIds = null) + public function modifyRecord(string $tableName, int $uid, array $recordData, ?array $deleteTableRecordIds = null) { $dataMap = [ $tableName => [ @@ -266,7 +266,7 @@ public function clearWorkspaceRecords(array $tableRecordIds) * Example: * copyRecord('tt_content', 42, 5, ['header' => 'Testing #1']); */ - public function copyRecord(string $tableName, int $uid, int $pageId, array $recordData = null): array + public function copyRecord(string $tableName, int $uid, int $pageId, ?array $recordData = null): array { $commandMap = [ $tableName => [ @@ -302,7 +302,7 @@ public function copyRecord(string $tableName, int $uid, int $pageId, array $reco * @param array $recordData Additional record data to change when moving. * @return array */ - public function moveRecord(string $tableName, int $uid, int $targetUid, array $recordData = null): array + public function moveRecord(string $tableName, int $uid, int $targetUid, ?array $recordData = null): array { $commandMap = [ $tableName => [ diff --git a/Classes/Core/Functional/Framework/DataHandling/Scenario/DataHandlerFactory.php b/Classes/Core/Functional/Framework/DataHandling/Scenario/DataHandlerFactory.php index 3f86913c..04b8fb0d 100644 --- a/Classes/Core/Functional/Framework/DataHandling/Scenario/DataHandlerFactory.php +++ b/Classes/Core/Functional/Framework/DataHandling/Scenario/DataHandlerFactory.php @@ -110,8 +110,8 @@ public function getSuggestedIds(): array */ private function processEntities( array $settings, - string $nodeId = null, - string $parentId = null + ?string $nodeId = null, + ?string $parentId = null ): void { foreach ($settings as $entityName => $entitySettings) { $entityConfiguration = $this->provideEntityConfiguration($entityName); @@ -135,8 +135,8 @@ private function processEntities( private function processEntityItem( EntityConfiguration $entityConfiguration, array $itemSettings, - string $nodeId = null, - string $parentId = null + ?string $nodeId = null, + ?string $parentId = null ): void { $values = $this->processEntityValues( $entityConfiguration, @@ -199,7 +199,7 @@ private function processLanguageVariantItem( EntityConfiguration $entityConfiguration, array $itemSettings, array $ancestorIds, - string $nodeId = null + ?string $nodeId = null ): void { $values = $this->processEntityValues( $entityConfiguration, @@ -240,7 +240,7 @@ private function processVersionVariantItem( EntityConfiguration $entityConfiguration, array $itemSettings, string $ancestorId, - string $nodeId = null + ?string $nodeId = null ): void { if (isset($itemSettings['self'])) { throw new \LogicException( @@ -284,8 +284,8 @@ private function processVersionVariantItem( private function processEntityValues( EntityConfiguration $entityConfiguration, array $itemSettings, - string $nodeId = null, - string $parentId = null + ?string $nodeId = null, + ?string $parentId = null ): array { if (isset($itemSettings['self']) && isset($itemSettings['version'])) { throw new \LogicException( diff --git a/Classes/Core/Functional/Framework/Frontend/Collector.php b/Classes/Core/Functional/Framework/Frontend/Collector.php index 135e8bcb..bd5465b4 100644 --- a/Classes/Core/Functional/Framework/Frontend/Collector.php +++ b/Classes/Core/Functional/Framework/Frontend/Collector.php @@ -44,7 +44,7 @@ public function setContentObjectRenderer(ContentObjectRenderer $cObj): void $this->cObj = $cObj; } - public function addRecordData($content, array $configuration = null, ServerRequestInterface $request): void + public function addRecordData($content, ?array $configuration = null, ?ServerRequestInterface $request = null): void { $recordIdentifier = $this->cObj->currentRecord; [$tableName] = explode(':', $recordIdentifier); @@ -63,7 +63,7 @@ public function addRecordData($content, array $configuration = null, ServerReque } } - public function addFileData($content, array $configuration = null, ServerRequestInterface $request): void + public function addFileData($content, ?array $configuration = null, ?ServerRequestInterface $request = null): void { $currentFile = $this->cObj->getCurrentFile(); @@ -84,7 +84,7 @@ public function addFileData($content, array $configuration = null, ServerRequest $this->addToStructure($levelIdentifier, $recordIdentifier, $recordData); } - public function attachSection(string $content, array $configuration = null): void + public function attachSection(string $content, ?array $configuration = null): void { $section = [ 'structure' => $this->structure, diff --git a/Classes/Core/Functional/Framework/Frontend/Renderer.php b/Classes/Core/Functional/Framework/Frontend/Renderer.php index e0870daa..5468576a 100644 --- a/Classes/Core/Functional/Framework/Frontend/Renderer.php +++ b/Classes/Core/Functional/Framework/Frontend/Renderer.php @@ -40,7 +40,7 @@ class Renderer implements SingletonInterface * @param string $content * @param array|null $configuration */ - public function parseValues($content, array $configuration = null) + public function parseValues($content, ?array $configuration = null) { if (empty($content)) { return; @@ -84,7 +84,7 @@ public function parseValues($content, array $configuration = null) * @param string $content * @param array|null $configuration */ - public function renderValues($content, array $configuration = null) + public function renderValues($content, ?array $configuration = null) { if (empty($configuration['values.'])) { return; @@ -112,7 +112,7 @@ public function addSection(array $section, $as = null) * @param array|null $configuration * @return string */ - public function renderSections($content, array $configuration = null) + public function renderSections($content, ?array $configuration = null) { return json_encode($this->sections); } diff --git a/Classes/Core/Functional/Framework/Frontend/ResponseContent.php b/Classes/Core/Functional/Framework/Frontend/ResponseContent.php index ad66cc96..a921df46 100644 --- a/Classes/Core/Functional/Framework/Frontend/ResponseContent.php +++ b/Classes/Core/Functional/Framework/Frontend/ResponseContent.php @@ -47,7 +47,7 @@ class ResponseContent final public function __construct() {} - public static function fromString(string $data, ResponseContent $target = null): ResponseContent + public static function fromString(string $data, ?ResponseContent $target = null): ResponseContent { $target = $target ?? new static(); $content = json_decode($data, true); diff --git a/Classes/Core/Functional/FunctionalTestCase.php b/Classes/Core/Functional/FunctionalTestCase.php index 58edd8e2..45ca7044 100644 --- a/Classes/Core/Functional/FunctionalTestCase.php +++ b/Classes/Core/Functional/FunctionalTestCase.php @@ -898,7 +898,7 @@ protected function addTypoScriptToTemplateRecord(int $pageId, string $typoScript */ protected function executeFrontendSubRequest( InternalRequest $request, - InternalRequestContext $context = null, + ?InternalRequestContext $context = null, bool $followRedirects = false ): ResponseInterface { if ($context === null) { diff --git a/Classes/Core/PackageCollection.php b/Classes/Core/PackageCollection.php index 6a3ff288..cbef267e 100644 --- a/Classes/Core/PackageCollection.php +++ b/Classes/Core/PackageCollection.php @@ -82,7 +82,7 @@ public function getPackages(): array return $this->packages; } - public function sortPackages(DependencyOrderingService $dependencyOrderingService = null): void + public function sortPackages(?DependencyOrderingService $dependencyOrderingService = null): void { $sortedPackageKeys = $this->resolveSortedPackageKeys($dependencyOrderingService); usort( @@ -97,7 +97,7 @@ public function sortPackages(DependencyOrderingService $dependencyOrderingServic * @param array $packageStates * @return array */ - public function sortPackageStates(array $packageStates, DependencyOrderingService $dependencyOrderingService = null): array + public function sortPackageStates(array $packageStates, ?DependencyOrderingService $dependencyOrderingService = null): array { $sortedPackageKeys = $this->resolveSortedPackageKeys($dependencyOrderingService); uksort( @@ -117,7 +117,7 @@ public function sortPackageStates(array $packageStates, DependencyOrderingServic * * @return list */ - public function resolveSortedPackageKeys(DependencyOrderingService $dependencyOrderingService = null): array + public function resolveSortedPackageKeys(?DependencyOrderingService $dependencyOrderingService = null): array { $dependencyOrderingService ??= GeneralUtility::makeInstance(DependencyOrderingService::class); $allPackageConstraints = $this->resolveAllPackageConstraints();