From 3766cc3ea138e2d04bcda1832f23fdc08c2d02e8 Mon Sep 17 00:00:00 2001 From: Christian Kuhn <lolli@schwarzbu.ch> Date: Mon, 8 Mar 2021 14:36:29 +0100 Subject: [PATCH] [TASK] DataHandler: Drop a series of unused method arguments Update some simple cases in DataHandler where method arguments are provided, but not used. Change-Id: I4658fadd8b031a428fcb21b616172729ece6daa8 Resolves: #93678 Releases: master Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/68253 Tested-by: TYPO3com <noreply@typo3.com> Tested-by: core-ci <typo3@b13.com> Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de> Tested-by: Benni Mack <benni@typo3.org> Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de> Reviewed-by: Benni Mack <benni@typo3.org> --- .../core/Classes/DataHandling/DataHandler.php | 27 +++++++------------ .../Unit/DataHandling/DataHandlerTest.php | 2 +- 2 files changed, 11 insertions(+), 18 deletions(-) diff --git a/typo3/sysext/core/Classes/DataHandling/DataHandler.php b/typo3/sysext/core/Classes/DataHandling/DataHandler.php index 87f81c2c2730..a82ec0eac2dc 100644 --- a/typo3/sysext/core/Classes/DataHandling/DataHandler.php +++ b/typo3/sysext/core/Classes/DataHandling/DataHandler.php @@ -1527,7 +1527,7 @@ class DataHandler implements LoggerAwareInterface switch ($tcaFieldConf['type']) { case 'text': - $res = $this->checkValueForText($value, $tcaFieldConf, $table, $id, $realPid, $field); + $res = $this->checkValueForText($value, $tcaFieldConf, $table, $realPid, $field); break; case 'passthrough': case 'imageManipulation': @@ -1548,7 +1548,7 @@ class DataHandler implements LoggerAwareInterface break; case 'group': case 'select': - $res = $this->checkValueForGroupSelect($res, $value, $tcaFieldConf, $table, $id, $curValue, $status, $recFID, $uploadedFiles, $field); + $res = $this->checkValueForGroupSelect($res, $value, $tcaFieldConf, $table, $id, $status, $field); break; case 'inline': $res = $this->checkValueForInline($res, $value, $tcaFieldConf, $table, $id, $status, $field, $additionalData) ?: []; @@ -1623,12 +1623,11 @@ class DataHandler implements LoggerAwareInterface * @param string $value The value to set. * @param array $tcaFieldConf Field configuration from TCA * @param string $table Table name - * @param int $id UID of record * @param int $realPid The real PID value of the record. For updates, this is just the pid of the record. For new records this is the PID of the page where it is inserted. * @param string $field Field name * @return array $res The result array. The processed value (if any!) is set in the "value" key. */ - protected function checkValueForText($value, $tcaFieldConf, $table, $id, $realPid, $field) + protected function checkValueForText($value, $tcaFieldConf, $table, $realPid, $field) { if (isset($tcaFieldConf['eval']) && $tcaFieldConf['eval'] !== '') { $cacheId = $this->getFieldEvalCacheIdentifier($tcaFieldConf['eval']); @@ -1928,14 +1927,11 @@ class DataHandler implements LoggerAwareInterface * @param array $tcaFieldConf Field configuration from TCA * @param string $table Table name * @param int $id UID of record - * @param mixed $curValue Current value of the field * @param string $status 'update' or 'new' flag - * @param string $recFID Field identifier [table:uid:field] for flexforms - * @param array $uploadedFiles * @param string $field Field name * @return array Modified $res array */ - protected function checkValueForGroupSelect($res, $value, $tcaFieldConf, $table, $id, $curValue, $status, $recFID, $uploadedFiles, $field) + protected function checkValueForGroupSelect($res, $value, $tcaFieldConf, $table, $id, $status, $field) { // Detecting if value sent is an array and if so, implode it around a comma: if (is_array($value)) { @@ -2235,7 +2231,7 @@ class DataHandler implements LoggerAwareInterface ]; unset($res['value']); } elseif ($value || MathUtility::canBeInterpretedAsInteger($id)) { - $res['value'] = $this->checkValue_inline_processDBdata($valueArray, $tcaFieldConf, $id, $status, $table, $field, $additionalData); + $res['value'] = $this->checkValue_inline_processDBdata($valueArray, $tcaFieldConf, $id, $status, $table, $field); } return $res; } @@ -2913,10 +2909,9 @@ class DataHandler implements LoggerAwareInterface * @param string $status Status string ('update' or 'new') * @param string $table Table name, needs to be passed to \TYPO3\CMS\Core\Database\RelationHandler * @param string $field The current field the values are modified for - * @param array $additionalData Additional data to be forwarded to sub-processors * @return string Modified values */ - protected function checkValue_inline_processDBdata($valueArray, $tcaFieldConf, $id, $status, $table, $field, array $additionalData = null) + protected function checkValue_inline_processDBdata($valueArray, $tcaFieldConf, $id, $status, $table, $field) { $foreignTable = $tcaFieldConf['foreign_table']; $valueArray = $this->applyFiltersToValues($tcaFieldConf, $valueArray); @@ -4193,7 +4188,7 @@ class DataHandler implements LoggerAwareInterface if (is_array($row) && (int)$destPid !== (int)$row['pid']) { $conf = $GLOBALS['TCA'][$table]['columns']; foreach ($row as $field => $value) { - $this->moveRecord_procBasedOnFieldType($table, $uid, $destPid, $field, $value, $conf[$field]['config'] ?? []); + $this->moveRecord_procBasedOnFieldType($table, $uid, $destPid, $value, $conf[$field]['config'] ?? []); } } } @@ -4204,12 +4199,11 @@ class DataHandler implements LoggerAwareInterface * @param string $table Record Table * @param int $uid Record UID * @param int $destPid Position to move to - * @param string $field Record field * @param string $value Record field value * @param array $conf TCA configuration of current field * @internal should only be used from within DataHandler */ - public function moveRecord_procBasedOnFieldType($table, $uid, $destPid, $field, $value, $conf) + public function moveRecord_procBasedOnFieldType($table, $uid, $destPid, $value, $conf) { $dbAnalysis = null; if (!empty($conf['type']) && $conf['type'] === 'inline') { @@ -5055,7 +5049,7 @@ class DataHandler implements LoggerAwareInterface return; } foreach ($row as $field => $value) { - $this->deleteRecord_procBasedOnFieldType($table, $uid, $field, $value, $conf[$field]['config'] ?? []); + $this->deleteRecord_procBasedOnFieldType($table, $uid, $value, $conf[$field]['config'] ?? []); } } @@ -5065,13 +5059,12 @@ class DataHandler implements LoggerAwareInterface * * @param string $table Record Table * @param int $uid Record UID - * @param string $field Record field * @param string $value Record field value * @param array $conf TCA configuration of current field * @see deleteRecord() * @internal should only be used from within DataHandler */ - public function deleteRecord_procBasedOnFieldType($table, $uid, $field, $value, $conf): void + public function deleteRecord_procBasedOnFieldType($table, $uid, $value, $conf): void { if (!isset($conf['type'])) { return; diff --git a/typo3/sysext/core/Tests/Unit/DataHandling/DataHandlerTest.php b/typo3/sysext/core/Tests/Unit/DataHandling/DataHandlerTest.php index 2b482ff8ab35..6077d1a77a2a 100644 --- a/typo3/sysext/core/Tests/Unit/DataHandling/DataHandlerTest.php +++ b/typo3/sysext/core/Tests/Unit/DataHandling/DataHandlerTest.php @@ -816,7 +816,7 @@ class DataHandlerTest extends UnitTestCase $mockDataHandler->expects(self::once())->method('getInlineFieldType')->willReturn('field'); $mockDataHandler->expects(self::once())->method('createRelationHandlerInstance')->willReturn($mockRelationHandler); $mockDataHandler->expects(self::never())->method('deleteAction'); - $mockDataHandler->deleteRecord_procBasedOnFieldType($table, 42, 'foo', 'bar', $conf); + $mockDataHandler->deleteRecord_procBasedOnFieldType($table, 42, 'bar', $conf); } /** -- GitLab