Skip to content

Commit 6f1fc2c

Browse files
authored
[CLEANUP] Avoid Hungarian notation for string* (#972)
Part of #756
1 parent ce0a049 commit 6f1fc2c

File tree

4 files changed

+48
-48
lines changed

4 files changed

+48
-48
lines changed

src/OutputFormat.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class OutputFormat
1313
*
1414
* @internal since 8.8.0, will be made private in 9.0.0
1515
*/
16-
public $sStringQuotingType = '"';
16+
public $stringQuotingType = '"';
1717

1818
/**
1919
* Output RGB colors in hash notation if possible
@@ -305,15 +305,15 @@ public function __call(string $sMethodName, array $aArguments)
305305
*/
306306
public function getStringQuotingType(): string
307307
{
308-
return $this->sStringQuotingType;
308+
return $this->stringQuotingType;
309309
}
310310

311311
/**
312312
* @return $this fluent interface
313313
*/
314314
public function setStringQuotingType(string $quotingType): self
315315
{
316-
$this->sStringQuotingType = $quotingType;
316+
$this->stringQuotingType = $quotingType;
317317

318318
return $this;
319319
}

src/Parsing/ParserState.php

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -233,15 +233,15 @@ public function consumeWhiteSpace(): array
233233
}
234234

235235
/**
236-
* @param string $sString
236+
* @param string $string
237237
* @param bool $caseInsensitive
238238
*/
239-
public function comes($sString, $caseInsensitive = false): bool
239+
public function comes($string, $caseInsensitive = false): bool
240240
{
241-
$sPeek = $this->peek(\strlen($sString));
241+
$sPeek = $this->peek(\strlen($string));
242242
return ($sPeek == '')
243243
? false
244-
: $this->streql($sPeek, $sString, $caseInsensitive);
244+
: $this->streql($sPeek, $string, $caseInsensitive);
245245
}
246246

247247
/**
@@ -390,16 +390,16 @@ private function inputLeft(): string
390390
}
391391

392392
/**
393-
* @param string $sString1
394-
* @param string $sString2
393+
* @param string $string1
394+
* @param string $string2
395395
* @param bool $caseInsensitive
396396
*/
397-
public function streql($sString1, $sString2, $caseInsensitive = true): bool
397+
public function streql($string1, $string2, $caseInsensitive = true): bool
398398
{
399399
if ($caseInsensitive) {
400-
return $this->strtolower($sString1) === $this->strtolower($sString2);
400+
return $this->strtolower($string1) === $this->strtolower($string2);
401401
} else {
402-
return $sString1 === $sString2;
402+
return $string1 === $string2;
403403
}
404404
}
405405

@@ -412,14 +412,14 @@ public function backtrack($iAmount): void
412412
}
413413

414414
/**
415-
* @param string $sString
415+
* @param string $string
416416
*/
417-
public function strlen($sString): int
417+
public function strlen($string): int
418418
{
419419
if ($this->parserSettings->bMultibyteSupport) {
420-
return \mb_strlen($sString, $this->charset);
420+
return \mb_strlen($string, $this->charset);
421421
} else {
422-
return \strlen($sString);
422+
return \strlen($string);
423423
}
424424
}
425425

@@ -445,63 +445,63 @@ private function substr($iStart, $length): string
445445
}
446446

447447
/**
448-
* @param string $sString
448+
* @param string $string
449449
*/
450-
private function strtolower($sString): string
450+
private function strtolower($string): string
451451
{
452452
if ($this->parserSettings->bMultibyteSupport) {
453-
return \mb_strtolower($sString, $this->charset);
453+
return \mb_strtolower($string, $this->charset);
454454
} else {
455-
return \strtolower($sString);
455+
return \strtolower($string);
456456
}
457457
}
458458

459459
/**
460-
* @param string $sString
460+
* @param string $string
461461
*
462462
* @return array<int, string>
463463
*
464464
* @throws SourceException if the charset is UTF-8 and the string contains invalid byte sequences
465465
*/
466-
private function strsplit($sString)
466+
private function strsplit($string)
467467
{
468468
if ($this->parserSettings->bMultibyteSupport) {
469469
if ($this->streql($this->charset, 'utf-8')) {
470-
$result = \preg_split('//u', $sString, -1, PREG_SPLIT_NO_EMPTY);
470+
$result = \preg_split('//u', $string, -1, PREG_SPLIT_NO_EMPTY);
471471
if (!\is_array($result)) {
472472
throw new SourceException('`preg_split` failed with error ' . \preg_last_error());
473473
}
474474
return $result;
475475
} else {
476-
$length = \mb_strlen($sString, $this->charset);
476+
$length = \mb_strlen($string, $this->charset);
477477
$result = [];
478478
for ($i = 0; $i < $length; ++$i) {
479-
$result[] = \mb_substr($sString, $i, 1, $this->charset);
479+
$result[] = \mb_substr($string, $i, 1, $this->charset);
480480
}
481481
return $result;
482482
}
483483
} else {
484-
if ($sString === '') {
484+
if ($string === '') {
485485
return [];
486486
} else {
487-
return \str_split($sString);
487+
return \str_split($string);
488488
}
489489
}
490490
}
491491

492492
/**
493-
* @param string $sString
493+
* @param string $string
494494
* @param string $sNeedle
495495
* @param int $offset
496496
*
497497
* @return int|false
498498
*/
499-
private function strpos($sString, $sNeedle, $offset)
499+
private function strpos($string, $sNeedle, $offset)
500500
{
501501
if ($this->parserSettings->bMultibyteSupport) {
502-
return \mb_strpos($sString, $sNeedle, $offset, $this->charset);
502+
return \mb_strpos($string, $sNeedle, $offset, $this->charset);
503503
} else {
504-
return \strpos($sString, $sNeedle, $offset);
504+
return \strpos($string, $sNeedle, $offset);
505505
}
506506
}
507507
}

src/RuleSet/DeclarationBlock.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,18 +45,18 @@ public static function parse(ParserState $parserState, $list = null)
4545
$result = new DeclarationBlock($parserState->currentLine());
4646
try {
4747
$aSelectorParts = [];
48-
$sStringWrapperChar = false;
48+
$stringWrapperCharacter = false;
4949
do {
5050
$aSelectorParts[] = $parserState->consume(1)
5151
. $parserState->consumeUntil(['{', '}', '\'', '"'], false, false, $comments);
5252
if (\in_array($parserState->peek(), ['\'', '"'], true) && \substr(\end($aSelectorParts), -1) != '\\') {
53-
if ($sStringWrapperChar === false) {
54-
$sStringWrapperChar = $parserState->peek();
55-
} elseif ($sStringWrapperChar == $parserState->peek()) {
56-
$sStringWrapperChar = false;
53+
if ($stringWrapperCharacter === false) {
54+
$stringWrapperCharacter = $parserState->peek();
55+
} elseif ($stringWrapperCharacter == $parserState->peek()) {
56+
$stringWrapperCharacter = false;
5757
}
5858
}
59-
} while (!\in_array($parserState->peek(), ['{', '}'], true) || $sStringWrapperChar !== false);
59+
} while (!\in_array($parserState->peek(), ['{', '}'], true) || $stringWrapperCharacter !== false);
6060
$result->setSelectors(\implode('', $aSelectorParts), $list);
6161
if ($parserState->comes('{')) {
6262
$parserState->consume(1);

src/Value/CSSString.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@ class CSSString extends PrimitiveValue
2020
/**
2121
* @var string
2222
*/
23-
private $sString;
23+
private $string;
2424

2525
/**
26-
* @param string $sString
26+
* @param string $string
2727
* @param int<0, max> $lineNumber
2828
*/
29-
public function __construct($sString, $lineNumber = 0)
29+
public function __construct($string, $lineNumber = 0)
3030
{
31-
$this->sString = $sString;
31+
$this->string = $string;
3232
parent::__construct($lineNumber);
3333
}
3434

@@ -75,19 +75,19 @@ public static function parse(ParserState $parserState): CSSString
7575
}
7676

7777
/**
78-
* @param string $sString
78+
* @param string $string
7979
*/
80-
public function setString($sString): void
80+
public function setString($string): void
8181
{
82-
$this->sString = $sString;
82+
$this->string = $string;
8383
}
8484

8585
/**
8686
* @return string
8787
*/
8888
public function getString()
8989
{
90-
return $this->sString;
90+
return $this->string;
9191
}
9292

9393
public function __toString(): string
@@ -97,8 +97,8 @@ public function __toString(): string
9797

9898
public function render(OutputFormat $outputFormat): string
9999
{
100-
$sString = \addslashes($this->sString);
101-
$sString = \str_replace("\n", '\\A', $sString);
102-
return $outputFormat->getStringQuotingType() . $sString . $outputFormat->getStringQuotingType();
100+
$string = \addslashes($this->string);
101+
$string = \str_replace("\n", '\\A', $string);
102+
return $outputFormat->getStringQuotingType() . $string . $outputFormat->getStringQuotingType();
103103
}
104104
}

0 commit comments

Comments
 (0)