Commit f73029ed authored by Wouter Wolters's avatar Wouter Wolters Committed by Susanne Moog
Browse files

[TASK] Migrate to short array syntax

As decided during T3ACME we will use the short
array syntax in master. The 7.6 branch will also be done
to make backporting easier.

Resolves: #77692
Releases: master,7.6
Change-Id: I37e9484b1012fc9161148257a842054c24d162ba
Reviewed-on: https://review.typo3.org/49651

Reviewed-by: Georg Ringer's avatarGeorg Ringer <georg.ringer@gmail.com>
Tested-by: Georg Ringer's avatarGeorg Ringer <georg.ringer@gmail.com>
Reviewed-by: Susanne Moog's avatarSusanne Moog <susanne.moog@typo3.org>
Tested-by: Susanne Moog's avatarSusanne Moog <susanne.moog@typo3.org>
parent c7e65f96
......@@ -68,6 +68,7 @@ return Symfony\CS\Config\Config::create()
'extra_empty_lines',
'phpdoc_no_package',
'phpdoc_scalar',
'no_empty_lines_after_phpdocs'
'no_empty_lines_after_phpdocs',
'short_array_syntax'
])
->finder($finder);
......@@ -73,7 +73,7 @@ class ModulesController extends ActionController
*/
public function indexAction()
{
$warnings = array();
$warnings = [];
$securityWarnings = '';
// Hook for additional warnings
if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_befunc.php']['displayWarningMessages'])) {
......@@ -94,13 +94,13 @@ class ModulesController extends ActionController
}
$this->view->assignMultiple(
array(
[
'TYPO3Version' => TYPO3_version,
'copyRightNotice' => BackendUtility::TYPO3_copyRightNotice(),
'warningMessages' => $securityWarnings,
'warningTitle' => $this->languageService->sL('LLL:EXT:lang/locallang_core.xlf:warning.header'),
'modules' => $this->getModulesData()
)
]
);
}
......@@ -116,7 +116,7 @@ class ModulesController extends ActionController
$loadedModules = GeneralUtility::makeInstance(ModuleLoader::class);
$loadedModules->observeWorkspaces = true;
$loadedModules->load($GLOBALS['TBE_MODULES']);
$mainModulesData = array();
$mainModulesData = [];
foreach ($loadedModules->modules as $moduleName => $moduleInfo) {
$moduleLabels = $loadedModules->getLabelsForModule($moduleName);
$mainModuleData = [
......@@ -140,10 +140,10 @@ class ModulesController extends ActionController
*/
protected function getSubModuleData(ModuleLoader $loadedModules, $moduleName)
{
$subModulesData = array();
$subModulesData = [];
foreach ($loadedModules->modules[$moduleName]['sub'] as $subModuleName => $subModuleInfo) {
$moduleLabels = $loadedModules->getLabelsForModule($moduleName . '_' . $subModuleName);
$subModuleData = array();
$subModuleData = [];
$subModuleData['name'] = $subModuleName;
$subModuleData['icon'] = $subModuleInfo['icon'];
$subModuleData['iconIdentifier'] = $subModuleInfo['iconIdentifier'];
......
<?php
$EM_CONF[$_EXTKEY] = array(
$EM_CONF[$_EXTKEY] = [
'title' => 'Help>About',
'description' => 'Shows info about TYPO3, installed extensions and a separate module for available modules.',
'category' => 'module',
......@@ -10,11 +10,11 @@ $EM_CONF[$_EXTKEY] = array(
'author' => 'TYPO3 Core Team',
'author_email' => 'typo3cms@typo3.org',
'version' => '8.3.0',
'constraints' => array(
'depends' => array(
'constraints' => [
'depends' => [
'typo3' => '8.3.0-8.3.99',
),
'conflicts' => array(),
'suggests' => array(),
),
);
],
'conflicts' => [],
'suggests' => [],
],
];
......@@ -8,12 +8,12 @@ if (TYPO3_MODE === 'BE' && !(TYPO3_REQUESTTYPE & TYPO3_REQUESTTYPE_INSTALL)) {
'help',
'about',
'top',
array('About' => 'index'),
array(
['About' => 'index'],
[
'access' => 'user,group',
'icon' => 'EXT:about/Resources/Public/Icons/module-about.svg',
'labels' => 'LLL:EXT:lang/locallang_mod_help_about.xlf'
)
]
);
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerModule(
......@@ -21,13 +21,13 @@ if (TYPO3_MODE === 'BE' && !(TYPO3_REQUESTTYPE & TYPO3_REQUESTTYPE_INSTALL)) {
'help',
'aboutmodules',
'after:about',
array(
[
'Modules' => 'index'
),
array(
],
[
'access' => 'user,group',
'icon' => 'EXT:about/Resources/Public/Icons/module-aboutmodules.svg',
'labels' => 'LLL:EXT:about/Resources/Private/Language/Modules/aboutmodules.xlf'
)
]
);
}
......@@ -40,7 +40,7 @@ class DefaultAvatarProvider implements AvatarProviderInterface
$file = ResourceFactory::getInstance()->getFileObject($fileUid);
$processedImage = $file->process(
ProcessedFile::CONTEXT_IMAGECROPSCALEMASK,
array('width' => $size . 'c', 'height' => $size . 'c')
['width' => $size . 'c', 'height' => $size . 'c']
);
$image = GeneralUtility::makeInstance(
......
......@@ -30,12 +30,12 @@ class ClearCacheToolbarItem implements ToolbarItemInterface
/**
* @var array
*/
protected $cacheActions = array();
protected $cacheActions = [];
/**
* @var array
*/
protected $optionValues = array();
protected $optionValues = [];
/**
* @var IconFactory
......@@ -57,13 +57,13 @@ class ClearCacheToolbarItem implements ToolbarItemInterface
// Clear all page-related caches
if ($backendUser->isAdmin() || $backendUser->getTSConfigVal('options.clearCache.pages')) {
$this->cacheActions[] = array(
$this->cacheActions[] = [
'id' => 'pages',
'title' => htmlspecialchars($languageService->sL('LLL:EXT:lang/locallang_core.xlf:flushPageCachesTitle')),
'description' => htmlspecialchars($languageService->sL('LLL:EXT:lang/locallang_core.xlf:flushPageCachesDescription')),
'href' => BackendUtility::getModuleUrl('tce_db', ['vC' => $backendUser->veriCode(), 'cacheCmd' => 'pages']),
'icon' => $this->iconFactory->getIcon('actions-system-cache-clear-impact-low', Icon::SIZE_SMALL)->render()
);
];
$this->optionValues[] = 'pages';
}
......@@ -71,13 +71,13 @@ class ClearCacheToolbarItem implements ToolbarItemInterface
// or if BE-User is admin and the TSconfig explicitly disables the possibility for admins.
// This is useful for big production systems where admins accidentally could slow down the system.
if ($backendUser->getTSConfigVal('options.clearCache.all') || ($backendUser->isAdmin() && $backendUser->getTSConfigVal('options.clearCache.all') !== '0')) {
$this->cacheActions[] = array(
$this->cacheActions[] = [
'id' => 'all',
'title' => htmlspecialchars($languageService->sL('LLL:EXT:lang/locallang_core.xlf:flushAllCachesTitle2')),
'description' => htmlspecialchars($languageService->sL('LLL:EXT:lang/locallang_core.xlf:flushAllCachesDescription2')),
'href' => BackendUtility::getModuleUrl('tce_db', ['vC' => $backendUser->veriCode(), 'cacheCmd' => 'all']),
'icon' => $this->iconFactory->getIcon('actions-system-cache-clear-impact-high', Icon::SIZE_SMALL)->render()
);
];
$this->optionValues[] = 'all';
}
......@@ -134,7 +134,7 @@ class ClearCacheToolbarItem implements ToolbarItemInterface
*/
public function getDropDown()
{
$result = array();
$result = [];
$result[] = '<ul class="dropdown-list">';
foreach ($this->cacheActions as $cacheAction) {
$title = $cacheAction['description'] ?: $cacheAction['title'];
......@@ -156,7 +156,7 @@ class ClearCacheToolbarItem implements ToolbarItemInterface
*/
public function getAdditionalAttributes()
{
return array();
return [];
}
/**
......
......@@ -79,7 +79,7 @@ class HelpToolbarItem implements ToolbarItemInterface
*/
public function getDropDown()
{
$dropdown = array();
$dropdown = [];
$dropdown[] = '<ul class="dropdown-list">';
foreach ($this->helpModuleMenu->getChildren() as $module) {
/** @var BackendModule $module */
......@@ -109,7 +109,7 @@ class HelpToolbarItem implements ToolbarItemInterface
*/
public function getAdditionalAttributes()
{
return array('class' => 'typo3-module-menu-group');
return ['class' => 'typo3-module-menu-group'];
}
/**
......
......@@ -74,7 +74,7 @@ class LiveSearchToolbarItem implements ToolbarItemInterface
*/
public function getAdditionalAttributes()
{
return array('class' => 'dropdown');
return ['class' => 'dropdown'];
}
/**
......
......@@ -91,13 +91,13 @@ class ShortcutToolbarItem implements ToolbarItemInterface
$this->moduleLoader->load($GLOBALS['TBE_MODULES']);
// By default, 5 groups are set
$this->shortcutGroups = array(
$this->shortcutGroups = [
1 => '1',
2 => '1',
3 => '1',
4 => '1',
5 => '1'
);
];
$this->shortcutGroups = $this->initShortcutGroups();
$this->shortcuts = $this->initShortcuts();
......@@ -230,7 +230,7 @@ class ShortcutToolbarItem implements ToolbarItemInterface
*/
public function getAdditionalAttributes()
{
return array();
return [];
}
/**
......@@ -253,7 +253,7 @@ class ShortcutToolbarItem implements ToolbarItemInterface
$backendUser = $this->getBackendUser();
// Traverse shortcuts
$lastGroup = 0;
$shortcuts = array();
$shortcuts = [];
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
->getQueryBuilderForTable('sys_be_shortcuts');
$result = $queryBuilder->select('*')
......@@ -272,7 +272,7 @@ class ShortcutToolbarItem implements ToolbarItemInterface
->execute();
while ($row = $result->fetch()) {
$shortcut = array('raw' => $row);
$shortcut = ['raw' => $row];
list($row['module_name'], $row['M_module_name']) = explode('|', $row['module_name']);
......@@ -389,7 +389,7 @@ class ShortcutToolbarItem implements ToolbarItemInterface
*/
protected function getShortcutsByGroup($groupId)
{
$shortcuts = array();
$shortcuts = [];
foreach ($this->shortcuts as $shortcut) {
if ($shortcut['group'] == $groupId) {
$shortcuts[] = $shortcut;
......@@ -783,7 +783,7 @@ class ShortcutToolbarItem implements ToolbarItemInterface
*/
protected function getGlobalShortcutGroups()
{
$globalGroups = array();
$globalGroups = [];
foreach ($this->shortcutGroups as $groupId => $groupLabel) {
if ($groupId < 0) {
$globalGroups[$groupId] = $groupLabel;
......@@ -799,7 +799,7 @@ class ShortcutToolbarItem implements ToolbarItemInterface
*/
protected function getGroupsFromShortcuts()
{
$groups = array();
$groups = [];
foreach ($this->shortcuts as $shortcut) {
$groups[$shortcut['group']] = $this->shortcutGroups[$shortcut['group']];
}
......@@ -859,7 +859,7 @@ class ShortcutToolbarItem implements ToolbarItemInterface
$icon = '<span title="' . $titleAttribute . '">' . $this->iconFactory->getIconForRecord($table, (array)$row, Icon::SIZE_SMALL)->render() . '</span>';
} elseif ($shortcut['type'] == 'new') {
$icon = '<span title="' . $titleAttribute . '">' . $this->iconFactory->getIconForRecord($table, array(), Icon::SIZE_SMALL)->render() . '</span>';
$icon = '<span title="' . $titleAttribute . '">' . $this->iconFactory->getIconForRecord($table, [], Icon::SIZE_SMALL)->render() . '</span>';
}
break;
case 'file_edit':
......
......@@ -69,12 +69,12 @@ class SystemInformationToolbarItem implements ToolbarItemInterface
/**
* @var array
*/
protected $systemInformation = array();
protected $systemInformation = [];
/**
* @var array
*/
protected $systemMessages = array();
protected $systemMessages = [];
/**
* @var \TYPO3\CMS\Extbase\SignalSlot\Dispatcher
......@@ -153,11 +153,11 @@ class SystemInformationToolbarItem implements ToolbarItemInterface
*/
protected function getPhpVersion()
{
$this->systemInformation[] = array(
$this->systemInformation[] = [
'title' => htmlspecialchars($this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:toolbarItems.sysinfo.phpversion')),
'value' => PHP_VERSION,
'icon' => $this->iconFactory->getIcon('sysinfo-php-version', Icon::SIZE_SMALL)->render()
);
];
}
/**
......@@ -188,12 +188,12 @@ class SystemInformationToolbarItem implements ToolbarItemInterface
protected function getApplicationContext()
{
$applicationContext = GeneralUtility::getApplicationContext();
$this->systemInformation[] = array(
$this->systemInformation[] = [
'title' => htmlspecialchars($this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:toolbarItems.sysinfo.applicationcontext')),
'value' => (string)$applicationContext,
'status' => $applicationContext->isProduction() ? InformationStatus::STATUS_OK : InformationStatus::STATUS_WARNING,
'icon' => $this->iconFactory->getIcon('sysinfo-application-context', Icon::SIZE_SMALL)->render()
);
];
}
/**
......@@ -206,11 +206,11 @@ class SystemInformationToolbarItem implements ToolbarItemInterface
}
$languageService = $this->getLanguageService();
$this->systemInformation[] = array(
$this->systemInformation[] = [
'title' => htmlspecialchars($languageService->sL('LLL:EXT:lang/locallang_core.xlf:toolbarItems.sysinfo.composerMode')),
'value' => htmlspecialchars($languageService->sL('LLL:EXT:lang/locallang_core.xlf:labels.enabled')),
'icon' => $this->iconFactory->getIcon('sysinfo-composer-mode', Icon::SIZE_SMALL)->render()
);
];
}
/**
......@@ -233,11 +233,11 @@ class SystemInformationToolbarItem implements ToolbarItemInterface
$revision = trim(CommandUtility::exec('git rev-parse --short HEAD'));
$branch = trim(CommandUtility::exec('git rev-parse --abbrev-ref HEAD'));
if (!empty($revision) && !empty($branch)) {
$this->systemInformation[] = array(
$this->systemInformation[] = [
'title' => htmlspecialchars($this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:toolbarItems.sysinfo.gitrevision')),
'value' => sprintf('%s [%s]', $revision, $branch),
'icon' => $this->iconFactory->getIcon('sysinfo-git', Icon::SIZE_SMALL)->render()
);
];
}
}
......@@ -259,11 +259,11 @@ class SystemInformationToolbarItem implements ToolbarItemInterface
default:
$icon = 'windows';
}
$this->systemInformation[] = array(
$this->systemInformation[] = [
'title' => htmlspecialchars($this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:toolbarItems.sysinfo.operatingsystem')),
'value' => $kernelName . ' ' . php_uname('r'),
'icon' => $this->iconFactory->getIcon('sysinfo-os-' . $icon, Icon::SIZE_SMALL)->render()
);
];
}
/**
......@@ -271,11 +271,11 @@ class SystemInformationToolbarItem implements ToolbarItemInterface
*/
protected function getWebServer()
{
$this->systemInformation[] = array(
$this->systemInformation[] = [
'title' => htmlspecialchars($this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:toolbarItems.sysinfo.webserver')),
'value' => htmlspecialchars($_SERVER['SERVER_SOFTWARE']),
'icon' => $this->iconFactory->getIcon('sysinfo-webserver', Icon::SIZE_SMALL)->render()
);
];
}
/**
......@@ -285,7 +285,7 @@ class SystemInformationToolbarItem implements ToolbarItemInterface
*/
protected function emitGetSystemInformation()
{
$this->getSignalSlotDispatcher()->dispatch(__CLASS__, 'getSystemInformation', array($this));
$this->getSignalSlotDispatcher()->dispatch(__CLASS__, 'getSystemInformation', [$this]);
}
/**
......@@ -295,7 +295,7 @@ class SystemInformationToolbarItem implements ToolbarItemInterface
*/
protected function emitLoadMessages()
{
$this->getSignalSlotDispatcher()->dispatch(__CLASS__, 'loadMessages', array($this));
$this->getSignalSlotDispatcher()->dispatch(__CLASS__, 'loadMessages', [$this]);
}
/**
......@@ -318,12 +318,12 @@ class SystemInformationToolbarItem implements ToolbarItemInterface
$this->highestSeverity = $messageSeverity;
}
$this->systemMessages[] = array(
$this->systemMessages[] = [
'module' => $module,
'count' => (int)$count,
'status' => $messageSeverity,
'text' => $text
);
];
}
/**
......@@ -336,11 +336,11 @@ class SystemInformationToolbarItem implements ToolbarItemInterface
*/
public function addSystemInformation($title, $value, $icon)
{
$this->systemInformation[] = array(
$this->systemInformation[] = [
'title' => $title,
'value' => $value,
'icon' => $icon
);
];
}
/**
......@@ -378,13 +378,13 @@ class SystemInformationToolbarItem implements ToolbarItemInterface
$request = $this->standaloneView->getRequest();
$request->setControllerExtensionName('backend');
$this->standaloneView->assignMultiple(array(
$this->standaloneView->assignMultiple([
'installToolUrl' => BackendUtility::getModuleUrl('system_extinstall'),
'messages' => $this->systemMessages,
'count' => $this->totalCount > $this->maximumCountInBadge ? $this->maximumCountInBadge . '+' : $this->totalCount,
'severityBadgeClass' => $this->severityBadgeClass,
'systemInformation' => $this->systemInformation
));
]);
return $this->standaloneView->render();
}
......@@ -395,7 +395,7 @@ class SystemInformationToolbarItem implements ToolbarItemInterface
*/
public function getAdditionalAttributes()
{
return array();
return [];
}
/**
......
......@@ -76,7 +76,7 @@ class UserToolbarItem implements ToolbarItemInterface
$label = $languageService->getLL('switchtousershort') . ' ' . ($realName ? $realName . ' (' . $username . ')' : $username);
}
$html = array();
$html = [];
$html[] = $icon;
$html[] = '<span title="' . htmlspecialchars($title) . '">';
$html[] = htmlspecialchars($label);
......@@ -95,7 +95,7 @@ class UserToolbarItem implements ToolbarItemInterface
$backendUser = $this->getBackendUser();
$languageService = $this->getLanguageService();
$dropdown = array();
$dropdown = [];
$dropdown[] = '<ul class="dropdown-list">';
/** @var BackendModuleRepository $backendModuleRepository */
......@@ -143,7 +143,7 @@ class UserToolbarItem implements ToolbarItemInterface
*/
public function getAdditionalAttributes()
{
$result = array();
$result = [];
if ($this->getBackendUser()->user['ses_backuserid']) {
$result['class'] = 'su-user';
}
......
......@@ -70,14 +70,14 @@ class ClickMenu
*
* @var array
*/
public $iParts = array();
public $iParts = [];
/**
* Contains list of keywords of items to disable in the menu
*
* @var array
*/
public $disabledItems = array();
public $disabledItems = [];
/**
* If TRUE, Show icons on the left.
......@@ -92,7 +92,7 @@ class ClickMenu
*
* @var array
*/
public $extClassArray = array();
public $extClassArray = [];
/**
* Set, when edit icon is drawn.
......@@ -113,7 +113,7 @@ class ClickMenu
*
* @var array
*/
public $rec = array();
public $rec = [];
/**
* Clipboard set from the outside
......@@ -223,7 +223,7 @@ class ClickMenu
$uid = (int)$uid;
// Get record:
$this->rec = BackendUtility::getRecordWSOL($table, $uid);
$menuItems = array();
$menuItems = [];
$root = 0;
$DBmount = false;
// Rootlevel
......@@ -282,11 +282,11 @@ class ClickMenu
$elFromAllTables = count($this->clipObj->elFromTable(''));
if (!in_array('paste', $this->disabledItems, true) && $elFromAllTables) {
$selItem = $this->clipObj->getSelectedRecord();
$elInfo = array(
$elInfo = [
GeneralUtility::fixed_lgd_cs($selItem['_RECORD_TITLE'], $this->backendUser->uc['titleLen']),
$root ? $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'] : GeneralUtility::fixed_lgd_cs(BackendUtility::getRecordTitle($table, $this->rec), $this->backendUser->uc['titleLen']),
$this->clipObj->currentMode()
);
];
if ($table === 'pages' && $lCP & Permission::PAGE_NEW) {
if ($elFromAllTables) {
$menuItems['pasteinto'] = $this->DB_paste('', $uid, 'into', $elInfo);
......@@ -299,7 +299,7 @@ class ClickMenu
}
// Delete:
$elInfo = array(GeneralUtility::fixed_lgd_cs(BackendUtility::getRecordTitle($table, $this->rec), $this->backendUser->uc['titleLen']));
$elInfo = [GeneralUtility::fixed_lgd_cs(BackendUtility::getRecordTitle($table, $this->rec), $this->backendUser->uc['titleLen'])];
if (!in_array('delete', $this->disabledItems, true) && !$root && !$DBmount && $this->backendUser->isPSet($lCP, $table, 'delete')) {
$menuItems['spacer2'] = 'spacer';
$menuItems['delete'] = $this->DB_delete($table, $uid, $elInfo);
......@@ -308,7 +308,7 @@ class ClickMenu
$menuItems['history'] = $this->DB_history($table, $uid);
}
$localItems = array();
$localItems = [];
if (!$this->cmLevel && !in_array('moreoptions', $this->disabledItems, true)) {
// Creating menu items here:
if ($this->editOK) {
......@@ -383,7 +383,7 @@ class ClickMenu
// Processing by external functions?
$menuItems = $this->externalProcessingOfDBMenuItems($menuItems);
if (!is_array($this->rec)) {
$this->rec = array();
$this->rec = [];
}
// Return the printed elements:
......@@ -403,7 +403,7 @@ class ClickMenu
$uid = (int)$uid;
// Setting internal record to the table/uid :
$this->rec = BackendUtility::getRecordWSOL($table, $uid);
$menuItems = array();
$menuItems = [];
$root = 0;
// Rootlevel
if ($table === 'pages' && $uid === 0) {
......@@ -446,7 +446,7 @@ class ClickMenu
// Return the printed elements:
if (!is_array($menuItems)) {
$menuItems = array();
$menuItems = [];
}