Commit 321f5cbb authored by Wouter Wolters's avatar Wouter Wolters Committed by Frank Nägler
Browse files

[TASK] Remove unnecessary parentheses

These parentheses are redundant and may be safely removed.

Resolves: #84092
Releases: master
Change-Id: I59f2b7454316ecd05f57d28e344f03a65d13e5c5
Reviewed-on: https://review.typo3.org/55952

Reviewed-by: default avatarMathias Schreiber <mathias.schreiber@typo3.com>
Tested-by: default avatarMathias Schreiber <mathias.schreiber@typo3.com>
Tested-by: default avatarTYPO3com <no-reply@typo3.com>
Reviewed-by: Frank Nägler's avatarFrank Naegler <frank.naegler@typo3.org>
Tested-by: Frank Nägler's avatarFrank Naegler <frank.naegler@typo3.org>
parent a42e5eca
......@@ -30,6 +30,7 @@ use TYPO3\CMS\Core\Imaging\IconFactory;
use TYPO3\CMS\Core\Page\PageRenderer;
use TYPO3\CMS\Core\Resource\Exception\ResourceDoesNotExistException;
use TYPO3\CMS\Core\Resource\ResourceFactory;
use TYPO3\CMS\Core\Type\Bitmask\Permission;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\MathUtility;
use TYPO3\CMS\Fluid\View\StandaloneView;
......@@ -273,7 +274,7 @@ class ShortcutToolbarItem implements ToolbarItemInterface
if ($pageRow === null) {
continue;
}
if (!$backendUser->doesUserHaveAccess($pageRow, ($perms = 1))) {
if (!$backendUser->doesUserHaveAccess($pageRow, $perms = Permission::PAGE_SHOW)) {
continue;
}
}
......
......@@ -387,7 +387,7 @@ class ElementHistoryController
);
$rollbackUrl = '';
if ($rollbackUid) {
$rollbackUrl = $this->buildUrl(['rollbackFields' => ($table . ':' . $rollbackUid . ':' . $fN)]);
$rollbackUrl = $this->buildUrl(['rollbackFields' => $table . ':' . $rollbackUid . ':' . $fN]);
}
$lines[] = [
'title' => $languageService->sL(BackendUtility::getItemLabel($table, $fN)),
......
......@@ -1437,7 +1437,7 @@ class EditDocumentController
sprintf(
$lang->getLL('undoLastChange'),
BackendUtility::calcAge(
($GLOBALS['EXEC_TIME'] - $undoButtonR['tstamp']),
$GLOBALS['EXEC_TIME'] - $undoButtonR['tstamp'],
$lang->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.minutesHoursDaysYears')
)
)
......
......@@ -152,7 +152,7 @@ class NewMultiplePagesController
$subPages = $this->getSubPagesOfPage($pageUid);
$lastPage = end($subPages);
if (isset($lastPage['uid']) && MathUtility::canBeInterpretedAsInteger($lastPage['uid'])) {
$firstPid = -(int)($lastPage['uid']);
$firstPid = -(int)$lastPage['uid'];
}
}
......
......@@ -302,7 +302,7 @@ class TreeController
'backgroundColor' => htmlspecialchars($backgroundColor),
'stopPageTree' => $stopPageTree,
'class' => $this->resolvePageCssClassNames($page),
'readableRootline' => ($depth === 0 && $this->showMountPathAboveMounts ? $this->getMountPointPath($pageId) : ''),
'readableRootline' => $depth === 0 && $this->showMountPathAboveMounts ? $this->getMountPointPath($pageId) : '',
'isMountPoint' => $depth === 0,
'mountPoint' => $entryPoint,
'workspaceId' => $page['t3ver_oid'] ?: $pageId,
......
......@@ -349,7 +349,7 @@ class BackendModuleRepository implements \TYPO3\CMS\Core\SingletonInterface
*/
protected function getModuleIcon($moduleKey, $moduleData)
{
$iconIdentifier = !(empty($moduleData['iconIdentifier']))
$iconIdentifier = !empty($moduleData['iconIdentifier'])
? $moduleData['iconIdentifier']
: 'module-icon-' . $moduleKey;
$iconRegistry = GeneralUtility::makeInstance(IconRegistry::class);
......
......@@ -179,9 +179,9 @@ abstract class AbstractNode implements NodeInterface, LoggerAwareInterface
$validationRules[] = $newValidationRule;
}
if (!empty($config['maxitems']) || !empty($config['minitems'])) {
$minItems = (isset($config['minitems'])) ? (int)$config['minitems'] : 0;
$maxItems = (isset($config['maxitems'])) ? (int)$config['maxitems'] : 99999;
$type = ($config['type']) ?: 'range';
$minItems = isset($config['minitems']) ? (int)$config['minitems'] : 0;
$maxItems = isset($config['maxitems']) ? (int)$config['maxitems'] : 99999;
$type = $config['type'] ?: 'range';
$validationRules[] = [
'type' => $type,
'minItems' => $minItems,
......
......@@ -444,7 +444,7 @@ class InlineRecordContainer extends AbstractContainer
$cells['info'] = '<span class="btn btn-default disabled">' . $this->iconFactory->getIcon('empty-empty', Icon::SIZE_SMALL)->render() . '</span>';
} else {
$cells['info'] = '
<a class="btn btn-default" href="#" onclick="' . htmlspecialchars(('top.TYPO3.InfoWindow.showItem(' . GeneralUtility::quoteJSvalue($table) . ', ' . GeneralUtility::quoteJSvalue($uid) . '); return false;')) . '" title="' . htmlspecialchars($languageService->sL('LLL:EXT:lang/Resources/Private/Language/locallang_mod_web_list.xlf:showInfo')) . '">
<a class="btn btn-default" href="#" onclick="' . htmlspecialchars('top.TYPO3.InfoWindow.showItem(' . GeneralUtility::quoteJSvalue($table) . ', ' . GeneralUtility::quoteJSvalue($uid) . '); return false;') . '" title="' . htmlspecialchars($languageService->sL('LLL:EXT:lang/Resources/Private/Language/locallang_mod_web_list.xlf:showInfo')) . '">
' . $this->iconFactory->getIcon('actions-document-info', Icon::SIZE_SMALL)->render() . '
</a>';
}
......@@ -460,7 +460,7 @@ class InlineRecordContainer extends AbstractContainer
$style = ' style="' . $inlineConfig['inline']['inlineNewButtonStyle'] . '"';
}
$cells['new'] = '
<a class="btn btn-default inlineNewButton ' . $this->inlineData['config'][$nameObject]['md5'] . '" href="#" onclick="' . htmlspecialchars($onClick) . '" title="' . htmlspecialchars($languageService->sL(('LLL:EXT:lang/Resources/Private/Language/locallang_mod_web_list.xlf:new' . ($isPagesTable ? 'Page' : 'Record')))) . '" ' . $style . '>
<a class="btn btn-default inlineNewButton ' . $this->inlineData['config'][$nameObject]['md5'] . '" href="#" onclick="' . htmlspecialchars($onClick) . '" title="' . htmlspecialchars($languageService->sL('LLL:EXT:lang/Resources/Private/Language/locallang_mod_web_list.xlf:new' . ($isPagesTable ? 'Page' : 'Record'))) . '" ' . $style . '>
' . $this->iconFactory->getIcon('actions-' . ($isPagesTable ? 'page-new' : 'add'), Icon::SIZE_SMALL)->render() . '
</a>';
}
......@@ -547,14 +547,14 @@ class InlineRecordContainer extends AbstractContainer
GeneralUtility::quoteJSvalue($hiddenField) . ')';
$className = 't3js-' . $nameObjectFtId . '_disabled';
if ($rec[$hiddenField]) {
$title = htmlspecialchars($languageService->sL(('LLL:EXT:lang/Resources/Private/Language/locallang_mod_web_list.xlf:unHide' . ($isPagesTable ? 'Page' : ''))));
$title = htmlspecialchars($languageService->sL('LLL:EXT:lang/Resources/Private/Language/locallang_mod_web_list.xlf:unHide' . ($isPagesTable ? 'Page' : '')));
$cells['hide'] = '
<a class="btn btn-default hiddenHandle ' . $className . '" href="#" onclick="
' . htmlspecialchars($onClick) . '"' . 'title="' . $title . '">
' . $this->iconFactory->getIcon('actions-edit-unhide', Icon::SIZE_SMALL)->render() . '
</a>';
} else {
$title = htmlspecialchars($languageService->sL(('LLL:EXT:lang/Resources/Private/Language/locallang_mod_web_list.xlf:hide' . ($isPagesTable ? 'Page' : ''))));
$title = htmlspecialchars($languageService->sL('LLL:EXT:lang/Resources/Private/Language/locallang_mod_web_list.xlf:hide' . ($isPagesTable ? 'Page' : '')));
$cells['hide'] = '
<a class="btn btn-default hiddenHandle ' . $className . '" href="#" onclick="
' . htmlspecialchars($onClick) . '"' . 'title="' . $title . '">
......
......@@ -59,7 +59,7 @@ class SelectIcons extends AbstractNode
$html[] = '<div class="t3js-forms-select-single-icons icon-list">';
$html[] = '<div class="row">';
foreach ($selectIcons as $i => $selectIcon) {
$active = ($selectIcon['active']) ? ' active' : '';
$active = $selectIcon['active'] ? ' active' : '';
$html[] = '<div class="item' . $active . '">';
if (is_array($selectIcon)) {
$html[] = '<a href="#" title="' . htmlspecialchars($selectIcon['title'], ENT_COMPAT, 'UTF-8', false) . '" data-select-index="' . htmlspecialchars((string)$selectIcon['index']) . '">';
......
......@@ -795,7 +795,7 @@ abstract class AbstractItemProvider
: $pluginFieldName;
$excludeArrayTable[] = [
'labels' => trim($translatedTable . ' ' . $labelPrefix . ' ' . $extIdent, ': ') . ':' . $fieldLabel,
'sectionHeader' => trim(($translatedTable . ' ' . $labelPrefix . ' ' . $extIdent), ':'),
'sectionHeader' => trim($translatedTable . ' ' . $labelPrefix . ' ' . $extIdent, ':'),
'table' => $table,
'tableField' => $tableField,
'extIdent' => $extIdent,
......
......@@ -136,7 +136,7 @@ class TcaInputPlaceholders implements FormDataProviderInterface
}
$relatedFormData = $this->getRelatedFormData($foreignTableName, $possibleUids[0], $fieldNameArray[0]);
if (!empty($GLOBALS['TCA'][$result['tableName']]['ctrl']['languageField'])
&& (isset($result['databaseRow'][$GLOBALS['TCA'][$result['tableName']]['ctrl']['languageField']]))
&& isset($result['databaseRow'][$GLOBALS['TCA'][$result['tableName']]['ctrl']['languageField']])
) {
$relatedFormData['currentSysLanguage'] = $result['databaseRow'][$GLOBALS['TCA'][$result['tableName']]['ctrl']['languageField']][0];
}
......
......@@ -233,8 +233,8 @@ class FormResultCompiler
if (!empty($rtePopupWindowSize)) {
list($rtePopupWindowWidth, $rtePopupWindowHeight) = GeneralUtility::trimExplode('x', $rtePopupWindowSize);
}
$rtePopupWindowWidth = !empty($rtePopupWindowWidth) ? (int)$rtePopupWindowWidth : ($popupWindowWidth);
$rtePopupWindowHeight = !empty($rtePopupWindowHeight) ? (int)$rtePopupWindowHeight : ($popupWindowHeight);
$rtePopupWindowWidth = !empty($rtePopupWindowWidth) ? (int)$rtePopupWindowWidth : $popupWindowWidth;
$rtePopupWindowHeight = !empty($rtePopupWindowHeight) ? (int)$rtePopupWindowHeight : $popupWindowHeight;
// Make textareas resizable and flexible ("autogrow" in height)
$textareaSettings = [
......
......@@ -167,7 +167,7 @@ class ModuleLoader
}
$finalModuleConfiguration['name'] = $name;
// Language processing. This will add module labels and image reference to the internal ->moduleLabels array of the LANG object.
$this->addLabelsForModule($name, ($finalModuleConfiguration['labels'] ?? $setupInformation['labels']));
$this->addLabelsForModule($name, $finalModuleConfiguration['labels'] ?? $setupInformation['labels']);
/** @var \TYPO3\CMS\Backend\Routing\UriBuilder $uriBuilder */
$uriBuilder = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Routing\UriBuilder::class);
if (isset($setupInformation['configuration']['routeTarget'])) {
......
......@@ -170,8 +170,8 @@ class PageTsBackendLayoutDataProvider implements DataProviderInterface
{
if (!empty($data['config.']['backend_layout.']) && is_array($data['config.']['backend_layout.'])) {
$backendLayout['uid'] = substr($identifier, 0, -1);
$backendLayout['title'] = ($data['title']) ? $data['title'] : $backendLayout['uid'];
$backendLayout['icon'] = ($data['icon']) ? $data['icon'] : '';
$backendLayout['title'] = $data['title'] ? $data['title'] : $backendLayout['uid'];
$backendLayout['icon'] = $data['icon'] ?: '';
// Convert PHP array back to plain TypoScript so it can be procecced
$config = \TYPO3\CMS\Core\Utility\ArrayUtility::flatten($data['config.']);
$backendLayout['config'] = '';
......
......@@ -528,7 +528,7 @@ abstract class AbstractRecordList
} else {
$htmlCode = '<a href="#"';
if ($launchViewParameter !== '') {
$htmlCode .= ' onclick="' . htmlspecialchars(('top.TYPO3.InfoWindow.showItem(' . $launchViewParameter . '); return false;')) . '"';
$htmlCode .= ' onclick="' . htmlspecialchars('top.TYPO3.InfoWindow.showItem(' . $launchViewParameter . '); return false;') . '"';
}
$htmlCode .= ' title="' . htmlspecialchars($this->getLanguageService()->sL('LLL:EXT:backend/Resources/Private/Language/locallang.xlf:show_references') . ' (' . $references . ')') . '">';
$htmlCode .= $references;
......
......@@ -1239,7 +1239,7 @@ class BackendUtility
$fileReference = ResourceFactory::getInstance()->getFileReferenceObject(
$referenceUid,
[],
($workspaceId === 0)
$workspaceId === 0
);
$fileReferences[$fileReference->getUid()] = $fileReference;
} catch (\TYPO3\CMS\Core\Resource\Exception\FileDoesNotExistException $e) {
......@@ -2174,7 +2174,7 @@ class BackendUtility
) {
$ageSuffix = ' (' . ($GLOBALS['EXEC_TIME'] - $value > 0 ? '-' : '')
. self::calcAge(
abs(($GLOBALS['EXEC_TIME'] - $value)),
abs($GLOBALS['EXEC_TIME'] - $value),
$lang->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.minutesHoursDaysYears')
)
. ')';
......@@ -3254,7 +3254,7 @@ class BackendUtility
$queryBuilder->expr()->gt(
'sys_lockedrecords.tstamp',
$queryBuilder->createNamedParameter(
($GLOBALS['EXEC_TIME'] - 2 * 3600),
$GLOBALS['EXEC_TIME'] - 2 * 3600,
\PDO::PARAM_INT
)
)
......@@ -4255,12 +4255,12 @@ class BackendUtility
$lang->sL('LLL:EXT:lang/Resources/Private/Language/locallang_login.xlf:extension.copyright') . ' ' .
sprintf(
$lang->sL('LLL:EXT:lang/Resources/Private/Language/locallang_login.xlf:details.link'),
('<a href="' . TYPO3_URL_GENERAL . '" target="_blank">' . TYPO3_URL_GENERAL . '</a>')
'<a href="' . TYPO3_URL_GENERAL . '" target="_blank">' . TYPO3_URL_GENERAL . '</a>'
) . ' ' .
strip_tags($warrantyNote, '<a>') . ' ' .
sprintf(
$lang->sL('LLL:EXT:lang/Resources/Private/Language/locallang_login.xlf:free.software'),
('<a href="' . TYPO3_URL_LICENSE . '" target="_blank">'),
'<a href="' . TYPO3_URL_LICENSE . '" target="_blank">',
'</a> '
)
. $lang->sL('LLL:EXT:lang/Resources/Private/Language/locallang_login.xlf:keep.notice');
......
......@@ -1305,7 +1305,14 @@ class PageLayoutView implements LoggerAwareInterface
// "View page" icon is added:
$viewLink = '';
if (!VersionState::cast($this->getPageLayoutController()->pageinfo['t3ver_state'])->equals(VersionState::DELETE_PLACEHOLDER)) {
$onClick = BackendUtility::viewOnClick($this->id, '', BackendUtility::BEgetRootLine($this->id), '', '', ('&L=' . $lP));
$onClick = BackendUtility::viewOnClick(
$this->id,
'',
BackendUtility::BEgetRootLine($this->id),
'',
'',
'&L=' . $lP
);
$viewLink = '<a href="#" class="btn btn-default btn-sm" onclick="' . htmlspecialchars($onClick) . '" title="' . htmlspecialchars($this->getLanguageService()->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.showPage')) . '">' . $this->iconFactory->getIcon('actions-view', Icon::SIZE_SMALL)->render() . '</a>';
}
// Language overlay page header:
......@@ -1412,8 +1419,8 @@ class PageLayoutView implements LoggerAwareInterface
}
$out .= '
<tr>
<td valign="top" class="t3-grid-cell">' . implode(('</td>' . '
<td valign="top" class="t3-grid-cell">'), $cCont) . '</td>
<td valign="top" class="t3-grid-cell">' . implode('</td>' . '
<td valign="top" class="t3-grid-cell">', $cCont) . '</td>
</tr>';
}
}
......@@ -3757,7 +3764,7 @@ class PageLayoutView implements LoggerAwareInterface
case 'info':
// "Info": (All records)
$code = '<a href="#" onclick="' . htmlspecialchars(
('top.TYPO3.InfoWindow.showItem(\'' . $table . '\', \'' . $row['uid'] . '\'); return false;')
'top.TYPO3.InfoWindow.showItem(\'' . $table . '\', \'' . $row['uid'] . '\'); return false;'
) . '" title="' . htmlspecialchars($lang->getLL('showInfo')) . '">' . $code . '</a>';
break;
default:
......@@ -4458,7 +4465,7 @@ class PageLayoutView implements LoggerAwareInterface
$htmlCode = '<a href="#"';
if ($launchViewParameter !== '') {
$htmlCode .= ' onclick="' . htmlspecialchars(
('top.TYPO3.InfoWindow.showItem(' . $launchViewParameter . '); return false;')
'top.TYPO3.InfoWindow.showItem(' . $launchViewParameter . '); return false;'
) . '"';
}
$htmlCode .= ' title="' . htmlspecialchars(
......
......@@ -666,7 +666,7 @@ class BackendUserAuthentication extends AbstractUserAuthentication
// Checking value:
switch ((string)$authMode) {
case 'explicitAllow':
if (!GeneralUtility::inList($this->groupData['explicit_allowdeny'], ($testValue . ':ALLOW'))) {
if (!GeneralUtility::inList($this->groupData['explicit_allowdeny'], $testValue . ':ALLOW')) {
$out = false;
}
break;
......@@ -683,7 +683,10 @@ class BackendUserAuthentication extends AbstractUserAuthentication
if ((string)$iCfg[1] === (string)$value && $iCfg[4]) {
switch ((string)$iCfg[4]) {
case 'EXPL_ALLOW':
if (!GeneralUtility::inList($this->groupData['explicit_allowdeny'], ($testValue . ':ALLOW'))) {
if (!GeneralUtility::inList(
$this->groupData['explicit_allowdeny'],
$testValue . ':ALLOW'
)) {
$out = false;
}
break;
......
......@@ -183,7 +183,13 @@ class FileBackend extends \TYPO3\CMS\Core\Cache\Backend\SimpleFileBackend implem
if ($this->isCacheFileExpired($pathAndFilename)) {
return false;
}
$dataSize = (int)file_get_contents($pathAndFilename, null, null, (filesize($pathAndFilename) - self::DATASIZE_DIGITS), self::DATASIZE_DIGITS);
$dataSize = (int)file_get_contents(
$pathAndFilename,
null,
null,
filesize($pathAndFilename) - self::DATASIZE_DIGITS,
self::DATASIZE_DIGITS
);
return file_get_contents($pathAndFilename, null, null, 0, $dataSize);
}
......@@ -203,7 +209,7 @@ class FileBackend extends \TYPO3\CMS\Core\Cache\Backend\SimpleFileBackend implem
if ($entryIdentifier !== basename($entryIdentifier)) {
throw new \InvalidArgumentException('The specified entry identifier must not contain a path segment.', 1282073034);
}
return !$this->isCacheFileExpired(($this->cacheDirectory . $entryIdentifier . $this->cacheEntryFileExtension));
return !$this->isCacheFileExpired($this->cacheDirectory . $entryIdentifier . $this->cacheEntryFileExtension);
}
/**
......@@ -255,7 +261,13 @@ class FileBackend extends \TYPO3\CMS\Core\Cache\Backend\SimpleFileBackend implem
continue;
}
$cacheEntryPathAndFilename = $directoryIterator->getPathname();
$index = (int)file_get_contents($cacheEntryPathAndFilename, null, null, (filesize($cacheEntryPathAndFilename) - self::DATASIZE_DIGITS), self::DATASIZE_DIGITS);
$index = (int)file_get_contents(
$cacheEntryPathAndFilename,
null,
null,
filesize($cacheEntryPathAndFilename) - self::DATASIZE_DIGITS,
self::DATASIZE_DIGITS
);
$metaData = file_get_contents($cacheEntryPathAndFilename, null, null, $index);
$expiryTime = (int)substr($metaData, 0, self::EXPIRYTIME_LENGTH);
if ($expiryTime !== 0 && $expiryTime < $now) {
......@@ -315,7 +327,13 @@ class FileBackend extends \TYPO3\CMS\Core\Cache\Backend\SimpleFileBackend implem
if (file_exists($cacheEntryPathAndFilename) === false) {
return true;
}
$index = (int)file_get_contents($cacheEntryPathAndFilename, null, null, (filesize($cacheEntryPathAndFilename) - self::DATASIZE_DIGITS), self::DATASIZE_DIGITS);
$index = (int)file_get_contents(
$cacheEntryPathAndFilename,
null,
null,
filesize($cacheEntryPathAndFilename) - self::DATASIZE_DIGITS,
self::DATASIZE_DIGITS
);
$expiryTime = (int)file_get_contents($cacheEntryPathAndFilename, null, null, $index, self::EXPIRYTIME_LENGTH);
return $expiryTime !== 0 && $expiryTime < $GLOBALS['EXEC_TIME'];
}
......
......@@ -506,7 +506,7 @@ class RedisBackend extends AbstractBackend implements TaggableBackendInterface
foreach ($identifierToTagsKeys as $identifierToTagsKey) {
list(, $identifier) = explode(':', $identifierToTagsKey);
// Check if the data entry still exists
if (!$this->redis->exists((self::IDENTIFIER_DATA_PREFIX . $identifier))) {
if (!$this->redis->exists(self::IDENTIFIER_DATA_PREFIX . $identifier)) {
$tagsToRemoveIdentifierFrom = $this->redis->sMembers($identifierToTagsKey);
$queue = $this->redis->multi(\Redis::PIPELINE);
$queue->delete($identifierToTagsKey);
......
Markdown is supported
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