Commit 2db847fb authored by Alexander Schnitzler's avatar Alexander Schnitzler Committed by Anja Leichsenring
Browse files

[TASK] Apply rector set php71

    php bin/rector process

A couple of rectors have been disabled due to different reasons:

- Rector\Php71\Rector\FuncCall\CountOnNullRector
  This rector has been disabled as it creates rather long and
  complex structures to avoid calling count on null.

  This rector will be enabled as soon as TYPO3 uses at least
  PHP 7.3 which introduces a "is_countable" method.

- Rector\Php71\Rector\Assign\AssignArrayToStringRector
  This rector has been disabled as it does not work properly.
  The default types of parameters have been changed although
  their types could properly be inferred by a doc block or
  by value assignments.

- Rector\Php71\Rector\BinaryOp\BinaryOpBetweenNumberAndStringRector
  This rector has been disabled as it does not work properly.
  A bug report is filed and to be found here:
  https://github.com/rectorphp/rector/issues/2454

- Rector\Php71\Rector\FuncCall\RemoveExtraParametersRector
  This rector has been disabled as it does not work properly.
  It removed arguments in tests, especially when using
  prophecies.

Releases: master
Resolves: #90002
Change-Id: I6ed14d38cc697a23104286db57535d6a3c0dbf62
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/62751


Tested-by: default avatarTYPO3com <noreply@typo3.com>
Tested-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
Tested-by: Anja Leichsenring's avatarAnja Leichsenring <aleichsenring@ab-softlab.de>
Reviewed-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
Reviewed-by: Anja Leichsenring's avatarAnja Leichsenring <aleichsenring@ab-softlab.de>
parent 4c4c629b
......@@ -15,9 +15,14 @@ parameters:
exclude_rectors:
- Rector\Php55\Rector\String_\StringClassNameToClassConstantRector
- Rector\Php70\Rector\List_\ListSwapArrayOrderRector
- Rector\Php71\Rector\Assign\AssignArrayToStringRector # this rector does not detect class properties right and changes them
- Rector\Php71\Rector\BinaryOp\BinaryOpBetweenNumberAndStringRector # this rector is currently broken, bug report: https://github.com/rectorphp/rector/issues/2454
- Rector\Php71\Rector\FuncCall\CountOnNullRector # can be enabled again if min php version is and actives sets include php73 as that version introduced "is_countable"
- Rector\Php71\Rector\FuncCall\RemoveExtraParametersRector # this breaks tests (prophecies)
sets:
- 'php53'
- 'php54'
- 'php55'
- 'php56'
- 'php70'
- 'php71'
......@@ -484,7 +484,7 @@ class ShortcutRepository
while ($row = $result->fetch()) {
$shortcut = ['raw' => $row];
list($row['module_name'], $row['M_module_name']) = explode('|', $row['module_name']);
[$row['module_name'], $row['M_module_name']] = explode('|', $row['module_name']);
$queryParts = parse_url($row['url']);
// Explode GET vars recursively
......@@ -662,7 +662,7 @@ class ShortcutRepository
$moduleName = $row['module_name'];
if (strpos($moduleName, '_') !== false) {
list($mainModule, $subModule) = explode('_', $moduleName, 2);
[$mainModule, $subModule] = explode('_', $moduleName, 2);
$iconIdentifier = $this->moduleLoader->modules[$mainModule]['sub'][$subModule]['iconIdentifier'];
} elseif (!empty($moduleName)) {
$iconIdentifier = $this->moduleLoader->modules[$moduleName]['iconIdentifier'];
......@@ -693,7 +693,7 @@ class ShortcutRepository
if (strpos($moduleName, 'xMOD_') === 0) {
$title = substr($moduleName, 5);
} else {
list($mainModule, $subModule) = explode('_', $moduleName);
[$mainModule, $subModule] = explode('_', $moduleName);
$mainModuleLabels = $this->moduleLoader->getLabelsForModule($mainModule);
$title = $languageService->sL($mainModuleLabels['title']);
......
......@@ -377,7 +377,7 @@ class Clipboard
if (is_array($this->clipData[$pad]['el'] ?? false)) {
foreach ($this->clipData[$pad]['el'] as $k => $v) {
if ($v) {
list($table, $uid) = explode('|', $k);
[$table, $uid] = explode('|', $k);
// Rendering files/directories on the clipboard
if ($table === '_FILE') {
$fileObject = ResourceFactory::getInstance()->retrieveFileOrFolderObject($v);
......@@ -662,7 +662,7 @@ class Clipboard
// All records
$elements = $this->elFromTable('');
foreach ($elements as $tP => $value) {
list($table, $uid) = explode('|', $tP);
[$table, $uid] = explode('|', $tP);
$parameters['edit[' . $table . '][' . $uid . ']'] = 'edit';
}
$uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
......@@ -761,7 +761,7 @@ class Clipboard
if (is_array($this->clipData[$pad]['el'] ?? false)) {
foreach ($this->clipData[$pad]['el'] as $k => $v) {
if ($v) {
list($table, $uid) = explode('|', $k);
[$table, $uid] = explode('|', $k);
// Rendering files/directories on the clipboard
if ($table === '_FILE') {
$file = ResourceFactory::getInstance()->getObjectFromCombinedIdentifier($v);
......@@ -826,7 +826,7 @@ class Clipboard
{
if (is_array($this->clipData[$this->current]['el'] ?? false)) {
foreach ($this->clipData[$this->current]['el'] as $k => $v) {
list($table, $uid) = explode('|', $k);
[$table, $uid] = explode('|', $k);
if ($table !== '_FILE') {
if (!$v || !is_array(BackendUtility::getRecord($table, $uid, 'uid'))) {
unset($this->clipData[$this->current]['el'][$k]);
......@@ -863,7 +863,7 @@ class Clipboard
if (is_array($this->clipData[$pad]['el'] ?? false)) {
foreach ($this->clipData[$pad]['el'] as $k => $v) {
if ($v) {
list($table, $uid) = explode('|', $k);
[$table, $uid] = explode('|', $k);
if ($table !== '_FILE') {
if ((!$matchTable || (string)$table == (string)$matchTable) && $GLOBALS['TCA'][$table]) {
$list[$k] = $pad === 'normal' ? $v : $uid;
......@@ -907,7 +907,7 @@ class Clipboard
if (!$table && !$uid) {
$elArr = $this->elFromTable('');
reset($elArr);
list($table, $uid) = explode('|', key($elArr));
[$table, $uid] = explode('|', key($elArr));
}
if ($this->isSelected($table, $uid)) {
$selRec = BackendUtility::getRecordWSOL($table, $uid);
......@@ -947,7 +947,7 @@ class Clipboard
*/
public function makePasteCmdArray($ref, $CMD, array $update = null)
{
list($pTable, $pUid) = explode('|', $ref);
[$pTable, $pUid] = explode('|', $ref);
$pUid = (int)$pUid;
// pUid must be set and if pTable is not set (that means paste ALL elements)
// the uid MUST be positive/zero (pointing to page id)
......@@ -958,7 +958,7 @@ class Clipboard
$mode = $this->currentMode() === 'copy' ? 'copy' : 'move';
// Traverse elements and make CMD array
foreach ($elements as $tP => $value) {
list($table, $uid) = explode('|', $tP);
[$table, $uid] = explode('|', $tP);
if (!is_array($CMD[$table])) {
$CMD[$table] = [];
}
......@@ -991,7 +991,7 @@ class Clipboard
// all records
$elements = $this->elFromTable('');
foreach ($elements as $tP => $value) {
list($table, $uid) = explode('|', $tP);
[$table, $uid] = explode('|', $tP);
if (!is_array($CMD[$table])) {
$CMD[$table] = [];
}
......@@ -1017,7 +1017,7 @@ class Clipboard
*/
public function makePasteCmdArray_file($ref, $FILE)
{
list($pTable, $pUid) = explode('|', $ref);
[$pTable, $pUid] = explode('|', $ref);
$elements = $this->elFromTable('_FILE');
$mode = $this->currentMode() === 'copy' ? 'copy' : 'move';
// Traverse elements and make CMD array
......
......@@ -459,7 +459,7 @@ class BackendController
// check if the start module has additional parameters, so a redirect to a specific
// action is possible
if (strpos($startModule, '->') !== false) {
list($startModule, $startModuleParameters) = explode('->', $startModule, 2);
[$startModule, $startModuleParameters] = explode('->', $startModule, 2);
}
}
......
......@@ -2152,7 +2152,7 @@ class EditDocumentController
return null;
}
list($table, $origUid, $language) = explode(':', $justLocalized);
[$table, $origUid, $language] = explode(':', $justLocalized);
if ($GLOBALS['TCA'][$table]
&& $GLOBALS['TCA'][$table]['ctrl']['languageField']
......
......@@ -122,7 +122,7 @@ class TableController extends AbstractWizardController
$normalizedParams = $request->getAttribute('normalizedParams');
$requestUri = $normalizedParams->getRequestUri();
list($rUri) = explode('#', $requestUri);
[$rUri] = explode('#', $requestUri);
$content = '<form action="' . htmlspecialchars($rUri) . '" method="post" id="TableController" name="wizardForm">';
if ($this->P['table'] && $this->P['field'] && $this->P['uid']) {
$tableWizard = $this->renderTableWizard($request);
......
......@@ -194,7 +194,7 @@ class BackendModuleRepository implements \TYPO3\CMS\Core\SingletonInterface
protected function createMenuEntriesForTbeModulesExt()
{
foreach ($GLOBALS['TBE_MODULES_EXT'] ?? [] as $mainModule => $tbeModuleExt) {
list($main) = explode('_', $mainModule);
[$main] = explode('_', $mainModule);
$mainEntry = $this->findByModuleName($main);
if ($mainEntry === false) {
continue;
......
......@@ -178,7 +178,7 @@ class TableManualRepository
protected function getTableFieldLabel($key, $field = '', $mergeToken = ': ')
{
// Get table / field parts
list($tableName, $fieldName) = $this->getTableFieldNames($key, $field);
[$tableName, $fieldName] = $this->getTableFieldNames($key, $field);
// Create label
return $this->getLanguageService()->sL($tableName) . ($field ? $mergeToken . rtrim(trim($this->getLanguageService()->sL($fieldName)), ':') : '');
}
......
......@@ -225,8 +225,7 @@ class ImageManipulationElement extends AbstractFormElement
if (MathUtility::canBeInterpretedAsInteger($fileUid)) {
try {
$file = ResourceFactory::getInstance()->getFileObject($fileUid);
} catch (FileDoesNotExistException $e) {
} catch (\InvalidArgumentException $e) {
} catch (FileDoesNotExistException|\InvalidArgumentException $e) {
}
}
return $file;
......
......@@ -329,13 +329,7 @@ class InputLinkElement extends AbstractFormElement
try {
$linkData = $linkService->resolve($linkParts['url']);
} catch (FileDoesNotExistException $e) {
return $data;
} catch (FolderDoesNotExistException $e) {
return $data;
} catch (UnknownLinkHandlerException $e) {
return $data;
} catch (InvalidPathException $e) {
} catch (FileDoesNotExistException|FolderDoesNotExistException|UnknownLinkHandlerException|InvalidPathException $e) {
return $data;
}
......
......@@ -1001,7 +1001,7 @@ abstract class AbstractItemProvider
if (!empty($foreignTableClauseArray['ORDERBY'])) {
foreach ($foreignTableClauseArray['ORDERBY'] as $orderPair) {
list($fieldName, $order) = $orderPair;
[$fieldName, $order] = $orderPair;
$queryBuilder->addOrderBy($fieldName, $order);
}
}
......
......@@ -70,7 +70,7 @@ class DatabaseRecordTypeValue implements FormDataProviderInterface
// a foreign table. localField then point to a group or select field in the own table,
// this points to a record in a foreign table and the value of foreignField is then
// used as type field. This was introduced for some FAL scenarios.
list($pointerField, $foreignTableTypeField) = explode(':', $tcaTypeField);
[$pointerField, $foreignTableTypeField] = explode(':', $tcaTypeField);
$relationType = $result['processedTca']['columns'][$pointerField]['config']['type'];
if ($relationType !== 'select' && $relationType !== 'group') {
......
......@@ -307,7 +307,7 @@ class EvaluateDisplayConditions implements FormDataProviderInterface
}
$namedConditionArray['operand'] = (int)$operand;
} elseif ($namedConditionArray['operator'] === '-' || $namedConditionArray['operator'] === '!-') {
list($minimum, $maximum) = GeneralUtility::trimExplode('-', $operand);
[$minimum, $maximum] = GeneralUtility::trimExplode('-', $operand);
if (!MathUtility::canBeInterpretedAsInteger($minimum) || !MathUtility::canBeInterpretedAsInteger($maximum)) {
throw new \RuntimeException(
'Field condition "' . $conditionString . '" with comparison operator ' . $namedConditionArray['operator']
......
......@@ -82,11 +82,7 @@ class TcaFlexPrepare implements FormDataProviderInterface
$result['databaseRow']
);
$dataStructureArray = $flexFormTools->parseDataStructureByIdentifier($dataStructureIdentifier);
} catch (InvalidParentRowException $e) {
} catch (InvalidParentRowLoopException $e) {
} catch (InvalidParentRowRootException $e) {
} catch (InvalidPointerFieldValueException $e) {
} catch (InvalidIdentifierException $e) {
} catch (InvalidParentRowException|InvalidParentRowLoopException|InvalidParentRowRootException|InvalidPointerFieldValueException|InvalidIdentifierException $e) {
} finally {
// Add the identifier to TCA to use it later during rendering
$result['processedTca']['columns'][$fieldName]['config']['dataStructureIdentifier'] = $dataStructureIdentifier;
......
......@@ -106,7 +106,7 @@ class TcaGroup implements FormDataProviderInterface
foreach ($allowed as $tablename) {
$elementValue = key($clipboard->elFromTable($tablename));
if ($elementValue) {
list($elementTable, $elementUid) = explode('|', $elementValue);
[$elementTable, $elementUid] = explode('|', $elementValue);
$record = BackendUtility::getRecordWSOL($elementTable, $elementUid);
$sanitizedClipboardElements[] = [
'title' => BackendUtility::getRecordTitle($elementTable, $record),
......@@ -118,7 +118,7 @@ class TcaGroup implements FormDataProviderInterface
// All tables allowed for relation:
$clipboardElements = array_keys($clipboard->elFromTable(''));
foreach ($clipboardElements as $elementValue) {
list($elementTable, $elementUid) = explode('|', $elementValue);
[$elementTable, $elementUid] = explode('|', $elementValue);
$record = BackendUtility::getRecordWSOL($elementTable, $elementUid);
$sanitizedClipboardElements[] = [
'title' => BackendUtility::getRecordTitle($elementTable, $record),
......
......@@ -197,7 +197,7 @@ class TcaRecordTitle implements FormDataProviderInterface
return '';
}
foreach ($fieldConfig['items'] as $item) {
list($itemLabel, $itemValue) = $item;
[$itemLabel, $itemValue] = $item;
if ((string)$value === (string)$itemValue) {
return $itemLabel;
}
......
......@@ -335,7 +335,7 @@ class SuggestWizardDefaultReceiver
$this->queryBuilder->addOrderBy($GLOBALS['TCA'][$this->table]['ctrl']['label']);
} else {
foreach (QueryHelper::parseOrderBy($this->config['orderBy']) as $orderPair) {
list($fieldName, $order) = $orderPair;
[$fieldName, $order] = $orderPair;
$this->queryBuilder->addOrderBy($fieldName, $order);
}
}
......
......@@ -45,8 +45,8 @@ class ForcedHttpsBackendRedirector implements MiddlewareInterface
} else {
$sslPortSuffix = '';
}
list(, $url) = explode('://', $request->getAttribute('normalizedParams')->getSiteUrl() . TYPO3_mainDir, 2);
list($server, $address) = explode('/', $url, 2);
[, $url] = explode('://', $request->getAttribute('normalizedParams')->getSiteUrl() . TYPO3_mainDir, 2);
[$server, $address] = explode('/', $url, 2);
return new RedirectResponse('https://' . $server . $sslPortSuffix . '/' . $address);
}
......
......@@ -174,7 +174,7 @@ class ModuleLoader
// Check if this is a submodule
$mainModule = '';
if (strpos($name, '_') !== false) {
list($mainModule, ) = explode('_', $name, 2);
[$mainModule, ] = explode('_', $name, 2);
}
// check if there is a navigation component (like the pagetree)
......
......@@ -198,7 +198,7 @@ class LiveSearch
$orderBy = $GLOBALS['TCA'][$tableName]['ctrl']['sortby'] ?: $GLOBALS['TCA'][$tableName]['ctrl']['default_sortby'];
foreach (QueryHelper::parseOrderBy((string)$orderBy) as $orderPair) {
list($fieldName, $order) = $orderPair;
[$fieldName, $order] = $orderPair;
$queryBuilder->addOrderBy($fieldName, $order);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment