From fdcd7d73ec344be36aa61298c77d50423cb9981e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20B=C3=BCrk?= <stefan@buerk.tech> Date: Tue, 25 Jun 2024 19:24:28 +0200 Subject: [PATCH] [TASK] Avoid implicitly nullable class method parameter in `EXT:install` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit With PHP 8.4 marking method parameter implicitly nullable is deprecated and will emit a `E_DEPRECATED` warning. One recommended way to resolve this, is making it explicitly nullable using the `?` nullable operator or adding a null tyype to an union type definition. [1] This prepares the way towards PHP 8.4 compatibility. [1] https://php.watch/versions/8.4/implicitly-marking-parameter-type-nullable-deprecated Resolves: #104211 Releases: main, 12.4, 11.5 Change-Id: Ic086fc77872c54f763d774f4118517658d8d52e3 Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/84920 Reviewed-by: Stefan Bürk <stefan@buerk.tech> Tested-by: Stefan Bürk <stefan@buerk.tech> Tested-by: core-ci <typo3@b13.com> --- typo3/sysext/install/Classes/Configuration/AbstractPreset.php | 2 +- .../Classes/ExtensionScanner/Php/GeneratorClassesResolver.php | 2 +- typo3/sysext/install/Classes/FolderStructure/DirectoryNode.php | 2 +- typo3/sysext/install/Classes/FolderStructure/FileNode.php | 2 +- typo3/sysext/install/Classes/FolderStructure/LinkNode.php | 2 +- typo3/sysext/install/Classes/FolderStructure/NodeInterface.php | 2 +- typo3/sysext/install/Classes/FolderStructure/RootNode.php | 2 +- .../ServerResponse/ContentSecurityPolicyHeader.php | 2 +- .../install/Classes/UpgradeAnalysis/DocumentationFile.php | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/typo3/sysext/install/Classes/Configuration/AbstractPreset.php b/typo3/sysext/install/Classes/Configuration/AbstractPreset.php index 52b5bac0d79c..b7eeb3c227c5 100644 --- a/typo3/sysext/install/Classes/Configuration/AbstractPreset.php +++ b/typo3/sysext/install/Classes/Configuration/AbstractPreset.php @@ -58,7 +58,7 @@ abstract class AbstractPreset implements PresetInterface /** * @param \TYPO3\CMS\Core\Configuration\ConfigurationManager $configurationManager */ - public function __construct(ConfigurationManager $configurationManager = null) + public function __construct(?ConfigurationManager $configurationManager = null) { $this->configurationManager = $configurationManager ?: GeneralUtility::makeInstance(ConfigurationManager::class); } diff --git a/typo3/sysext/install/Classes/ExtensionScanner/Php/GeneratorClassesResolver.php b/typo3/sysext/install/Classes/ExtensionScanner/Php/GeneratorClassesResolver.php index 8f9dca59135b..75c2a0ee3d00 100644 --- a/typo3/sysext/install/Classes/ExtensionScanner/Php/GeneratorClassesResolver.php +++ b/typo3/sysext/install/Classes/ExtensionScanner/Php/GeneratorClassesResolver.php @@ -45,7 +45,7 @@ class GeneratorClassesResolver extends NodeVisitorAbstract */ protected $builderFactory; - public function __construct(BuilderFactory $builderFactory = null) + public function __construct(?BuilderFactory $builderFactory = null) { $this->builderFactory = $builderFactory ?? new BuilderFactory(); } diff --git a/typo3/sysext/install/Classes/FolderStructure/DirectoryNode.php b/typo3/sysext/install/Classes/FolderStructure/DirectoryNode.php index 22a202373208..bb2a8289a560 100644 --- a/typo3/sysext/install/Classes/FolderStructure/DirectoryNode.php +++ b/typo3/sysext/install/Classes/FolderStructure/DirectoryNode.php @@ -37,7 +37,7 @@ class DirectoryNode extends AbstractNode implements NodeInterface * @param NodeInterface $parent Parent object * @throws Exception\InvalidArgumentException */ - public function __construct(array $structure, NodeInterface $parent = null) + public function __construct(array $structure, ?NodeInterface $parent = null) { if ($parent === null) { throw new InvalidArgumentException( diff --git a/typo3/sysext/install/Classes/FolderStructure/FileNode.php b/typo3/sysext/install/Classes/FolderStructure/FileNode.php index 2b1b0e211056..9bc3882eb58c 100644 --- a/typo3/sysext/install/Classes/FolderStructure/FileNode.php +++ b/typo3/sysext/install/Classes/FolderStructure/FileNode.php @@ -41,7 +41,7 @@ class FileNode extends AbstractNode implements NodeInterface * @param NodeInterface $parent Parent object * @throws Exception\InvalidArgumentException */ - public function __construct(array $structure, NodeInterface $parent = null) + public function __construct(array $structure, ?NodeInterface $parent = null) { if ($parent === null) { throw new InvalidArgumentException( diff --git a/typo3/sysext/install/Classes/FolderStructure/LinkNode.php b/typo3/sysext/install/Classes/FolderStructure/LinkNode.php index b011790caa18..d14b5702d418 100644 --- a/typo3/sysext/install/Classes/FolderStructure/LinkNode.php +++ b/typo3/sysext/install/Classes/FolderStructure/LinkNode.php @@ -36,7 +36,7 @@ class LinkNode extends AbstractNode implements NodeInterface * @param NodeInterface $parent Parent object * @throws Exception\InvalidArgumentException */ - public function __construct(array $structure, NodeInterface $parent = null) + public function __construct(array $structure, ?NodeInterface $parent = null) { if ($parent === null) { throw new InvalidArgumentException( diff --git a/typo3/sysext/install/Classes/FolderStructure/NodeInterface.php b/typo3/sysext/install/Classes/FolderStructure/NodeInterface.php index c3c1123b3906..cb33e63a133a 100644 --- a/typo3/sysext/install/Classes/FolderStructure/NodeInterface.php +++ b/typo3/sysext/install/Classes/FolderStructure/NodeInterface.php @@ -28,7 +28,7 @@ interface NodeInterface * @param array $structure Structure * @param NodeInterface $parent Parent */ - public function __construct(array $structure, NodeInterface $parent = null); + public function __construct(array $structure, ?NodeInterface $parent = null); /** * Get node name diff --git a/typo3/sysext/install/Classes/FolderStructure/RootNode.php b/typo3/sysext/install/Classes/FolderStructure/RootNode.php index 389fc2cf4adc..d69f89d5fee6 100644 --- a/typo3/sysext/install/Classes/FolderStructure/RootNode.php +++ b/typo3/sysext/install/Classes/FolderStructure/RootNode.php @@ -33,7 +33,7 @@ class RootNode extends DirectoryNode implements RootNodeInterface * @throws Exception\RootNodeException * @throws Exception\InvalidArgumentException */ - public function __construct(array $structure, NodeInterface $parent = null) + public function __construct(array $structure, ?NodeInterface $parent = null) { if ($parent !== null) { throw new RootNodeException( diff --git a/typo3/sysext/install/Classes/SystemEnvironment/ServerResponse/ContentSecurityPolicyHeader.php b/typo3/sysext/install/Classes/SystemEnvironment/ServerResponse/ContentSecurityPolicyHeader.php index e86de5f5cf5e..7e8de587c77e 100644 --- a/typo3/sysext/install/Classes/SystemEnvironment/ServerResponse/ContentSecurityPolicyHeader.php +++ b/typo3/sysext/install/Classes/SystemEnvironment/ServerResponse/ContentSecurityPolicyHeader.php @@ -48,7 +48,7 @@ class ContentSecurityPolicyHeader return empty($this->directives); } - public function mitigatesCrossSiteScripting(string $fileName = null): bool + public function mitigatesCrossSiteScripting(?string $fileName = null): bool { $isSvg = str_ends_with($fileName ?? '', '.svg'); $defaultSrc = isset($this->directives['default-src']) diff --git a/typo3/sysext/install/Classes/UpgradeAnalysis/DocumentationFile.php b/typo3/sysext/install/Classes/UpgradeAnalysis/DocumentationFile.php index e92287ccd033..d4c400c79adc 100644 --- a/typo3/sysext/install/Classes/UpgradeAnalysis/DocumentationFile.php +++ b/typo3/sysext/install/Classes/UpgradeAnalysis/DocumentationFile.php @@ -54,7 +54,7 @@ class DocumentationFile * @param Registry|null $registry * @param string $changelogDir */ - public function __construct(Registry $registry = null, $changelogDir = '') + public function __construct(?Registry $registry = null, $changelogDir = '') { if ($registry === null) { $registry = new Registry(); -- GitLab