From 29dd10bfe396b284074798efcf65ceb4ac5241f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20B=C3=BCrk?= <stefan@buerk.tech> Date: Tue, 25 Jun 2024 19:18:21 +0200 Subject: [PATCH] [TASK] Avoid implicitly nullable class method parameter in `EXT:linkvalidator` 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: #104210 Releases: main, 12.4, 11.5 Change-Id: Id20216f2b920b5f5c0d665a370536c447590f53c Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/84917 Tested-by: core-ci <typo3@b13.com> Tested-by: Stefan Bürk <stefan@buerk.tech> Reviewed-by: Stefan Bürk <stefan@buerk.tech> --- .../Classes/Linktype/ExternalLinktype.php | 2 +- .../Classes/Report/LinkValidatorReport.php | 10 +++++----- .../Classes/Repository/BrokenLinkRepository.php | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/typo3/sysext/linkvalidator/Classes/Linktype/ExternalLinktype.php b/typo3/sysext/linkvalidator/Classes/Linktype/ExternalLinktype.php index a6b02614e10a..1aa084cbe407 100644 --- a/typo3/sysext/linkvalidator/Classes/Linktype/ExternalLinktype.php +++ b/typo3/sysext/linkvalidator/Classes/Linktype/ExternalLinktype.php @@ -98,7 +98,7 @@ class ExternalLinktype extends AbstractLinktype */ protected $errorParams = []; - public function __construct(RequestFactory $requestFactory = null) + public function __construct(?RequestFactory $requestFactory = null) { $this->requestFactory = $requestFactory ?: GeneralUtility::makeInstance(RequestFactory::class); } diff --git a/typo3/sysext/linkvalidator/Classes/Report/LinkValidatorReport.php b/typo3/sysext/linkvalidator/Classes/Report/LinkValidatorReport.php index 8b763969a81c..77bb3b68dded 100644 --- a/typo3/sysext/linkvalidator/Classes/Report/LinkValidatorReport.php +++ b/typo3/sysext/linkvalidator/Classes/Report/LinkValidatorReport.php @@ -154,11 +154,11 @@ class LinkValidatorReport protected PageRenderer $pageRenderer; public function __construct( - PagesRepository $pagesRepository = null, - BrokenLinkRepository $brokenLinkRepository = null, - ModuleTemplateFactory $moduleTemplateFactory = null, - IconFactory $iconFactory = null, - PageRenderer $pageRecord = null + ?PagesRepository $pagesRepository = null, + ?BrokenLinkRepository $brokenLinkRepository = null, + ?ModuleTemplateFactory $moduleTemplateFactory = null, + ?IconFactory $iconFactory = null, + ?PageRenderer $pageRecord = null ) { $this->iconFactory = $iconFactory ?? GeneralUtility::makeInstance(IconFactory::class); $this->pagesRepository = $pagesRepository ?? GeneralUtility::makeInstance(PagesRepository::class); diff --git a/typo3/sysext/linkvalidator/Classes/Repository/BrokenLinkRepository.php b/typo3/sysext/linkvalidator/Classes/Repository/BrokenLinkRepository.php index e1dcdb929ec7..4217e5d250e7 100644 --- a/typo3/sysext/linkvalidator/Classes/Repository/BrokenLinkRepository.php +++ b/typo3/sysext/linkvalidator/Classes/Repository/BrokenLinkRepository.php @@ -327,7 +327,7 @@ class BrokenLinkRepository * @throws \UnexpectedValueException * @todo Make default value of $errorParams [] instead of null and add strict typing in v13 */ - public function addBrokenLink($record, bool $isValid, array $errorParams = null): void + public function addBrokenLink($record, bool $isValid, ?array $errorParams = null): void { $response = ['valid' => $isValid]; $response['errorParams'] = $errorParams ?? []; -- GitLab