Skip to content

Commit 4384bbe

Browse files
authored
[CLEANUP] Avoid Hungarian notation in Rule (#992)
Part of #756
1 parent 66fbb73 commit 4384bbe

File tree

1 file changed

+58
-58
lines changed

1 file changed

+58
-58
lines changed

src/Rule/Rule.php

Lines changed: 58 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -24,22 +24,22 @@ class Rule implements Renderable, Commentable
2424
/**
2525
* @var string
2626
*/
27-
private $sRule;
27+
private $rule;
2828

2929
/**
3030
* @var RuleValueList|string|null
3131
*/
32-
private $mValue;
32+
private $value;
3333

3434
/**
3535
* @var bool
3636
*/
37-
private $bIsImportant = false;
37+
private $isImportant = false;
3838

3939
/**
4040
* @var array<int, int>
4141
*/
42-
private $aIeHack = [];
42+
private $ieHack = [];
4343

4444
/**
4545
* @var int
@@ -51,7 +51,7 @@ class Rule implements Renderable, Commentable
5151
*
5252
* @internal since 8.8.0
5353
*/
54-
protected $iColNo;
54+
protected $columnNumber;
5555

5656
/**
5757
* @var array<array-key, Comment>
@@ -61,15 +61,15 @@ class Rule implements Renderable, Commentable
6161
protected $comments = [];
6262

6363
/**
64-
* @param string $sRule
64+
* @param string $rule
6565
* @param int<0, max> $lineNumber
66-
* @param int $iColNo
66+
* @param int $columnNumber
6767
*/
68-
public function __construct($sRule, $lineNumber = 0, $iColNo = 0)
68+
public function __construct($rule, $lineNumber = 0, $columnNumber = 0)
6969
{
70-
$this->sRule = $sRule;
70+
$this->rule = $rule;
7171
$this->lineNumber = $lineNumber;
72-
$this->iColNo = $iColNo;
72+
$this->columnNumber = $columnNumber;
7373
}
7474

7575
/**
@@ -89,8 +89,8 @@ public static function parse(ParserState $parserState): Rule
8989
$rule->setComments($comments);
9090
$rule->addComments($parserState->consumeWhiteSpace());
9191
$parserState->consume(':');
92-
$oValue = Value::parseValue($parserState, self::listDelimiterForRule($rule->getRule()));
93-
$rule->setValue($oValue);
92+
$value = Value::parseValue($parserState, self::listDelimiterForRule($rule->getRule()));
93+
$rule->setValue($value);
9494
if ($parserState->getSettings()->bLenientParsing) {
9595
while ($parserState->comes('\\')) {
9696
$parserState->consume('\\');
@@ -120,17 +120,17 @@ public static function parse(ParserState $parserState): Rule
120120
* The first item is the innermost separator (or, put another way, the highest-precedence operator).
121121
* The sequence continues to the outermost separator (or lowest-precedence operator).
122122
*
123-
* @param string $sRule
123+
* @param string $rule
124124
*
125125
* @return list<non-empty-string>
126126
*/
127-
private static function listDelimiterForRule($sRule): array
127+
private static function listDelimiterForRule($rule): array
128128
{
129-
if (\preg_match('/^font($|-)/', $sRule)) {
129+
if (\preg_match('/^font($|-)/', $rule)) {
130130
return [',', '/', ' '];
131131
}
132132

133-
switch ($sRule) {
133+
switch ($rule) {
134134
case 'src':
135135
return [' ', ','];
136136
default:
@@ -151,113 +151,113 @@ public function getLineNo(): int
151151
*/
152152
public function getColNo()
153153
{
154-
return $this->iColNo;
154+
return $this->columnNumber;
155155
}
156156

157157
/**
158-
* @param int $iLine
159-
* @param int $iColumn
158+
* @param int $lineNumber
159+
* @param int $columnNumber
160160
*/
161-
public function setPosition($iLine, $iColumn): void
161+
public function setPosition($lineNumber, $columnNumber): void
162162
{
163-
$this->iColNo = $iColumn;
164-
$this->lineNumber = $iLine;
163+
$this->columnNumber = $columnNumber;
164+
$this->lineNumber = $lineNumber;
165165
}
166166

167167
/**
168-
* @param string $sRule
168+
* @param string $rule
169169
*/
170-
public function setRule($sRule): void
170+
public function setRule($rule): void
171171
{
172-
$this->sRule = $sRule;
172+
$this->rule = $rule;
173173
}
174174

175175
/**
176176
* @return string
177177
*/
178178
public function getRule()
179179
{
180-
return $this->sRule;
180+
return $this->rule;
181181
}
182182

183183
/**
184184
* @return RuleValueList|string|null
185185
*/
186186
public function getValue()
187187
{
188-
return $this->mValue;
188+
return $this->value;
189189
}
190190

191191
/**
192192
* @param RuleValueList|string|null $mValue
193193
*/
194194
public function setValue($mValue): void
195195
{
196-
$this->mValue = $mValue;
196+
$this->value = $mValue;
197197
}
198198

199199
/**
200200
* Adds a value to the existing value. Value will be appended if a `RuleValueList` exists of the given type.
201201
* Otherwise, the existing value will be wrapped by one.
202202
*
203-
* @param RuleValueList|array<int, RuleValueList> $mValue
204-
* @param string $sType
203+
* @param RuleValueList|array<int, RuleValueList> $value
204+
* @param string $type
205205
*/
206-
public function addValue($mValue, $sType = ' '): void
206+
public function addValue($value, $type = ' '): void
207207
{
208-
if (!\is_array($mValue)) {
209-
$mValue = [$mValue];
208+
if (!\is_array($value)) {
209+
$value = [$value];
210210
}
211-
if (!($this->mValue instanceof RuleValueList) || $this->mValue->getListSeparator() !== $sType) {
212-
$mCurrentValue = $this->mValue;
213-
$this->mValue = new RuleValueList($sType, $this->lineNumber);
214-
if ($mCurrentValue) {
215-
$this->mValue->addListComponent($mCurrentValue);
211+
if (!($this->value instanceof RuleValueList) || $this->value->getListSeparator() !== $type) {
212+
$currentValue = $this->value;
213+
$this->value = new RuleValueList($type, $this->lineNumber);
214+
if ($currentValue) {
215+
$this->value->addListComponent($currentValue);
216216
}
217217
}
218-
foreach ($mValue as $mValueItem) {
219-
$this->mValue->addListComponent($mValueItem);
218+
foreach ($value as $valueItem) {
219+
$this->value->addListComponent($valueItem);
220220
}
221221
}
222222

223223
/**
224-
* @param int $iModifier
224+
* @param int $modifier
225225
*/
226-
public function addIeHack($iModifier): void
226+
public function addIeHack($modifier): void
227227
{
228-
$this->aIeHack[] = $iModifier;
228+
$this->ieHack[] = $modifier;
229229
}
230230

231231
/**
232-
* @param array<int, int> $aModifiers
232+
* @param array<int, int> $modifiers
233233
*/
234-
public function setIeHack(array $aModifiers): void
234+
public function setIeHack(array $modifiers): void
235235
{
236-
$this->aIeHack = $aModifiers;
236+
$this->ieHack = $modifiers;
237237
}
238238

239239
/**
240240
* @return array<int, int>
241241
*/
242242
public function getIeHack()
243243
{
244-
return $this->aIeHack;
244+
return $this->ieHack;
245245
}
246246

247247
/**
248-
* @param bool $bIsImportant
248+
* @param bool $isImportant
249249
*/
250-
public function setIsImportant($bIsImportant): void
250+
public function setIsImportant($isImportant): void
251251
{
252-
$this->bIsImportant = $bIsImportant;
252+
$this->isImportant = $isImportant;
253253
}
254254

255255
/**
256256
* @return bool
257257
*/
258258
public function getIsImportant()
259259
{
260-
return $this->bIsImportant;
260+
return $this->isImportant;
261261
}
262262

263263
public function __toString(): string
@@ -267,16 +267,16 @@ public function __toString(): string
267267

268268
public function render(OutputFormat $outputFormat): string
269269
{
270-
$result = "{$outputFormat->comments($this)}{$this->sRule}:{$outputFormat->spaceAfterRuleName()}";
271-
if ($this->mValue instanceof Value) { // Can also be a ValueList
272-
$result .= $this->mValue->render($outputFormat);
270+
$result = "{$outputFormat->comments($this)}{$this->rule}:{$outputFormat->spaceAfterRuleName()}";
271+
if ($this->value instanceof Value) { // Can also be a ValueList
272+
$result .= $this->value->render($outputFormat);
273273
} else {
274-
$result .= $this->mValue;
274+
$result .= $this->value;
275275
}
276-
if (!empty($this->aIeHack)) {
277-
$result .= ' \\' . \implode('\\', $this->aIeHack);
276+
if (!empty($this->ieHack)) {
277+
$result .= ' \\' . \implode('\\', $this->ieHack);
278278
}
279-
if ($this->bIsImportant) {
279+
if ($this->isImportant) {
280280
$result .= ' !important';
281281
}
282282
$result .= ';';

0 commit comments

Comments
 (0)