Skip to content

Commit fa66e43

Browse files
authored
[CLEANUP] Avoid Hungarian notation for prefix (#926)
Part of #756
1 parent fa5ff8a commit fa66e43

File tree

3 files changed

+20
-20
lines changed

3 files changed

+20
-20
lines changed

src/CSSList/CSSList.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -194,15 +194,15 @@ private static function parseAtRule(ParserState $parserState)
194194
}
195195
return $result;
196196
} elseif ($identifier === 'namespace') {
197-
$sPrefix = null;
197+
$prefix = null;
198198
$url = Value::parsePrimitiveValue($parserState);
199199
if (!$parserState->comes(';')) {
200-
$sPrefix = $url;
200+
$prefix = $url;
201201
$url = Value::parsePrimitiveValue($parserState);
202202
}
203203
$parserState->consumeUntil([';', ParserState::EOF], true, true);
204-
if ($sPrefix !== null && !\is_string($sPrefix)) {
205-
throw new UnexpectedTokenException('Wrong namespace prefix', $sPrefix, 'custom', $identifierLineNumber);
204+
if ($prefix !== null && !\is_string($prefix)) {
205+
throw new UnexpectedTokenException('Wrong namespace prefix', $prefix, 'custom', $identifierLineNumber);
206206
}
207207
if (!($url instanceof CSSString || $url instanceof URL)) {
208208
throw new UnexpectedTokenException(
@@ -212,7 +212,7 @@ private static function parseAtRule(ParserState $parserState)
212212
$identifierLineNumber
213213
);
214214
}
215-
return new CSSNamespace($url, $sPrefix, $identifierLineNumber);
215+
return new CSSNamespace($url, $prefix, $identifierLineNumber);
216216
} else {
217217
// Unknown other at rule (font-face or such)
218218
$arguments = \trim($parserState->consumeUntil('{', false, true));

src/OutputFormat.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -237,8 +237,8 @@ public function __construct() {}
237237
public function get(string $sName)
238238
{
239239
$aVarPrefixes = ['a', 's', 'm', 'b', 'f', 'o', 'c', 'i'];
240-
foreach ($aVarPrefixes as $sPrefix) {
241-
$sFieldName = $sPrefix . \ucfirst($sName);
240+
foreach ($aVarPrefixes as $prefix) {
241+
$sFieldName = $prefix . \ucfirst($sName);
242242
if (isset($this->$sFieldName)) {
243243
return $this->$sFieldName;
244244
}
@@ -265,10 +265,10 @@ public function set($aNames, $mValue)
265265
} elseif (!\is_array($aNames)) {
266266
$aNames = [$aNames];
267267
}
268-
foreach ($aVarPrefixes as $sPrefix) {
268+
foreach ($aVarPrefixes as $prefix) {
269269
$bDidReplace = false;
270270
foreach ($aNames as $sName) {
271-
$sFieldName = $sPrefix . \ucfirst($sName);
271+
$sFieldName = $prefix . \ucfirst($sName);
272272
if (isset($this->$sFieldName)) {
273273
$this->$sFieldName = $mValue;
274274
$bDidReplace = true;

src/Property/CSSNamespace.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class CSSNamespace implements AtRule
2020
/**
2121
* @var string
2222
*/
23-
private $sPrefix;
23+
private $prefix;
2424

2525
/**
2626
* @var int
@@ -36,13 +36,13 @@ class CSSNamespace implements AtRule
3636

3737
/**
3838
* @param string $mUrl
39-
* @param string|null $sPrefix
39+
* @param string|null $prefix
4040
* @param int<0, max> $lineNumber
4141
*/
42-
public function __construct($mUrl, $sPrefix = null, $lineNumber = 0)
42+
public function __construct($mUrl, $prefix = null, $lineNumber = 0)
4343
{
4444
$this->mUrl = $mUrl;
45-
$this->sPrefix = $sPrefix;
45+
$this->prefix = $prefix;
4646
$this->lineNumber = $lineNumber;
4747
$this->comments = [];
4848
}
@@ -62,7 +62,7 @@ public function __toString(): string
6262

6363
public function render(OutputFormat $outputFormat): string
6464
{
65-
return '@namespace ' . ($this->sPrefix === null ? '' : $this->sPrefix . ' ')
65+
return '@namespace ' . ($this->prefix === null ? '' : $this->prefix . ' ')
6666
. $this->mUrl->render($outputFormat) . ';';
6767
}
6868

@@ -79,7 +79,7 @@ public function getUrl()
7979
*/
8080
public function getPrefix()
8181
{
82-
return $this->sPrefix;
82+
return $this->prefix;
8383
}
8484

8585
/**
@@ -91,11 +91,11 @@ public function setUrl($mUrl): void
9191
}
9292

9393
/**
94-
* @param string $sPrefix
94+
* @param string $prefix
9595
*/
96-
public function setPrefix($sPrefix): void
96+
public function setPrefix($prefix): void
9797
{
98-
$this->sPrefix = $sPrefix;
98+
$this->prefix = $prefix;
9999
}
100100

101101
/**
@@ -112,8 +112,8 @@ public function atRuleName(): string
112112
public function atRuleArgs(): array
113113
{
114114
$result = [$this->mUrl];
115-
if ($this->sPrefix) {
116-
\array_unshift($result, $this->sPrefix);
115+
if ($this->prefix) {
116+
\array_unshift($result, $this->prefix);
117117
}
118118
return $result;
119119
}

0 commit comments

Comments
 (0)