Commit 3252a22c authored by Wouter Wolters's avatar Wouter Wolters Committed by Markus Klein
Browse files

[CLEANUP] Use correct casting syntax

Resolves: #62664
Releases: master
Change-Id: Ib8e0695fc234ab67a2f73a65737e07cf9a2d19c6
Reviewed-on: http://review.typo3.org/33757


Reviewed-by: Anja Leichsenring's avatarAnja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring's avatarAnja Leichsenring <aleichsenring@ab-softlab.de>
Reviewed-by: default avatarMarkus Klein <klein.t3@reelworx.at>
Tested-by: default avatarMarkus Klein <klein.t3@reelworx.at>
parent fdcabab3
......@@ -221,7 +221,7 @@ class Clipboard {
if (is_array($CBarr)) {
foreach ($CBarr as $k => $v) {
$p = explode('|', $k);
if ((string) $p[0] != (string) $table || $removeDeselected && !$v) {
if ((string)$p[0] != (string)$table || $removeDeselected && !$v) {
unset($CBarr[$k]);
}
}
......@@ -779,11 +779,11 @@ class Clipboard {
if ($v) {
list($table, $uid) = explode('|', $k);
if ($table != '_FILE') {
if ((!$matchTable || (string) $table == (string) $matchTable) && $GLOBALS['TCA'][$table]) {
if ((!$matchTable || (string)$table == (string)$matchTable) && $GLOBALS['TCA'][$table]) {
$list[$k] = $pad == 'normal' ? $v : $uid;
}
} else {
if ((string) $table == (string) $matchTable) {
if ((string)$table == (string)$matchTable) {
$list[$k] = $v;
}
}
......
......@@ -57,7 +57,7 @@ class ConditionMatcher extends \TYPO3\CMS\Core\Configuration\TypoScript\Conditio
break;
case 'adminUser':
if ($this->isUserLoggedIn()) {
$result = !((bool) $value xor $this->isAdminUser());
$result = !((bool)$value xor $this->isAdminUser());
return $result;
}
break;
......
......@@ -44,7 +44,7 @@ abstract class AbstractExtdirectContextMenu extends \TYPO3\CMS\Backend\ContextMe
$this->setDataProvider($dataProvider);
}
/** @var $node \TYPO3\CMS\Backend\Tree\TreeNode */
$node = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Tree\\TreeNode', (array) $nodeData);
$node = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Tree\\TreeNode', (array)$nodeData);
$actions = $this->dataProvider->getActionsForNode($node);
return $actions;
}
......
......@@ -40,7 +40,7 @@ class ContextMenuConfiguration extends \TYPO3\CMS\Backend\ContextMenu\Extdirect\
*/
public function getActionsForNodeArray($nodeData) {
/** @var $node \TYPO3\CMS\Backend\Tree\Pagetree\PagetreeNode */
$node = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Tree\\Pagetree\\PagetreeNode', (array) $nodeData);
$node = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Tree\\Pagetree\\PagetreeNode', (array)$nodeData);
$node->setRecord(\TYPO3\CMS\Backend\Tree\Pagetree\Commands::getNodeRecord($node->getId()));
$this->initDataProvider();
$this->dataProvider->setContextMenuType('table.' . $node->getType());
......
......@@ -133,7 +133,7 @@ class ElementInformationController {
// Check permissions and uid value:
if ($this->uid && $GLOBALS['BE_USER']->check('tables_select', $this->table)) {
if ((string) $this->table == 'pages') {
if ((string)$this->table == 'pages') {
$this->pageinfo = BackendUtility::readPageAccess($this->uid, $this->perms_clause);
$this->access = is_array($this->pageinfo) ? 1 : 0;
$this->row = $this->pageinfo;
......
......@@ -139,7 +139,7 @@ class MoveElementController {
// Reset variable to pick up the module content in:
$code = '';
// IF the table is "pages":
if ((string) $this->table == 'pages') {
if ((string)$this->table == 'pages') {
// Get page record (if accessible):
$pageinfo = BackendUtility::readPageAccess($this->page_id, $this->perms_clause);
if (is_array($pageinfo) && $GLOBALS['BE_USER']->isInWebMount($pageinfo['pid'], $this->perms_clause)) {
......@@ -162,7 +162,7 @@ class MoveElementController {
}
}
// IF the table is "tt_content":
if ((string) $this->table == 'tt_content') {
if ((string)$this->table == 'tt_content') {
// First, get the record:
$tt_content_rec = BackendUtility::getRecord('tt_content', $this->moveUid);
// ?
......@@ -245,9 +245,9 @@ class MoveElementController {
'back' => ''
);
if ($this->page_id) {
if ((string) $this->table == 'pages') {
if ((string)$this->table == 'pages') {
$buttons['csh'] = BackendUtility::cshItem('xMOD_csh_corebe', 'move_el_pages', $GLOBALS['BACK_PATH'], '', TRUE);
} elseif ((string) $this->table == 'tt_content') {
} elseif ((string)$this->table == 'tt_content') {
$buttons['csh'] = BackendUtility::cshItem('xMOD_csh_corebe', 'move_el_cs', $GLOBALS['BACK_PATH'], '', TRUE);
}
if ($this->R_URI) {
......
......@@ -353,7 +353,7 @@ class NewContentElementController {
$showAll = $wizardGroup['show'] === '*';
$groupItems = array();
if (is_array($appendWizards[$groupKey . '.']['elements.'])) {
$wizardElements = array_merge((array) $wizardGroup['elements.'], $appendWizards[$groupKey . '.']['elements.']);
$wizardElements = array_merge((array)$wizardGroup['elements.'], $appendWizards[$groupKey . '.']['elements.']);
} else {
$wizardElements = $wizardGroup['elements.'];
}
......
......@@ -864,7 +864,7 @@ class EditDocumentController {
}
// Check internals regarding access:
$isRootLevelRestrictionIgnored = BackendUtility::isRootLevelRestrictionIgnored($table);
if ($hasAccess || (string) $calcPRec['pid'] === '0' && $isRootLevelRestrictionIgnored) {
if ($hasAccess || (string)$calcPRec['pid'] === '0' && $isRootLevelRestrictionIgnored) {
$hasAccess = $GLOBALS['BE_USER']->recordEditAccessInternals($table, $calcPRec);
$deniedAccessReason = $GLOBALS['BE_USER']->errorMsg;
}
......
......@@ -85,8 +85,8 @@ class FileSystemNavigationFrameController {
$this->currentSubScript = GeneralUtility::_GP('currentSubScript');
$this->cMR = GeneralUtility::_GP('cMR');
$scopeData = (string) GeneralUtility::_GP('scopeData');
$scopeHash = (string) GeneralUtility::_GP('scopeHash');
$scopeData = (string)GeneralUtility::_GP('scopeData');
$scopeHash = (string)GeneralUtility::_GP('scopeHash');
if (!empty($scopeData) && GeneralUtility::hmac($scopeData) === $scopeHash) {
$this->scopeData = unserialize($scopeData);
......
......@@ -394,7 +394,7 @@ class LoginController {
$this->redirectToURL = 'index.php?commandLI=setCookie';
}
}
if ($redirectToURL = (string) $GLOBALS['BE_USER']->getTSConfigVal('auth.BE.redirectToURL')) {
if ($redirectToURL = (string)$GLOBALS['BE_USER']->getTSConfigVal('auth.BE.redirectToURL')) {
$this->redirectToURL = $redirectToURL;
$this->GPinterface = '';
}
......
......@@ -29,7 +29,7 @@ use TYPO3\CMS\Core\Utility\GeneralUtility;
class SimpleDataHandlerController {
/**
* Array. Accepts options to be set in TCE object. Currently it supports "reverseOrder" (boolean).
* Array. Accepts options to be set in TCE object. Currently it supports "reverseOrder" (bool).
*
* @var array
*/
......
......@@ -162,7 +162,7 @@ class AddController {
$flexToolObj = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Configuration\\FlexForm\\FlexFormTools');
$curValueOfFlexform = $flexToolObj->getArrayValueByPath($this->P['flexFormPath'], $currentFlexFormData);
$insertValue = '';
switch ((string) $this->P['params']['setValue']) {
switch ((string)$this->P['params']['setValue']) {
case 'set':
$insertValue = $addEl;
break;
......@@ -177,7 +177,7 @@ class AddController {
$data[$this->P['table']][$this->P['uid']][$this->P['field']] = array();
$flexToolObj->setArrayValueByPath($this->P['flexFormPath'], $data[$this->P['table']][$this->P['uid']][$this->P['field']], $insertValue);
} else {
switch ((string) $this->P['params']['setValue']) {
switch ((string)$this->P['params']['setValue']) {
case 'set':
$data[$this->P['table']][$this->P['uid']][$this->P['field']] = $addEl;
break;
......
......@@ -415,7 +415,7 @@ class FormsController {
$temp_cells[$GLOBALS['LANG']->getLL('forms_fieldName')] = '<input type="text"' . $this->doc->formWidth(10) . ' name="FORMCFG[c][' . ($k + 1) * 2 . '][fieldname]" value="' . htmlspecialchars($confData['fieldname']) . '" title="' . $GLOBALS['LANG']->getLL('forms_fieldName', TRUE) . '" />';
}
// Field configuration depending on the fields type:
switch ((string) $confData['type']) {
switch ((string)$confData['type']) {
case 'textarea':
$temp_cells[$GLOBALS['LANG']->getLL('forms_cols')] = '<input type="text"' . $this->doc->formWidth(5) . ' name="FORMCFG[c][' . ($k + 1) * 2 . '][cols]" value="' . htmlspecialchars($confData['cols']) . '" title="' . $GLOBALS['LANG']->getLL('forms_cols', TRUE) . '" />';
$temp_cells[$GLOBALS['LANG']->getLL('forms_rows')] = '<input type="text"' . $this->doc->formWidth(5) . ' name="FORMCFG[c][' . ($k + 1) * 2 . '][rows]" value="' . htmlspecialchars($confData['rows']) . '" title="' . $GLOBALS['LANG']->getLL('forms_rows', TRUE) . '" />';
......@@ -437,7 +437,7 @@ class FormsController {
break;
}
// Field configuration depending on the fields type:
switch ((string) $confData['type']) {
switch ((string)$confData['type']) {
case 'textarea':
case 'input':
......@@ -651,7 +651,7 @@ class FormsController {
$thisLine[1] = ($vv['required'] ? '*' : '') . str_replace(',', '', (($vv['fieldname'] ? $vv['fieldname'] . '=' : '') . $vv['type']));
// Default:
$tArr = array('', '', '', '', '', '');
switch ((string) $vv['type']) {
switch ((string)$vv['type']) {
case 'textarea':
if ((int)$vv['cols']) {
$tArr[0] = (int)$vv['cols'];
......@@ -775,7 +775,7 @@ class FormsController {
} else {
$confData['fieldname'] = str_replace(' ', '_', trim($typeParts[0]));
}
switch ((string) $confData['type']) {
switch ((string)$confData['type']) {
case 'select':
case 'radio':
$confData['default'] = implode(LF, GeneralUtility::trimExplode(',', $parts[2]));
......@@ -784,7 +784,7 @@ class FormsController {
$confData['default'] = trim($parts[2]);
}
// Field configuration depending on the fields type:
switch ((string) $confData['type']) {
switch ((string)$confData['type']) {
case 'textarea':
$confData['cols'] = $fParts[1];
$confData['rows'] = $fParts[2];
......
......@@ -96,7 +96,7 @@ class DataPreprocessor {
$idList = $this->prevPageID;
}
if ($GLOBALS['TCA'][$table]) {
// For each ID value (integer) we
// For each ID value (int) we
$ids = GeneralUtility::trimExplode(',', $idList, TRUE);
foreach ($ids as $id) {
// If ID is not blank:
......@@ -181,7 +181,7 @@ class DataPreprocessor {
* The resulting, processed row is stored in $this->regTableItems_data[$uniqueItemRef], where $uniqueItemRef is "[tablename]_[id-value]"
*
* @param string $table The table name
* @param string $id The uid value of the record (integer). Can also be a string (NEW-something) if the record is a NEW record.
* @param string $id The uid value of the record (int). Can also be a string (NEW-something) if the record is a NEW record.
* @param int $pid The pid integer. For existing records this is of course the row's "pid" field. For new records it can be either a page id (positive) or a pointer to another record from the SAME table (negative) after which the record should be inserted (or on same page)
* @param array $row The row of the current record. If NEW record, then it may be loaded with default values (by eg. fetchRecord()).
* @return void
......@@ -223,7 +223,7 @@ class DataPreprocessor {
* The resulting, processed row will be returned.
*
* @param string $table The table name
* @param string $id The uid value of the record (integer). Can also be a string (NEW-something) if the record is a NEW record.
* @param string $id The uid value of the record (int). Can also be a string (NEW-something) if the record is a NEW record.
* @param int $pid The pid integer. For existing records this is of course the row's "pid" field. For new records it can be either a page id (positive) or a pointer to another record from the SAME table (negative) after which the record should be inserted (or on same page)
* @param array $row The row of the current record. If NEW record, then it may be loaded with default values (by eg. fetchRecord()).
* @param array $TSconfig Tsconfig array
......
......@@ -75,7 +75,7 @@ class GroupElement extends AbstractFormElement {
. '\', \'RemoveFirstIfFull\', \'' . $maxitems . '\'); ' . $additionalInformation['fieldChangeFunc']['TBE_EDITOR_fieldChanged'];
}
// Acting according to either "file" or "db" type:
switch ((string) $config['internal_type']) {
switch ((string)$config['internal_type']) {
case 'file_reference':
$config['uploadfolder'] = '';
// Fall through
......
......@@ -1276,7 +1276,7 @@ class InlineElement {
* Handle AJAX calls to localize all records of a parent, localize a single record or to synchronize with the original language parent.
*
* @param string $domObjectId The calling object in hierarchy, that requested a new record.
* @param mixed $type Defines the type 'localize' or 'synchronize' (string) or a single uid to be localized (integer)
* @param mixed $type Defines the type 'localize' or 'synchronize' (string) or a single uid to be localized (int)
* @return array An array to be used for JSON
*/
protected function synchronizeLocalizeRecords($domObjectId, $type) {
......@@ -1418,7 +1418,7 @@ class InlineElement {
$top = $this->getStructureLevel(0);
// Only do some action if the top record and the current record were saved before
if (MathUtility::canBeInterpretedAsInteger($top['uid'])) {
$inlineView = (array) unserialize($GLOBALS['BE_USER']->uc['inlineView']);
$inlineView = (array)unserialize($GLOBALS['BE_USER']->uc['inlineView']);
$inlineViewCurrent = &$inlineView[$top['table']][$top['uid']];
$expandUids = GeneralUtility::trimExplode(',', $expand);
$collapseUids = GeneralUtility::trimExplode(',', $collapse);
......@@ -2463,7 +2463,7 @@ class InlineElement {
*/
static public function updateInlineView(&$uc, $tce) {
if (isset($uc['inlineView']) && is_array($uc['inlineView'])) {
$inlineView = (array) unserialize($GLOBALS['BE_USER']->uc['inlineView']);
$inlineView = (array)unserialize($GLOBALS['BE_USER']->uc['inlineView']);
foreach ($uc['inlineView'] as $topTable => $topRecords) {
foreach ($topRecords as $topUid => $childElements) {
foreach ($childElements as $childTable => $childRecords) {
......
......@@ -683,7 +683,7 @@ class SelectElement extends AbstractFormElement {
}
// Non-selectable element:
$nonSel = '';
if ((string) $p[1] === '--div--') {
if ((string)$p[1] === '--div--') {
$nonSel = ' onclick="this.selected=0;" class="c-divider"';
}
// Icon style for option tag:
......
......@@ -299,7 +299,7 @@ class SuggestDefaultReceiver {
if (!BackendUtility::readPageAccess($uid, $GLOBALS['BE_USER']->getPagePermsClause(1))) {
$retValue = FALSE;
}
} elseif (isset($GLOBALS['TCA'][$table]['ctrl']['is_static']) && (bool) $GLOBALS['TCA'][$table]['ctrl']['is_static']) {
} elseif (isset($GLOBALS['TCA'][$table]['ctrl']['is_static']) && (bool)$GLOBALS['TCA'][$table]['ctrl']['is_static']) {
$retValue = TRUE;
} else {
if (!is_array(BackendUtility::readPageAccess($row['pid'], $GLOBALS['BE_USER']->getPagePermsClause(1)))) {
......
......@@ -194,7 +194,7 @@ class ElementConditionMatcher {
switch ($operator) {
case 'REQ':
if (strtoupper($operand) === 'TRUE') {
$result = (bool) $fieldValue;
$result = (bool)$fieldValue;
} else {
$result = !$fieldValue;
}
......@@ -245,7 +245,7 @@ class ElementConditionMatcher {
* @return bool
*/
protected function matchHideForNonAdminsCondition() {
return (bool) $this->getBackendUser()->isAdmin();
return (bool)$this->getBackendUser()->isAdmin();
}
/**
......
......@@ -1786,7 +1786,7 @@ class FormEngine {
$typeNum = $GLOBALS['TCA'][$table]['types']['0'] ? 0 : 1;
}
// Force to string. Necessary for eg '-1' to be recognized as a type value.
$typeNum = (string) $typeNum;
$typeNum = (string)$typeNum;
return $typeNum;
}
......@@ -2589,7 +2589,7 @@ class FormEngine {
} else {
$icon = $iTitle;
}
switch ((string) $wConf['type']) {
switch ((string)$wConf['type']) {
case 'userFunc':
case 'script':
......@@ -2676,7 +2676,7 @@ class FormEngine {
$url = $this->backPath . $wScript . (strstr($wScript, '?') ? '' : '?');
// If "script" type, create the links around the icon:
if ((string) $wConf['type'] === 'script') {
if ((string)$wConf['type'] === 'script') {
$aUrl = $url . GeneralUtility::implodeArrayForUrl('', array('P' => $params));
$outArr[] = '<a href="' . htmlspecialchars($aUrl) . '" onclick="this.blur(); return !TBE_EDITOR.isFormChanged();">' . $icon . '</a>';
} else {
......@@ -2686,7 +2686,7 @@ class FormEngine {
$params['hmac'] = GeneralUtility::hmac($params['formName'] . $params['itemName'], 'wizard_js');
$params['fieldChangeFunc'] = $fieldChangeFunc;
$params['fieldChangeFuncHash'] = GeneralUtility::hmac(serialize($fieldChangeFunc));
switch ((string) $wConf['type']) {
switch ((string)$wConf['type']) {
case 'popup':
case 'colorbox':
// Current form value is passed as P[currentValue]!
......@@ -2704,7 +2704,7 @@ class FormEngine {
. 'vHWin.focus();return false;';
// Setting "colorBoxLinks" - user LATER to wrap around the color box as well:
$colorBoxLinks = array('<a href="#" onclick="' . htmlspecialchars($aOnClick) . '">', '</a>');
if ((string) $wConf['type'] == 'popup') {
if ((string)$wConf['type'] == 'popup') {
$outArr[] = $colorBoxLinks[0] . $icon . $colorBoxLinks[1];
}
break;
......@@ -2774,7 +2774,7 @@ class FormEngine {
break;
}
// Color wizard colorbox:
if ((string) $wConf['type'] === 'colorbox') {
if ((string)$wConf['type'] === 'colorbox') {
$dim = GeneralUtility::intExplode('x', $wConf['dim']);
$dX = MathUtility::forceIntegerInRange($dim[0], 1, 200, 20);
$dY = MathUtility::forceIntegerInRange($dim[1], 1, 200, 20);
......
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