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
......@@ -189,7 +189,7 @@ class LanguageStore implements \TYPO3\CMS\Core\SingletonInterface {
*/
public function getParserInstance($fileReference) {
if (isset($this->configuration[$fileReference]['parserClass']) && trim($this->configuration[$fileReference]['parserClass']) !== '') {
return \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance((string) $this->configuration[$fileReference]['parserClass']);
return \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance((string)$this->configuration[$fileReference]['parserClass']);
} else {
throw new \TYPO3\CMS\Core\Localization\Exception\InvalidParserException(sprintf('Invalid parser configuration for the current file (%s)', $fileReference), 1307293692);
}
......@@ -204,7 +204,7 @@ class LanguageStore implements \TYPO3\CMS\Core\SingletonInterface {
*/
public function getAbsoluteFileReference($fileReference) {
if (isset($this->configuration[$fileReference]['fileReference']) && trim($this->configuration[$fileReference]['fileReference']) !== '') {
return (string) $this->configuration[$fileReference]['fileReference'];
return (string)$this->configuration[$fileReference]['fileReference'];
} else {
throw new \InvalidArgumentException(sprintf('Invalid file reference configuration for the current file (%s)', $fileReference), 1307293693);
}
......
......@@ -173,9 +173,9 @@ class LocallangArrayParser implements \TYPO3\CMS\Core\Localization\Parser\Locali
* @return array
*/
protected function getContentFromCacheFile() {
$serContent = (array) unserialize(file_get_contents($this->cacheFileName));
$serContent = (array)unserialize(file_get_contents($this->cacheFileName));
$LOCAL_LANG = $serContent['LOCAL_LANG'];
return (array) $LOCAL_LANG;
return (array)$LOCAL_LANG;
}
/**
......@@ -185,7 +185,7 @@ class LocallangArrayParser implements \TYPO3\CMS\Core\Localization\Parser\Locali
* @return bool
*/
protected function isWithinWebRoot($fileName) {
return (bool) \TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName($fileName);
return (bool)\TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName($fileName);
}
/**
......
......@@ -105,8 +105,8 @@ class LocallangXmlParser extends \TYPO3\CMS\Core\Localization\Parser\AbstractXml
foreach ($children as $translationElement) {
if ($translationElement->getName() === 'label') {
// If restype would be set, it could be metadata from Gettext to XLIFF conversion (and we don't need this data)
$parsedData[(string) $translationElement['index']][0] = array(
$element => (string) $translationElement
$parsedData[(string)$translationElement['index']][0] = array(
$element => (string)$translationElement
);
}
}
......
......@@ -35,44 +35,44 @@ class XliffParser extends \TYPO3\CMS\Core\Localization\Parser\AbstractXmlParser
// If restype would be set, it could be metadata from Gettext to XLIFF conversion (and we don't need this data)
if ($this->languageKey === 'default') {
// Default language coming from an XLIFF template (no target element)
$parsedData[(string) $translationElement['id']][0] = array(
'source' => (string) $translationElement->source,
'target' => (string) $translationElement->source
$parsedData[(string)$translationElement['id']][0] = array(
'source' => (string)$translationElement->source,
'target' => (string)$translationElement->source
);
} else {
// @todo Support "approved" attribute
$parsedData[(string) $translationElement['id']][0] = array(
'source' => (string) $translationElement->source,
'target' => (string) $translationElement->target
$parsedData[(string)$translationElement['id']][0] = array(
'source' => (string)$translationElement->source,
'target' => (string)$translationElement->target
);
}
} elseif ($translationElement->getName() === 'group' && isset($translationElement['restype']) && (string) $translationElement['restype'] === 'x-gettext-plurals') {
} elseif ($translationElement->getName() === 'group' && isset($translationElement['restype']) && (string)$translationElement['restype'] === 'x-gettext-plurals') {
// This is a translation with plural forms
$parsedTranslationElement = array();
foreach ($translationElement->children() as $translationPluralForm) {
if ($translationPluralForm->getName() === 'trans-unit') {
// When using plural forms, ID looks like this: 1[0], 1[1] etc
$formIndex = substr((string) $translationPluralForm['id'], strpos((string) $translationPluralForm['id'], '[') + 1, -1);
$formIndex = substr((string)$translationPluralForm['id'], strpos((string)$translationPluralForm['id'], '[') + 1, -1);
if ($this->languageKey === 'default') {
// Default language come from XLIFF template (no target element)
$parsedTranslationElement[(int)$formIndex] = array(
'source' => (string) $translationPluralForm->source,
'target' => (string) $translationPluralForm->source
'source' => (string)$translationPluralForm->source,
'target' => (string)$translationPluralForm->source
);
} else {
// @todo Support "approved" attribute
$parsedTranslationElement[(int)$formIndex] = array(
'source' => (string) $translationPluralForm->source,
'target' => (string) $translationPluralForm->target
'source' => (string)$translationPluralForm->source,
'target' => (string)$translationPluralForm->target
);
}
}
}
if (!empty($parsedTranslationElement)) {
if (isset($translationElement['id'])) {
$id = (string) $translationElement['id'];
$id = (string)$translationElement['id'];
} else {
$id = (string) $translationElement->{'trans-unit'}[0]['id'];
$id = (string)$translationElement->{'trans-unit'}[0]['id'];
$id = substr($id, 0, strpos($id, '['));
}
$parsedData[$id] = $parsedTranslationElement;
......
......@@ -47,7 +47,7 @@ abstract class AbstractMemoryProcessor extends \TYPO3\CMS\Core\Log\Processor\Abs
* @return void
*/
public function setRealMemoryUsage($realMemoryUsage) {
$this->realMemoryUsage = (bool) $realMemoryUsage;
$this->realMemoryUsage = (bool)$realMemoryUsage;
}
/**
......@@ -66,7 +66,7 @@ abstract class AbstractMemoryProcessor extends \TYPO3\CMS\Core\Log\Processor\Abs
* @return void
*/
public function setFormatSize($formatSize) {
$this->formatSize = (bool) $formatSize;
$this->formatSize = (bool)$formatSize;
}
/**
......
......@@ -57,7 +57,7 @@ class IntrospectionProcessor extends \TYPO3\CMS\Core\Log\Processor\AbstractProce
* @return \TYPO3\CMS\Core\Log\Writer\AbstractWriter
*/
public function setShiftBackTraceLevel($shiftBackTraceLevel) {
$this->shiftBackTraceLevel = (int) $shiftBackTraceLevel;
$this->shiftBackTraceLevel = (int)$shiftBackTraceLevel;
return $this;
}
......@@ -68,7 +68,7 @@ class IntrospectionProcessor extends \TYPO3\CMS\Core\Log\Processor\AbstractProce
* @return \TYPO3\CMS\Core\Log\Writer\AbstractWriter
*/
public function setAppendFullBackTrace($appendFullBackTrace) {
$this->appendFullBackTrace = (bool) $appendFullBackTrace;
$this->appendFullBackTrace = (bool)$appendFullBackTrace;
return $this;
}
......
......@@ -142,7 +142,7 @@ class Mailer extends \Swift_Mailer {
if (is_array($mailSettings)) {
$this->mailSettings = $mailSettings;
} else {
$this->mailSettings = (array) $GLOBALS['TYPO3_CONF_VARS']['MAIL'];
$this->mailSettings = (array)$GLOBALS['TYPO3_CONF_VARS']['MAIL'];
}
}
......
......@@ -89,7 +89,7 @@ class MboxTransport implements \Swift_Transport {
\TYPO3\CMS\Core\Utility\GeneralUtility::fixPermissions($this->debugFile);
$lockObject->release();
// Return every receipient as "delivered"
$count = count((array) $message->getTo()) + count((array) $message->getCc()) + count((array) $message->getBcc());
$count = count((array)$message->getTo()) + count((array)$message->getCc()) + count((array)$message->getBcc());
return $count;
}
......
......@@ -63,7 +63,7 @@ abstract class AbstractMessage {
* @return void
*/
public function setTitle($title) {
$this->title = (string) $title;
$this->title = (string)$title;
}
/**
......@@ -82,7 +82,7 @@ abstract class AbstractMessage {
* @return void
*/
public function setMessage($message) {
$this->message = (string) $message;
$this->message = (string)$message;
}
/**
......
......@@ -1900,9 +1900,9 @@ class PageRenderer implements \TYPO3\CMS\Core\SingletonInterface {
foreach ($parts as $part) {
$a = &$a[$part];
}
$a = array_merge((array) $a, $array);
$a = array_merge((array)$a, $array);
} else {
$this->inlineSettings[$namespace] = array_merge((array) $this->inlineSettings[$namespace], $array);
$this->inlineSettings[$namespace] = array_merge((array)$this->inlineSettings[$namespace], $array);
}
} else {
$this->inlineSettings = array_merge($this->inlineSettings, $array);
......
......@@ -340,7 +340,7 @@ class File extends AbstractFile {
* @return bool
*/
public function isMissing() {
return (bool) $this->getProperty('missing');
return (bool)$this->getProperty('missing');
}
/**
......@@ -388,7 +388,7 @@ class File extends AbstractFile {
* @internal Only for usage in Indexer
*/
public function setIndexingInProgess($indexingState) {
$this->indexingInProgress = (boolean)$indexingState;
$this->indexingInProgress = (bool)$indexingState;
}
/**
......
......@@ -319,7 +319,7 @@ class FileReference implements FileInterface {
* @return bool
*/
public function isMissing() {
return (bool) $this->originalFile->getProperty('missing');
return (bool)$this->originalFile->getProperty('missing');
}
/******************
......
......@@ -67,7 +67,7 @@ class FileNameFilter {
* @return bool
*/
static public function setShowHiddenFilesAndFolders($showHiddenFilesAndFolders) {
return self::$showHiddenFilesAndFolders = (bool) $showHiddenFilesAndFolders;
return self::$showHiddenFilesAndFolders = (bool)$showHiddenFilesAndFolders;
}
}
......@@ -375,7 +375,7 @@ class Folder implements FolderInterface {
* Prepares the filters in this folder's storage according to a set filter mode.
*
* @param int $filterMode The filter mode to use; one of the FILTER_MODE_* constants
* @return array The backed up filters as an array (NULL if filters were not backed up) and whether to use filters or not (boolean)
* @return array The backed up filters as an array (NULL if filters were not backed up) and whether to use filters or not (bool)
*/
protected function prepareFiltersInStorage($filterMode) {
$backedUpFilters = NULL;
......
......@@ -75,11 +75,11 @@ class MagicImageService {
// Get maximum dimensions from the configuration of the RTE image button
$imageButtonConfiguration = (is_array($rteConfiguration['buttons.']) && is_array($rteConfiguration['buttons.']['image.'])) ? $rteConfiguration['buttons.']['image.'] : array();
if (is_array($imageButtonConfiguration['options.']) && is_array($imageButtonConfiguration['options.']['magic.'])) {
if ((int) $imageButtonConfiguration['options.']['magic.']['maxWidth'] > 0) {
$this->magicImageMaximumWidth = (int) $imageButtonConfiguration['options.']['magic.']['maxWidth'];
if ((int)$imageButtonConfiguration['options.']['magic.']['maxWidth'] > 0) {
$this->magicImageMaximumWidth = (int)$imageButtonConfiguration['options.']['magic.']['maxWidth'];
}
if ((int) $imageButtonConfiguration['options.']['magic.']['maxHeight'] > 0) {
$this->magicImageMaximumHeight = (int) $imageButtonConfiguration['options.']['magic.']['maxHeight'];
if ((int)$imageButtonConfiguration['options.']['magic.']['maxHeight'] > 0) {
$this->magicImageMaximumHeight = (int)$imageButtonConfiguration['options.']['magic.']['maxHeight'];
}
}
}
......
......@@ -356,7 +356,7 @@ class DatabaseTreeDataProvider extends \TYPO3\CMS\Core\Tree\TableConfiguration\A
*/
protected function getChildrenUidsFromParentRelation(array $row) {
$uid = $row['uid'];
switch ((string) $this->columnConfiguration['type']) {
switch ((string)$this->columnConfiguration['type']) {
case 'inline':
case 'select':
......@@ -389,7 +389,7 @@ class DatabaseTreeDataProvider extends \TYPO3\CMS\Core\Tree\TableConfiguration\A
$relatedUids = array();
$uid = $row['uid'];
$value = $row[$this->getLookupField()];
switch ((string) $this->columnConfiguration['type']) {
switch ((string)$this->columnConfiguration['type']) {
case 'inline':
case 'select':
......
......@@ -118,7 +118,7 @@ class DatabaseTreeNode extends \TYPO3\CMS\Backend\Tree\TreeRepresentationNode {
* @return void
*/
public function setHasChildren($value) {
$this->hasChildren = (bool) $value;
$this->hasChildren = (bool)$value;
}
/**
......
......@@ -71,7 +71,7 @@ class TreeDataProviderFactory {
$dataProvider->setRootUid((int)$treeConfiguration['rootUid']);
}
if (isset($treeConfiguration['appearance']['expandAll'])) {
$dataProvider->setExpandAll((bool) $treeConfiguration['appearance']['expandAll']);
$dataProvider->setExpandAll((bool)$treeConfiguration['appearance']['expandAll']);
}
if (isset($treeConfiguration['appearance']['maxLevels'])) {
$dataProvider->setLevelMaximum((int)$treeConfiguration['appearance']['maxLevels']);
......
......@@ -142,9 +142,9 @@ abstract class Enumeration implements TypeInterface {
* @return bool
*/
protected function isValid($value) {
$value = (string) $value;
$value = (string)$value;
foreach (static::$enumConstants[get_class($this)] as $constantValue) {
if ($value === (string) $constantValue) {
if ($value === (string)$constantValue) {
return TRUE;
}
}
......
......@@ -205,7 +205,7 @@ class TemplateService {
* @param bool $processExtensionStatics
*/
public function setProcessExtensionStatics($processExtensionStatics) {
$this->processExtensionStatics = (bool) $processExtensionStatics;
$this->processExtensionStatics = (bool)$processExtensionStatics;
}
/**
......@@ -285,7 +285,7 @@ class TemplateService {
if (is_array($cc['all'])) {
/** @var $matchObj \TYPO3\CMS\Frontend\Configuration\TypoScript\ConditionMatching\ConditionMatcher */
$matchObj = GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Configuration\\TypoScript\\ConditionMatching\\ConditionMatcher');
$matchObj->setRootline((array) $cc['rootLine']);
$matchObj->setRootline((array)$cc['rootLine']);
foreach ($cc['all'] as $key => $pre) {
if ($matchObj->match($pre)) {
$sectionsMatch[$key] = $pre;
......@@ -805,7 +805,7 @@ class TemplateService {
/** @var $matchObj \TYPO3\CMS\Frontend\Configuration\TypoScript\ConditionMatching\ConditionMatcher */
$matchObj = GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Configuration\\TypoScript\\ConditionMatching\\ConditionMatcher');
$matchObj->setSimulateMatchConditions($this->matchAlternative);
$matchObj->setSimulateMatchResult((bool) $this->matchAll);
$matchObj->setSimulateMatchResult((bool)$this->matchAll);
// Traverse constants text fields and parse them
foreach ($this->constants as $str) {
$constants->parse($str, $matchObj);
......
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