Skip to content

Commit fa5ff8a

Browse files
oliverkleeJakeQZ
andauthored
[CLEANUP] Avoid Hungarian notation for result (#924)
Part of #756 Co-authored-by: JakeQZ <[email protected]>
1 parent 2d1a772 commit fa5ff8a

13 files changed

+107
-107
lines changed

src/CSSList/AtRuleBlockList.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,17 +57,17 @@ public function __toString(): string
5757

5858
public function render(OutputFormat $outputFormat): string
5959
{
60-
$sResult = $outputFormat->comments($this);
61-
$sResult .= $outputFormat->sBeforeAtRuleBlock;
60+
$result = $outputFormat->comments($this);
61+
$result .= $outputFormat->sBeforeAtRuleBlock;
6262
$arguments = $this->arguments;
6363
if ($arguments) {
6464
$arguments = ' ' . $arguments;
6565
}
66-
$sResult .= "@{$this->type}$arguments{$outputFormat->spaceBeforeOpeningBrace()}{";
67-
$sResult .= $this->renderListContents($outputFormat);
68-
$sResult .= '}';
69-
$sResult .= $outputFormat->sAfterAtRuleBlock;
70-
return $sResult;
66+
$result .= "@{$this->type}$arguments{$outputFormat->spaceBeforeOpeningBrace()}{";
67+
$result .= $this->renderListContents($outputFormat);
68+
$result .= '}';
69+
$result .= $outputFormat->sAfterAtRuleBlock;
70+
return $result;
7171
}
7272

7373
public function isRootList(): bool

src/CSSList/Document.php

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,10 @@ public static function parse(ParserState $parserState): Document
4646
*/
4747
public function getAllDeclarationBlocks(): array
4848
{
49-
/** @var array<int, DeclarationBlock> $aResult */
50-
$aResult = [];
51-
$this->allDeclarationBlocks($aResult);
52-
return $aResult;
49+
/** @var array<int, DeclarationBlock> $result */
50+
$result = [];
51+
$this->allDeclarationBlocks($result);
52+
return $result;
5353
}
5454

5555
/**
@@ -59,10 +59,10 @@ public function getAllDeclarationBlocks(): array
5959
*/
6060
public function getAllRuleSets(): array
6161
{
62-
/** @var array<int, RuleSet> $aResult */
63-
$aResult = [];
64-
$this->allRuleSets($aResult);
65-
return $aResult;
62+
/** @var array<int, RuleSet> $result */
63+
$result = [];
64+
$this->allRuleSets($result);
65+
return $result;
6666
}
6767

6868
/**
@@ -86,10 +86,10 @@ public function getAllValues($element = null, $bSearchInFunctionArguments = fals
8686
$sSearchString = $element;
8787
$element = $this;
8888
}
89-
/** @var array<int, Value> $aResult */
90-
$aResult = [];
91-
$this->allValues($element, $aResult, $sSearchString, $bSearchInFunctionArguments);
92-
return $aResult;
89+
/** @var array<int, Value> $result */
90+
$result = [];
91+
$this->allValues($element, $result, $sSearchString, $bSearchInFunctionArguments);
92+
return $result;
9393
}
9494

9595
/**
@@ -107,10 +107,10 @@ public function getAllValues($element = null, $bSearchInFunctionArguments = fals
107107
*/
108108
public function getSelectorsBySpecificity($sSpecificitySearch = null): array
109109
{
110-
/** @var array<int, Selector> $aResult */
111-
$aResult = [];
112-
$this->allSelectors($aResult, $sSpecificitySearch);
113-
return $aResult;
110+
/** @var array<int, Selector> $result */
111+
$result = [];
112+
$this->allSelectors($result, $sSpecificitySearch);
113+
return $result;
114114
}
115115

116116
/**

src/CSSList/KeyFrame.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,11 @@ public function __toString(): string
6868

6969
public function render(OutputFormat $outputFormat): string
7070
{
71-
$sResult = $outputFormat->comments($this);
72-
$sResult .= "@{$this->vendorKeyFrame} {$this->animationName}{$outputFormat->spaceBeforeOpeningBrace()}{";
73-
$sResult .= $this->renderListContents($outputFormat);
74-
$sResult .= '}';
75-
return $sResult;
71+
$result = $outputFormat->comments($this);
72+
$result .= "@{$this->vendorKeyFrame} {$this->animationName}{$outputFormat->spaceBeforeOpeningBrace()}{";
73+
$result .= $this->renderListContents($outputFormat);
74+
$result .= '}';
75+
return $result;
7676
}
7777

7878
public function isRootList(): bool

src/OutputFormatter.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ public function safely($cCode)
141141
*/
142142
public function implode(string $sSeparator, array $aValues, $bIncreaseLevel = false): string
143143
{
144-
$sResult = '';
144+
$result = '';
145145
$oFormat = $this->oFormat;
146146
if ($bIncreaseLevel) {
147147
$oFormat = $oFormat->nextLevel();
@@ -151,15 +151,15 @@ public function implode(string $sSeparator, array $aValues, $bIncreaseLevel = fa
151151
if ($bIsFirst) {
152152
$bIsFirst = false;
153153
} else {
154-
$sResult .= $sSeparator;
154+
$result .= $sSeparator;
155155
}
156156
if ($mValue instanceof Renderable) {
157-
$sResult .= $mValue->render($oFormat);
157+
$result .= $mValue->render($oFormat);
158158
} else {
159-
$sResult .= $mValue;
159+
$result .= $mValue;
160160
}
161161
}
162-
return $sResult;
162+
return $result;
163163
}
164164

165165
/**
@@ -188,15 +188,15 @@ public function comments(Commentable $oCommentable): string
188188
return '';
189189
}
190190

191-
$sResult = '';
191+
$result = '';
192192
$comments = $oCommentable->getComments();
193193
$iLastCommentIndex = \count($comments) - 1;
194194

195195
foreach ($comments as $i => $oComment) {
196-
$sResult .= $oComment->render($this->oFormat);
197-
$sResult .= $i === $iLastCommentIndex ? $this->spaceAfterBlocks() : $this->spaceBetweenBlocks();
196+
$result .= $oComment->render($this->oFormat);
197+
$result .= $i === $iLastCommentIndex ? $this->spaceAfterBlocks() : $this->spaceBetweenBlocks();
198198
}
199-
return $sResult;
199+
return $result;
200200
}
201201

202202
/**

src/Parsing/ParserState.php

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -144,22 +144,22 @@ public function parseIdentifier($bIgnoreCase = true)
144144
if ($this->isEnd()) {
145145
throw new UnexpectedEOFException('', '', 'identifier', $this->lineNumber);
146146
}
147-
$sResult = $this->parseCharacter(true);
148-
if ($sResult === null) {
147+
$result = $this->parseCharacter(true);
148+
if ($result === null) {
149149
throw new UnexpectedTokenException('', $this->peek(5), 'identifier', $this->lineNumber);
150150
}
151151
$sCharacter = null;
152152
while (!$this->isEnd() && ($sCharacter = $this->parseCharacter(true)) !== null) {
153153
if (\preg_match('/[a-zA-Z0-9\\x{00A0}-\\x{FFFF}_-]/Sux', $sCharacter)) {
154-
$sResult .= $sCharacter;
154+
$result .= $sCharacter;
155155
} else {
156-
$sResult .= '\\' . $sCharacter;
156+
$result .= '\\' . $sCharacter;
157157
}
158158
}
159159
if ($bIgnoreCase) {
160-
$sResult = $this->strtolower($sResult);
160+
$result = $this->strtolower($result);
161161
}
162-
return $sResult;
162+
return $result;
163163
}
164164

165165
/**
@@ -308,11 +308,11 @@ public function consume($mValue = 1): string
308308
if ($this->iCurrentPosition + $mValue > $this->iLength) {
309309
throw new UnexpectedEOFException((string) $mValue, $this->peek(5), 'count', $this->lineNumber);
310310
}
311-
$sResult = $this->substr($this->iCurrentPosition, $mValue);
312-
$iLineCount = \substr_count($sResult, "\n");
311+
$result = $this->substr($this->iCurrentPosition, $mValue);
312+
$iLineCount = \substr_count($result, "\n");
313313
$this->lineNumber += $iLineCount;
314314
$this->iCurrentPosition += $mValue;
315-
return $sResult;
315+
return $result;
316316
}
317317
}
318318

@@ -460,13 +460,13 @@ private function substr($iStart, $iLength): string
460460
if ($iStart + $iLength > $this->iLength) {
461461
$iLength = $this->iLength - $iStart;
462462
}
463-
$sResult = '';
463+
$result = '';
464464
while ($iLength > 0) {
465-
$sResult .= $this->aText[$iStart];
465+
$result .= $this->aText[$iStart];
466466
$iStart++;
467467
$iLength--;
468468
}
469-
return $sResult;
469+
return $result;
470470
}
471471

472472
/**
@@ -493,11 +493,11 @@ private function strsplit($sString)
493493
return \preg_split('//u', $sString, -1, PREG_SPLIT_NO_EMPTY);
494494
} else {
495495
$iLength = \mb_strlen($sString, $this->sCharset);
496-
$aResult = [];
496+
$result = [];
497497
for ($i = 0; $i < $iLength; ++$i) {
498-
$aResult[] = \mb_substr($sString, $i, 1, $this->sCharset);
498+
$result[] = \mb_substr($sString, $i, 1, $this->sCharset);
499499
}
500-
return $aResult;
500+
return $result;
501501
}
502502
} else {
503503
if ($sString === '') {

src/Property/CSSNamespace.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,11 +111,11 @@ public function atRuleName(): string
111111
*/
112112
public function atRuleArgs(): array
113113
{
114-
$aResult = [$this->mUrl];
114+
$result = [$this->mUrl];
115115
if ($this->sPrefix) {
116-
\array_unshift($aResult, $this->sPrefix);
116+
\array_unshift($result, $this->sPrefix);
117117
}
118-
return $aResult;
118+
return $result;
119119
}
120120

121121
/**

src/Property/Import.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,11 @@ public function atRuleName(): string
9494
*/
9595
public function atRuleArgs(): array
9696
{
97-
$aResult = [$this->location];
97+
$result = [$this->location];
9898
if ($this->mediaQuery) {
99-
\array_push($aResult, $this->mediaQuery);
99+
\array_push($result, $this->mediaQuery);
100100
}
101-
return $aResult;
101+
return $result;
102102
}
103103

104104
/**

src/Rule/Rule.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -271,20 +271,20 @@ public function __toString(): string
271271

272272
public function render(OutputFormat $outputFormat): string
273273
{
274-
$sResult = "{$outputFormat->comments($this)}{$this->sRule}:{$outputFormat->spaceAfterRuleName()}";
274+
$result = "{$outputFormat->comments($this)}{$this->sRule}:{$outputFormat->spaceAfterRuleName()}";
275275
if ($this->mValue instanceof Value) { // Can also be a ValueList
276-
$sResult .= $this->mValue->render($outputFormat);
276+
$result .= $this->mValue->render($outputFormat);
277277
} else {
278-
$sResult .= $this->mValue;
278+
$result .= $this->mValue;
279279
}
280280
if (!empty($this->aIeHack)) {
281-
$sResult .= ' \\' . \implode('\\', $this->aIeHack);
281+
$result .= ' \\' . \implode('\\', $this->aIeHack);
282282
}
283283
if ($this->bIsImportant) {
284-
$sResult .= ' !important';
284+
$result .= ' !important';
285285
}
286-
$sResult .= ';';
287-
return $sResult;
286+
$result .= ';';
287+
return $result;
288288
}
289289

290290
/**

src/RuleSet/AtRuleSet.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,14 @@ public function __toString(): string
6060

6161
public function render(OutputFormat $outputFormat): string
6262
{
63-
$sResult = $outputFormat->comments($this);
63+
$result = $outputFormat->comments($this);
6464
$arguments = $this->arguments;
6565
if ($arguments) {
6666
$arguments = ' ' . $arguments;
6767
}
68-
$sResult .= "@{$this->sType}$arguments{$outputFormat->spaceBeforeOpeningBrace()}{";
69-
$sResult .= $this->renderRules($outputFormat);
70-
$sResult .= '}';
71-
return $sResult;
68+
$result .= "@{$this->sType}$arguments{$outputFormat->spaceBeforeOpeningBrace()}{";
69+
$result .= $this->renderRules($outputFormat);
70+
$result .= '}';
71+
return $result;
7272
}
7373
}

src/RuleSet/DeclarationBlock.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -163,21 +163,21 @@ public function __toString(): string
163163
*/
164164
public function render(OutputFormat $outputFormat): string
165165
{
166-
$sResult = $outputFormat->comments($this);
166+
$result = $outputFormat->comments($this);
167167
if (\count($this->aSelectors) === 0) {
168168
// If all the selectors have been removed, this declaration block becomes invalid
169169
throw new OutputException('Attempt to print declaration block with missing selector', $this->lineNumber);
170170
}
171-
$sResult .= $outputFormat->sBeforeDeclarationBlock;
172-
$sResult .= $outputFormat->implode(
171+
$result .= $outputFormat->sBeforeDeclarationBlock;
172+
$result .= $outputFormat->implode(
173173
$outputFormat->spaceBeforeSelectorSeparator() . ',' . $outputFormat->spaceAfterSelectorSeparator(),
174174
$this->aSelectors
175175
);
176-
$sResult .= $outputFormat->sAfterDeclarationBlockSelectors;
177-
$sResult .= $outputFormat->spaceBeforeOpeningBrace() . '{';
178-
$sResult .= $this->renderRules($outputFormat);
179-
$sResult .= '}';
180-
$sResult .= $outputFormat->sAfterDeclarationBlock;
181-
return $sResult;
176+
$result .= $outputFormat->sAfterDeclarationBlockSelectors;
177+
$result .= $outputFormat->spaceBeforeOpeningBrace() . '{';
178+
$result .= $this->renderRules($outputFormat);
179+
$result .= '}';
180+
$result .= $outputFormat->sAfterDeclarationBlock;
181+
return $result;
182182
}
183183
}

0 commit comments

Comments
 (0)