Commit 37b7f532 authored by Anja Leichsenring's avatar Anja Leichsenring Committed by Tymoteusz Motylewski
Browse files

[TASK] Adjust Cs-Fixer 2.0 hits

With the update of cs-fixer to version 2.0, some checks
got minor changes in behaviour. The core follows now in
applying those suggested changes.

Resolves: #79469
Relates: #79361
Releases: master
Change-Id: I5d17b750231dcb386002b3e46b3a89c59eca2989
Reviewed-on: https://review.typo3.org/51428

Tested-by: default avatarTYPO3com <no-reply@typo3.com>
Reviewed-by: Jigal van Hemert's avatarJigal van Hemert <jigal.van.hemert@typo3.org>
Tested-by: Jigal van Hemert's avatarJigal van Hemert <jigal.van.hemert@typo3.org>
Reviewed-by: Tymoteusz Motylewski's avatarTymoteusz Motylewski <t.motylewski@gmail.com>
Tested-by: Tymoteusz Motylewski's avatarTymoteusz Motylewski <t.motylewski@gmail.com>
parent 2c23ecdf
......@@ -54,7 +54,7 @@ class FullRecordContainer extends AbstractContainer
array_unshift($fieldsArray, '--div--;LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.generalTab');
}
// If first tab has no label definition, add "general" label
$firstTabHasLabel = count(GeneralUtility::trimExplode(';', $fieldsArray[0])) > 1;
$firstTabHasLabel = count(GeneralUtility::trimExplode(';', $fieldsArray[0])) > 1;
if (!$firstTabHasLabel) {
$fieldsArray[0] = '--div--;LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.generalTab';
}
......
......@@ -602,7 +602,7 @@ class SingleFieldContainer extends AbstractContainer
*/
protected function isAssociativeArray($object)
{
return is_array($object) && !empty($object) && array_keys($object) !== range(0, sizeof($object) - 1);
return is_array($object) && !empty($object) && array_keys($object) !== range(0, count($object) - 1);
}
/**
......
......@@ -78,7 +78,7 @@ class CheckboxElement extends AbstractFormElement
$label = $itemDefinition[0];
$html .=
'<div class="checkbox-column ' . $colClass . '">'
. $this->renderSingleCheckboxElement($label, $itemKey, $formElementValue, $numberOfItems, $this->data['parameterArray'], $disabled) .
. $this->renderSingleCheckboxElement($label, $itemKey, $formElementValue, $numberOfItems, $this->data['parameterArray'], $disabled) .
'</div>';
$counter = $counter + 1;
if ($counter < $numberOfItems && !empty($colClear)) {
......
......@@ -217,7 +217,7 @@ class RedisBackend extends AbstractBackend implements TaggableBackendInterface
*/
public function setDatabase($database)
{
if (!is_integer($database)) {
if (!is_int($database)) {
throw new \InvalidArgumentException('The specified database number is of type "' . gettype($database) . '" but an integer is expected.', 1279763057);
}
if ($database < 0) {
......@@ -266,7 +266,7 @@ class RedisBackend extends AbstractBackend implements TaggableBackendInterface
*/
public function setCompressionLevel($compressionLevel)
{
if (!is_integer($compressionLevel)) {
if (!is_int($compressionLevel)) {
throw new \InvalidArgumentException('The specified compression of type "' . gettype($compressionLevel) . '" but an integer is expected.', 1289679154);
}
if ($compressionLevel >= -1 && $compressionLevel <= 9) {
......@@ -300,7 +300,7 @@ class RedisBackend extends AbstractBackend implements TaggableBackendInterface
throw new \TYPO3\CMS\Core\Cache\Exception\InvalidDataException('The specified data is of type "' . gettype($data) . '" but a string is expected.', 1279469941);
}
$lifetime = $lifetime === null ? $this->defaultLifetime : $lifetime;
if (!is_integer($lifetime)) {
if (!is_int($lifetime)) {
throw new \InvalidArgumentException('The specified lifetime is of type "' . gettype($lifetime) . '" but an integer or NULL is expected.', 1279488008);
}
if ($lifetime < 0) {
......
......@@ -231,7 +231,7 @@ class Typo3DatabaseBackend extends AbstractBackend implements TaggableBackendInt
->from($this->cacheTable)
->from($this->tagsTable)
->where(
$queryBuilder->expr()->eq($this->cacheTable . '.identifier', $queryBuilder->quoteIdentifier($this->tagsTable . '.identifier')),
$queryBuilder->expr()->eq($this->cacheTable . '.identifier', $queryBuilder->quoteIdentifier($this->tagsTable . '.identifier')),
$queryBuilder->expr()->eq(
$this->tagsTable . '.tag',
$queryBuilder->createNamedParameter($tag, \PDO::PARAM_STR)
......
......@@ -63,7 +63,7 @@ abstract class AbstractConditionMatcher
*/
public function setPageId($pageId)
{
if (is_integer($pageId) && $pageId > 0) {
if (is_int($pageId) && $pageId > 0) {
$this->pageId = $pageId;
}
}
......
......@@ -6976,7 +6976,7 @@ class DataHandler
$errors = [];
foreach ($fieldArray as $key => $value) {
if (!$this->checkStoredRecords_loose || $value || $row[$key]) {
if (is_double($row[$key])) {
if (is_float($row[$key])) {
// if the database returns the value as double, compare it as double
if ((double)$value !== (double)$row[$key]) {
$errors[] = $key;
......
......@@ -436,13 +436,13 @@ class QueryGenerator
// Initialize array to work on, save special parameters
$ssArr = $this->getSubscript($POST['qG_del']);
$workArr = &$this->queryConfig;
$ssArrSize = sizeof($ssArr) - 1;
$ssArrSize = count($ssArr) - 1;
for ($i = 0; $i < $ssArrSize; $i++) {
$workArr = &$workArr[$ssArr[$i]];
}
// Delete the entry and move the other entries
unset($workArr[$ssArr[$i]]);
$workArrSize = sizeof($workArr);
$workArrSize = count($workArr);
for ($j = $ssArr[$i]; $j < $workArrSize; $j++) {
$workArr[$j] = $workArr[$j + 1];
unset($workArr[$j + 1]);
......@@ -453,12 +453,12 @@ class QueryGenerator
// Initialize array to work on, save special parameters
$ssArr = $this->getSubscript($POST['qG_ins']);
$workArr = &$this->queryConfig;
$ssArrSize = sizeof($ssArr) - 1;
$ssArrSize = count($ssArr) - 1;
for ($i = 0; $i < $ssArrSize; $i++) {
$workArr = &$workArr[$ssArr[$i]];
}
// Move all entries above position where new entry is to be inserted
$workArrSize = sizeof($workArr);
$workArrSize = count($workArr);
for ($j = $workArrSize; $j > $ssArr[$i]; $j--) {
$workArr[$j] = $workArr[$j - 1];
}
......@@ -471,7 +471,7 @@ class QueryGenerator
// Initialize array to work on
$ssArr = $this->getSubscript($POST['qG_up']);
$workArr = &$this->queryConfig;
$ssArrSize = sizeof($ssArr) - 1;
$ssArrSize = count($ssArr) - 1;
for ($i = 0; $i < $ssArrSize; $i++) {
$workArr = &$workArr[$ssArr[$i]];
}
......@@ -485,7 +485,7 @@ class QueryGenerator
// Initialize array to work on
$ssArr = $this->getSubscript($POST['qG_nl']);
$workArr = &$this->queryConfig;
$ssArraySize = sizeof($ssArr) - 1;
$ssArraySize = count($ssArr) - 1;
for ($i = 0; $i < $ssArraySize; $i++) {
$workArr = &$workArr[$ssArr[$i]];
}
......@@ -506,7 +506,7 @@ class QueryGenerator
// Initialize array to work on
$ssArr = $this->getSubscript($POST['qG_remnl']);
$workArr = &$this->queryConfig;
$ssArrSize = sizeof($ssArr) - 1;
$ssArrSize = count($ssArr) - 1;
for ($i = 0; $i < $ssArrSize; $i++) {
$workArr = &$workArr[$ssArr[$i]];
}
......
......@@ -288,7 +288,7 @@ class PackageManager implements \TYPO3\CMS\Core\SingletonInterface
{
// reset the active packages so they are rebuilt.
$this->activePackages = [];
$this->packageStatesConfiguration['packages'][$package->getPackageKey()] = ['packagePath' => str_replace($this->packagesBasePath, '', $package->getPackagePath())];
$this->packageStatesConfiguration['packages'][$package->getPackageKey()] = ['packagePath' => str_replace($this->packagesBasePath, '', $package->getPackagePath())];
}
/**
......
......@@ -433,7 +433,7 @@ class ExtensionManagementUtility
}
if (
isset($fieldArrayWithOptions[$fieldNumber + 1])
&& strpos($fieldArrayWithOptions[$fieldNumber + 1], '--palette--') === 0
&& strpos($fieldArrayWithOptions[$fieldNumber + 1], '--palette--') === 0
) {
// Match for $field and next field is a palette - add fields to this one
$paletteName = GeneralUtility::trimExplode(';', $fieldArrayWithOptions[$fieldNumber + 1]);
......@@ -1482,7 +1482,7 @@ tt_content.' . $key . $suffix . ' {
throw new \InvalidArgumentException('No TCA definition for table "pages".', 1447789492);
}
$value = str_replace(',', '', 'EXT:' . $extKey . '/' . $filePath);
$value = str_replace(',', '', 'EXT:' . $extKey . '/' . $filePath);
$itemArray = [trim($title . ' (' . $extKey . ')'), $value];
$GLOBALS['TCA']['pages']['columns']['tsconfig_includes']['config']['items'][] = $itemArray;
}
......
......@@ -28,7 +28,7 @@ class MonitorUtility
{
$peakUsage = memory_get_peak_usage(true);
$memoryLimit = GeneralUtility::getBytesFromSizeMeasurement(ini_get('memory_limit'));
if (is_double($memoryLimit) && $memoryLimit != 0) {
if (is_float($memoryLimit) && $memoryLimit != 0) {
if ($peakUsage / $memoryLimit >= 0.9) {
/** @var $registry \TYPO3\CMS\Core\Registry */
$registry = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Registry::class);
......
......@@ -385,7 +385,7 @@ class IconFactoryTest extends \TYPO3\CMS\Components\TestingFramework\Core\UnitTe
public function getIconForResourceWithOpenFolderReturnsOpenFolderIcon()
{
$folderObject = $this->getTestSubjectFolderObject('/test');
$result = $this->subject->getIconForResource($folderObject, Icon::SIZE_DEFAULT, null, ['folder-open' => true])->render();
$result = $this->subject->getIconForResource($folderObject, Icon::SIZE_DEFAULT, null, ['folder-open' => true])->render();
$this->assertContains('<span class="t3js-icon icon icon-size-default icon-state-default icon-apps-filetree-folder-opened" data-identifier="apps-filetree-folder-opened">', $result);
}
......
......@@ -4586,7 +4586,7 @@ class GeneralUtilityTest extends \TYPO3\CMS\Components\TestingFramework\Core\Uni
$inputData = ['called' => []];
GeneralUtility::callUserFunction('&TYPO3\\CMS\\Core\\Tests\\Unit\\Utility\\GeneralUtilityTest->user_calledUserFunctionCountCallers', $inputData, $this);
GeneralUtility::callUserFunction('&TYPO3\\CMS\\Core\\Tests\\Unit\\Utility\\GeneralUtilityTest->user_calledUserFunctionCountCallers', $inputData, $this);
$this->assertEquals(1, sizeof($inputData['called']));
$this->assertEquals(1, count($inputData['called']));
}
/**
......
......@@ -36,7 +36,7 @@ class Response extends \TYPO3\CMS\Extbase\Mvc\Response
*/
public function setExitCode($exitCode)
{
if (!is_integer($exitCode)) {
if (!is_int($exitCode)) {
throw new \InvalidArgumentException(sprintf('Tried to set invalid exit code. The value must be integer, %s given.', gettype($exitCode)), 1312222064);
}
$this->exitCode = $exitCode;
......
......@@ -367,7 +367,7 @@ class PropertyMapper implements \TYPO3\CMS\Core\SingletonInterface
return 'array';
} elseif (is_float($source)) {
return 'float';
} elseif (is_integer($source)) {
} elseif (is_int($source)) {
return 'integer';
} elseif (is_bool($source)) {
return 'boolean';
......
......@@ -105,7 +105,7 @@ class DateTimeConverter extends \TYPO3\CMS\Extbase\Property\TypeConverter\Abstra
if (is_array($source)) {
return true;
}
if (is_integer($source)) {
if (is_int($source)) {
return true;
}
return is_string($source);
......@@ -126,12 +126,12 @@ class DateTimeConverter extends \TYPO3\CMS\Extbase\Property\TypeConverter\Abstra
$dateFormat = $this->getDefaultDateFormat($configuration);
if (is_string($source)) {
$dateAsString = $source;
} elseif (is_integer($source)) {
} elseif (is_int($source)) {
$dateAsString = strval($source);
} else {
if (isset($source['date']) && is_string($source['date'])) {
$dateAsString = $source['date'];
} elseif (isset($source['date']) && is_integer($source['date'])) {
} elseif (isset($source['date']) && is_int($source['date'])) {
$dateAsString = strval($source['date']);
} elseif ($this->isDatePartKeysProvided($source)) {
if ($source['day'] < 1 || $source['month'] < 1 || $source['year'] < 1) {
......
......@@ -355,7 +355,7 @@ class ArrayUtility
GeneralUtility::logDeprecatedFunction();
$containsNumericalKeysOnly = true;
array_walk($array, function ($value, $key) use (&$containsNumericalKeysOnly) {
if (!is_integer($key)) {
if (!is_int($key)) {
$containsNumericalKeysOnly = false;
return;
}
......
......@@ -352,7 +352,7 @@ class FormEditorController extends AbstractBackendController
{
$output = [];
foreach ($input as $key => $value) {
if (is_integer($key) && is_array($value) && isset($value['_label']) && isset($value['_value'])) {
if (is_int($key) && is_array($value) && isset($value['_label']) && isset($value['_value'])) {
$key = $value['_value'];
$value = $value['_label'];
}
......
......@@ -43,7 +43,7 @@ class ContentDataProcessor
foreach ($processorKeys as $key) {
$className = $processors[$key];
if (!class_exists($className)) {
throw new \UnexpectedValueException('Processor class name "' . $className . '" does not exist!', 1427455378);
throw new \UnexpectedValueException('Processor class name "' . $className . '" does not exist!', 1427455378);
}
if (!in_array(DataProcessorInterface::class, class_implements($className), true)) {
......
......@@ -47,7 +47,7 @@ class FilesProcessor implements DataProcessorInterface
* @param array $processedData Key/value store of processed data (e.g. to be passed to a Fluid View)
* @return array the processed data as key/value store
*/
public function process(ContentObjectRenderer $cObj, array $contentObjectConfiguration, array $processorConfiguration, array $processedData)
public function process(ContentObjectRenderer $cObj, array $contentObjectConfiguration, array $processorConfiguration, array $processedData)
{
if (isset($processorConfiguration['if.']) && !$cObj->checkIf($processorConfiguration['if.'])) {
return $processedData;
......
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