Skip to content

Commit

Permalink
[BUGFIX] Fix deprecation rule in cs fixer tests
Browse files Browse the repository at this point in the history
When performing `Build/Scripts/runTests.sh -s cglGit`
with latest cs fixer version a rule dependency error
is thrown.

This patch exchanges the deprecation with the current
recommended rule.

Used command(s):

> composer require --dev \
  "friendsofphp/php-cs-fixer":"^3.26.1"
> Build/Scripts/runTests.sh -s cgl

Resolves: #101888
Releases: main, 11.5, 12.4
Change-Id: Ie139ef841c92461e116732923991c6474e888a5e
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/80936
Tested-by: Anja Leichsenring <[email protected]>
Tested-by: core-ci <[email protected]>
Reviewed-by: Anja Leichsenring <[email protected]>
  • Loading branch information
wandoliver authored and maddy2101 committed Sep 10, 2023
1 parent 47c8f73 commit 70273ad
Show file tree
Hide file tree
Showing 27 changed files with 54 additions and 54 deletions.
6 changes: 3 additions & 3 deletions Classes/Authentication/AbstractUserAuthentication.php
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ public function checkAuthentication(ServerRequestInterface $request)
if ($ret < 100) {
$authenticated = true;
}
// $ret is between 100 and 199 which means "I'm not responsible, ask others"
// $ret is between 100 and 199 which means "I'm not responsible, ask others"
} else {
// $ret is < 0
$authenticated = false;
Expand All @@ -553,8 +553,8 @@ public function checkAuthentication(ServerRequestInterface $request)
break;
}
}
// mimic user authentication to mitigate observable timing discrepancies
// @link https://cwe.mitre.org/data/definitions/208.html
// mimic user authentication to mitigate observable timing discrepancies
// @link https://cwe.mitre.org/data/definitions/208.html
} elseif ($activeLogin) {
$subType = 'authUser' . $this->loginType;
foreach ($this->getAuthServices($subType, $loginData, $authenticatedUserFromSession, $request) as $serviceObj) {
Expand Down
4 changes: 2 additions & 2 deletions Classes/Authentication/Mfa/MfaViewType.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@
class MfaViewType extends Enumeration
{
public const SETUP = 'setup';
public const EDIT ='edit';
public const AUTH ='auth';
public const EDIT = 'edit';
public const AUTH = 'auth';
}
12 changes: 6 additions & 6 deletions Classes/DataHandling/DataHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -4235,7 +4235,7 @@ protected function copyRecord_processRelation(
} else {
if (!MathUtility::canBeInterpretedAsInteger($realDestPid)) {
$newId = $this->copyRecord($v['table'], $v['id'], -(int)($v['id']));
// If the destination page id is a NEW string, keep it on the same page
// If the destination page id is a NEW string, keep it on the same page
} elseif ($this->BE_USER->workspace > 0 && BackendUtility::isTableWorkspaceEnabled($v['table'])) {
// A filled $workspaceOptions indicated that this call
// has it's origin in previous versionizeRecord() processing
Expand All @@ -4249,7 +4249,7 @@ protected function copyRecord_processRelation(
$workspaceOptions['label'] ?? 'Auto-created for WS #' . $this->BE_USER->workspace,
$workspaceOptions['delete'] ?? false
);
// Otherwise just use plain copyRecord() to create placeholders etc.
// Otherwise just use plain copyRecord() to create placeholders etc.
} else {
// If a record has been copied already during this request,
// prevent superfluous duplication and use the existing copy
Expand Down Expand Up @@ -8528,15 +8528,15 @@ protected function isSubmittedValueEqualToStoredValue($submittedValue, $storedVa
default:
$result = (string)$submittedValue === (string)$storedValue;
}
// Null values are allowed, but currently there's a real (not NULL) value.
// Thus, ensure no NULL value was submitted and fallback to the regular behaviour.
// Null values are allowed, but currently there's a real (not NULL) value.
// Thus, ensure no NULL value was submitted and fallback to the regular behaviour.
} elseif ($storedValue !== null) {
$result = (
$submittedValue !== null
&& $this->isSubmittedValueEqualToStoredValue($submittedValue, $storedValue, $storedType, false)
);
// Null values are allowed, and currently there's a NULL value.
// Thus, check whether a NULL value was submitted.
// Null values are allowed, and currently there's a NULL value.
// Thus, check whether a NULL value was submitted.
} else {
$result = ($submittedValue === null);
}
Expand Down
2 changes: 1 addition & 1 deletion Classes/DataHandling/Localization/DataMapProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -1026,7 +1026,7 @@ protected function fetchDependentIdMap(string $tableName, array $ids, int $desir
// implicit: use origin pointer if table cannot be translated
if (!$isTranslatable) {
$ancestorId = (int)$dependentElement[$fieldNames['origin']];
// only consider element if it reflects the desired language
// only consider element if it reflects the desired language
} elseif ((int)$dependentElement[$fieldNames['language']] === $desiredLanguage) {
$ancestorId = $this->resolveAncestorId($fieldNames, $dependentElement);
} else {
Expand Down
6 changes: 3 additions & 3 deletions Classes/Database/Query/Expression/CompositeExpression.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public function addMultiple(array $parts = []): self
* @param self|string|null $part
* @param self|string|null ...$parts
*/
public static function and($part=null, ...$parts): self
public static function and($part = null, ...$parts): self
{
$mergedParts = array_merge([$part], $parts);
array_filter($mergedParts, static fn ($value) => !is_null($value));
Expand All @@ -136,7 +136,7 @@ public static function and($part=null, ...$parts): self
* @param self|string|null $part
* @param self|string|null ...$parts
*/
public static function or($part=null, ...$parts): self
public static function or($part = null, ...$parts): self
{
$mergedParts = array_merge([$part], $parts);
array_filter($mergedParts, static fn ($value) => !is_null($value));
Expand All @@ -149,7 +149,7 @@ public static function or($part=null, ...$parts): self
* @param self|string|null $part
* @param self|string|null ...$parts
*/
public function with($part=null, ...$parts): self
public function with($part = null, ...$parts): self
{
$mergedParts = array_merge([$part], $parts);
$that = clone $this;
Expand Down
2 changes: 1 addition & 1 deletion Classes/Database/RelationHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -1322,7 +1322,7 @@ protected function purgeItemArrayHandler($purgeCallback)
}

$purgedItemIds = [];
$callable =[$this, $purgeCallback];
$callable = [$this, $purgeCallback];
if (is_callable($callable)) {
$purgedItemIds = $callable($itemTableName, $itemIds);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ private function getDecoratedServiceName(ContainerBuilder $container, string $se
}
return [
$serviceName . '_decorated_' . $counter,
$counter === 1 ? $serviceName : $serviceName . '_decorated_' . ($counter-1),
$counter === 1 ? $serviceName : $serviceName . '_decorated_' . ($counter - 1),
];
}
}
16 changes: 8 additions & 8 deletions Classes/Html/SimpleParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,53 +128,53 @@ protected function process(string $string): void
$this->next(SimpleNode::TYPE_CDATA);
$this->append('<![CDATA[');
$skip = 8;
// comment start
// comment start
} elseif ($character === '<'
&& $this->isType(SimpleNode::TYPE_TEXT) && substr($string, $i, 4) === '<!--'
) {
$this->next(SimpleNode::TYPE_COMMENT);
$this->append('<!--');
$skip = 3;
// element start
// element start
} elseif ($character === '<'
&& $this->isType(SimpleNode::TYPE_TEXT)
&& preg_match('#^</?[a-z]#i', substr($string, $i, 3))
) {
$this->next(SimpleNode::TYPE_ELEMENT);
$this->append($character);
// CDATA end
// CDATA end
} elseif ($character === ']'
&& $this->isType(SimpleNode::TYPE_CDATA) && substr($string, $i, 3) === ']]>'
) {
$this->append(']]>');
$this->next(SimpleNode::TYPE_TEXT);
$skip = 2;
// comment end
// comment end
} elseif ($character === '-'
&& $this->isType(SimpleNode::TYPE_COMMENT) && substr($string, $i, 3) === '-->'
) {
$this->append('-->');
$this->next(SimpleNode::TYPE_TEXT);
$skip = 2;
// element end
// element end
} elseif ($character === '>'
&& $this->isType(SimpleNode::TYPE_ELEMENT) && !$this->inAttribute()
) {
$this->append($character);
$this->next(SimpleNode::TYPE_TEXT);
// element attribute start
// element attribute start
} elseif (($character === '"' || $character === "'")
&& $this->isType(SimpleNode::TYPE_ELEMENT) && !$this->inAttribute()
) {
$this->attribute = $character;
$this->append($character);
// element attribute end
// element attribute end
} elseif (($character === '"' || $character === "'")
&& $this->isType(SimpleNode::TYPE_ELEMENT) && $this->attribute === $character
) {
$this->append($character);
$this->attribute = null;
// anything else (put to current type)
// anything else (put to current type)
} else {
$this->append($character);
}
Expand Down
2 changes: 1 addition & 1 deletion Classes/Imaging/ImageDimension.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public static function fromProcessingTask(TaskInterface $task): self
(int)$processedFile->getOriginalFile()->getProperty('height')
);
}
if ($imageDimension->width <=0 || $imageDimension->height <=0) {
if ($imageDimension->width <= 0 || $imageDimension->height <= 0) {
throw new \BadMethodCallException('Width and height of the image must be greater than zero', 1597310560);
}
$result = GeneralUtility::makeInstance(GraphicalFunctions::class)->getImageScale(
Expand Down
2 changes: 1 addition & 1 deletion Classes/LinkHandling/LegacyLinkNotationConverter.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ public function resolve(string $linkParameter): array
if (!$isIdOrAlias && $isLocalFile !== 1 && $urlChar && (!$containsSlash || $urlChar < $fileChar)) {
$result['type'] = LinkService::TYPE_URL;
$result['url'] = UrlLinkHandler::getDefaultScheme() . '://' . $linkParameter;
// file (internal) or folder
// file (internal) or folder
} elseif ($containsSlash || $isLocalFile) {
$result = $this->getFileOrFolderObjectFromMixedIdentifier($linkParameter);
} else {
Expand Down
2 changes: 1 addition & 1 deletion Classes/Localization/DateFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ public function strftime(string $format, int|string|\DateTimeInterface|null $tim
},
'%j' => function (\DateTimeInterface $timestamp, string $_): string {
// Day number in year, 001 to 366
return sprintf('%03d', (int)($timestamp->format('z'))+1);
return sprintf('%03d', (int)($timestamp->format('z')) + 1);
},
'%u' => 'N',
'%w' => 'w',
Expand Down
2 changes: 1 addition & 1 deletion Classes/Routing/Aspect/PersistedPatternMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ protected function createRouteFieldConstraints(QueryBuilder $queryBuilder, array
$queryBuilder->expr()->eq('uid', $idParameter),
$queryBuilder->expr()->eq($this->languageParentFieldName, $idParameter)
);
// otherwise - basically uid is not in pattern - restrict to languages and apply fallbacks
// otherwise - basically uid is not in pattern - restrict to languages and apply fallbacks
} elseif ($languageAware) {
$languageIds = $this->resolveAllRelevantLanguageIds();
$constraints[] = $queryBuilder->expr()->in(
Expand Down
2 changes: 1 addition & 1 deletion Classes/Security/ContentSecurityPolicy/PolicyProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ public function getDefaultReportingUriBase(Scope $scope, ServerRequestInterface
$siteLanguage = $siteLanguage instanceof SiteLanguage ? $siteLanguage : $site->getDefaultLanguage();
$uri = $siteLanguage->getBase();
$uri = $uri->withPath(rtrim($uri->getPath(), '/') . '/');
// otherwise fall back to current request URI
// otherwise fall back to current request URI
} else {
$uri = new Uri($normalizedParams->getSitePath());
}
Expand Down
6 changes: 3 additions & 3 deletions Classes/TypoScript/IncludeTree/TreeFromLineStreamBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ private function addSingleAtImportFile(IncludeInterface $parentNode, string $abs
private function processIncludeTyposcript(IncludeInterface $node, Token $includeTyposcriptValueToken, LineInterface $importKeywordOldLine): void
{
$fullString = $includeTyposcriptValueToken->getValue();
$potentialSourceArray = preg_split('#.*(source="[^"]*").*|>#', $fullString, -1, PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_NO_EMPTY);
$potentialSourceArray = preg_split('#.*(source="[^"]*").*|>#', $fullString, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
$source = '';
foreach ($potentialSourceArray as $candidate) {
$candidate = trim($candidate);
Expand All @@ -380,7 +380,7 @@ private function processIncludeTyposcript(IncludeInterface $node, Token $include
// No 'source="..."'
return;
}
$potentialConditionArray = preg_split('#.*(condition="(?:\\\\\\\\|\\\\"|[^\"])*").*|>#', $fullString, 2, PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_NO_EMPTY);
$potentialConditionArray = preg_split('#.*(condition="(?:\\\\\\\\|\\\\"|[^\"])*").*|>#', $fullString, 2, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
$condition = '';
foreach ($potentialConditionArray as $candidate) {
$candidate = trim($candidate);
Expand All @@ -394,7 +394,7 @@ private function processIncludeTyposcript(IncludeInterface $node, Token $include
break;
}
}
$potentialExtensionsArray = preg_split('#.*(extensions*="[^"]*").*|>#', $fullString, 2, PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_NO_EMPTY);
$potentialExtensionsArray = preg_split('#.*(extensions*="[^"]*").*|>#', $fullString, 2, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
$extensions = [];
foreach ($potentialExtensionsArray as $candidate) {
$candidate = trim($candidate);
Expand Down
2 changes: 1 addition & 1 deletion Classes/Utility/ExtensionManagementUtility.php
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,7 @@ public static function getFileFieldTCAConfig(string $fieldName, array $customSet
$fileFieldTCAConfig = [
'type' => 'file',
'allowed' => $allowedFileExtensions,
'disallowed'=> $disallowedFileExtensions,
'disallowed' => $disallowedFileExtensions,
];
ArrayUtility::mergeRecursiveWithOverrule($fileFieldTCAConfig, $customSettingOverride);
return $fileFieldTCAConfig;
Expand Down
8 changes: 4 additions & 4 deletions Classes/Utility/StringUtility.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,22 +138,22 @@ public static function multibyteStringPad(string $string, int $length, string $p

switch ($pad_type) {
case STR_PAD_RIGHT:
$string .= str_repeat($pad_string, (int)(($length - $len)/$pad_string_len));
$string .= str_repeat($pad_string, (int)(($length - $len) / $pad_string_len));
$string .= mb_substr($pad_string, 0, ($length - $len) % $pad_string_len);
return $string;

case STR_PAD_LEFT:
$leftPad = str_repeat($pad_string, (int)(($length - $len)/$pad_string_len));
$leftPad = str_repeat($pad_string, (int)(($length - $len) / $pad_string_len));
$leftPad .= mb_substr($pad_string, 0, ($length - $len) % $pad_string_len);
return $leftPad . $string;

case STR_PAD_BOTH:
$leftPadCount = (int)(($length - $len)/2);
$leftPadCount = (int)(($length - $len) / 2);
$len += $leftPadCount;
$padded = ((int)($leftPadCount / $pad_string_len)) * $pad_string_len;
$leftPad = str_repeat($pad_string, (int)($leftPadCount / $pad_string_len));
$leftPad .= mb_substr($pad_string, 0, $leftPadCount - $padded);
$string = $leftPad . $string . str_repeat($pad_string, (int)(($length - $len)/$pad_string_len));
$string = $leftPad . $string . str_repeat($pad_string, (int)(($length - $len) / $pad_string_len));
$string .= mb_substr($pad_string, 0, ($length - $len) % $pad_string_len);
return $string;
}
Expand Down
2 changes: 1 addition & 1 deletion Configuration/TCA/pages.php
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@
],
],
'categories' => [
'config'=> [
'config' => [
'type' => 'category',
],
],
Expand Down
2 changes: 1 addition & 1 deletion Configuration/TCA/sys_file_metadata.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
],
],
'categories' => [
'config'=> [
'config' => [
'type' => 'category',
],
],
Expand Down
4 changes: 2 additions & 2 deletions Tests/Acceptance/Application/Impexp/UsersCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ private function setModAccess(ApplicationTester $I, int $userGroupId, array $mod
}

$I->waitForElementVisible($this->inModuleHeader . ' [name=BackendUserModuleMenu]');
$I->selectOption($this->inModuleHeader . ' [name=BackendUserModuleMenu]', ['text'=>'Backend user groups']);
$I->selectOption($this->inModuleHeader . ' [name=BackendUserModuleMenu]', ['text' => 'Backend user groups']);
$I->waitForText('Backend user groups');
$I->click('//table/tbody/tr[descendant::a[@data-contextmenu-uid="' . $userGroupId . '"]]/td[2]/a');
$I->waitForElementVisible('#EditDocumentController');
Expand Down Expand Up @@ -224,7 +224,7 @@ private function setUserTsConfig(ApplicationTester $I, int $userId, string $user
}

$I->waitForElementVisible($this->inModuleHeader . ' [name=BackendUserModuleMenu]');
$I->selectOption($this->inModuleHeader . ' [name=BackendUserModuleMenu]', ['text'=>'Backend users']);
$I->selectOption($this->inModuleHeader . ' [name=BackendUserModuleMenu]', ['text' => 'Backend users']);
$I->waitForElement('#typo3-backend-user-list');
$I->click('//table[@id="typo3-backend-user-list"]/tbody/tr[descendant::a[@data-contextmenu-uid="' . $userId . '"]]//a[@title="Edit"]');
$I->waitForElement('#EditDocumentController');
Expand Down
2 changes: 1 addition & 1 deletion Tests/Functional/Resource/StorageRepositoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ public function getNestedProcessingFolderTest(): void
$processingFolder = $subject->getProcessingFolder($file);
self::assertInstanceOf(Folder::class, $processingFolder);
self::assertNotEquals($rootProcessingFolder, $processingFolder);
for ($i = ResourceStorage::PROCESSING_FOLDER_LEVELS; $i>0; $i--) {
for ($i = ResourceStorage::PROCESSING_FOLDER_LEVELS; $i > 0; $i--) {
$processingFolder = $processingFolder->getParentFolder();
}
self::assertEquals($rootProcessingFolder, $processingFolder);
Expand Down
2 changes: 1 addition & 1 deletion Tests/Functional/Utility/RootlineUtilityTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public function resolveLivePagesAndSkipWorkspacedVersions(): void
'uid' => 1330,
't3ver_oid' => 0,
't3ver_wsid' => 0,
't3ver_state' =>0,
't3ver_state' => 0,
'title' => 'EN: Board Games',
],
1 => [
Expand Down
4 changes: 2 additions & 2 deletions Tests/Unit/Authentication/BackendUserAuthenticationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ public static function getFilePermissionsFromStorageDataProvider(): array
1,
[
'addFile' => 0,
'recursivedeleteFolder' =>0,
'recursivedeleteFolder' => 0,
],
[
'addFile' => 0,
Expand All @@ -254,7 +254,7 @@ public static function getFilePermissionsFromStorageDataProvider(): array
0,
[
'addFile' => 0,
'recursivedeleteFolder' =>0,
'recursivedeleteFolder' => 0,
],
[
'addFile' => false,
Expand Down
Loading

0 comments on commit 70273ad

Please sign in to comment.