From df3de41a2a8a402b88394b8d101701561b498a21 Mon Sep 17 00:00:00 2001 From: Torben Hansen Date: Mon, 15 Jan 2024 19:42:26 +0100 Subject: [PATCH] [TASK] Remove redundant type casts in ext:form Some type casts in ext:form are superfluous, since it is already ensured, that the variable type is as expected. This change removes all redundant type casts. Resolves: #102840 Releases: main Change-Id: I0daa178ab69c88e61bc92f31caefd9f8b45766df Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/82461 Tested-by: Oliver Klee Reviewed-by: Oliver Bartsch Reviewed-by: Oliver Klee Tested-by: core-ci Tested-by: Oliver Bartsch --- typo3/sysext/form/Classes/Domain/Runtime/FormRuntime.php | 2 +- .../Mvc/Property/TypeConverter/PseudoFileReference.php | 4 ++-- typo3/sysext/form/Classes/Slot/FilePersistenceSlot.php | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/typo3/sysext/form/Classes/Domain/Runtime/FormRuntime.php b/typo3/sysext/form/Classes/Domain/Runtime/FormRuntime.php index db1d14ef3010..5d8fb3192b54 100644 --- a/typo3/sysext/form/Classes/Domain/Runtime/FormRuntime.php +++ b/typo3/sysext/form/Classes/Domain/Runtime/FormRuntime.php @@ -860,7 +860,7 @@ public function getType(): string public function offsetExists(mixed $identifier): bool { $identifier = (string)$identifier; - if ($this->getElementValue((string)$identifier) !== null) { + if ($this->getElementValue($identifier) !== null) { return true; } diff --git a/typo3/sysext/form/Classes/Mvc/Property/TypeConverter/PseudoFileReference.php b/typo3/sysext/form/Classes/Mvc/Property/TypeConverter/PseudoFileReference.php index bdcdb61bb181..2371b80f90f5 100644 --- a/typo3/sysext/form/Classes/Mvc/Property/TypeConverter/PseudoFileReference.php +++ b/typo3/sysext/form/Classes/Mvc/Property/TypeConverter/PseudoFileReference.php @@ -54,12 +54,12 @@ public function __sleep(): array return ['_uid']; } if ($this->getOriginalResource()->getUid() > 0) { - $this->_uid = (int)$this->getOriginalResource()->getUid(); + $this->_uid = $this->getOriginalResource()->getUid(); return ['_uid']; } // in case this is a transient file reference, just expose the associated `sys_file.uid` // (based on previous comments, this is the most probably case in ext:form) - $this->_uidLocal = (int)$this->getOriginalResource()->getOriginalFile()->getUid(); + $this->_uidLocal = $this->getOriginalResource()->getOriginalFile()->getUid(); return ['_uidLocal']; } diff --git a/typo3/sysext/form/Classes/Slot/FilePersistenceSlot.php b/typo3/sysext/form/Classes/Slot/FilePersistenceSlot.php index 6a8803d17946..a655dc434034 100644 --- a/typo3/sysext/form/Classes/Slot/FilePersistenceSlot.php +++ b/typo3/sysext/form/Classes/Slot/FilePersistenceSlot.php @@ -238,7 +238,7 @@ protected function assertFileName( $contentSignature = null; if ($content !== null) { - $contentSignature = $this->getContentSignature((string)$content); + $contentSignature = $this->getContentSignature($content); } $allowedInvocationIndex = $this->searchAllowedInvocation( $command,