Skip to content

Commit e72ca42

Browse files
committed
[CLEANUP] Avoid Hungarian notation for components
Part of #756
1 parent 5421a6d commit e72ca42

File tree

5 files changed

+29
-29
lines changed

5 files changed

+29
-29
lines changed

src/Value/CSSFunction.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ public function setName($sName): void
102102
*/
103103
public function getArguments()
104104
{
105-
return $this->aComponents;
105+
return $this->components;
106106
}
107107

108108
/**

src/Value/CalcRuleValueList.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ public function __construct($lineNumber = 0)
1818

1919
public function render(OutputFormat $outputFormat): string
2020
{
21-
return $outputFormat->implode(' ', $this->aComponents);
21+
return $outputFormat->implode(' ', $this->components);
2222
}
2323
}

src/Value/Color.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ private static function mapRange(float $value, float $fromMin, float $fromMax, f
204204
*/
205205
public function getColor()
206206
{
207-
return $this->aComponents;
207+
return $this->components;
208208
}
209209

210210
/**
@@ -213,7 +213,7 @@ public function getColor()
213213
public function setColor(array $colorValues): void
214214
{
215215
$this->setName(\implode('', \array_keys($colorValues)));
216-
$this->aComponents = $colorValues;
216+
$this->components = $colorValues;
217217
}
218218

219219
/**
@@ -260,7 +260,7 @@ private function shouldRenderAsHex(OutputFormat $outputFormat): bool
260260
*/
261261
private function getRealName(): string
262262
{
263-
return \implode('', \array_keys($this->aComponents));
263+
return \implode('', \array_keys($this->components));
264264
}
265265

266266
/**
@@ -269,7 +269,7 @@ private function getRealName(): string
269269
*/
270270
private function allComponentsAreNumbers(): bool
271271
{
272-
foreach ($this->aComponents as $component) {
272+
foreach ($this->components as $component) {
273273
if (!($component instanceof Size) || $component->getUnit() !== null) {
274274
return false;
275275
}
@@ -280,7 +280,7 @@ private function allComponentsAreNumbers(): bool
280280

281281
/**
282282
* Note that this method assumes the following:
283-
* - The `aComponents` array has keys for `r`, `g` and `b`;
283+
* - The `components` array has keys for `r`, `g` and `b`;
284284
* - The values in the array are all instances of `Size`.
285285
*
286286
* Errors will be triggered or thrown if this is not the case.
@@ -291,9 +291,9 @@ private function renderAsHex(): string
291291
{
292292
$result = \sprintf(
293293
'%02x%02x%02x',
294-
$this->aComponents['r']->getSize(),
295-
$this->aComponents['g']->getSize(),
296-
$this->aComponents['b']->getSize()
294+
$this->components['r']->getSize(),
295+
$this->components['g']->getSize(),
296+
$this->components['b']->getSize()
297297
);
298298
$canUseShortVariant = ($result[0] == $result[1]) && ($result[2] == $result[3]) && ($result[4] == $result[5]);
299299

@@ -327,7 +327,7 @@ private function shouldRenderInModernSyntax(): bool
327327

328328
$hasPercentage = false;
329329
$hasNumber = false;
330-
foreach ($this->aComponents as $key => $value) {
330+
foreach ($this->components as $key => $value) {
331331
if ($key === 'a') {
332332
// Alpha can have units that don't match those of the RGB components in the "legacy" syntax.
333333
// So it is not necessary to check it. It's also always last, hence `break` rather than `continue`.
@@ -354,7 +354,7 @@ private function shouldRenderInModernSyntax(): bool
354354

355355
private function hasNoneAsComponentValue(): bool
356356
{
357-
return \in_array('none', $this->aComponents, true);
357+
return \in_array('none', $this->components, true);
358358
}
359359

360360
/**
@@ -376,10 +376,10 @@ private function colorFunctionMayHaveMixedValueTypes(string $function): bool
376376
private function renderInModernSyntax(OutputFormat $outputFormat): string
377377
{
378378
// Maybe not yet without alpha, but will be...
379-
$componentsWithoutAlpha = $this->aComponents;
379+
$componentsWithoutAlpha = $this->components;
380380
\end($componentsWithoutAlpha);
381381
if (\key($componentsWithoutAlpha) === 'a') {
382-
$alpha = $this->aComponents['a'];
382+
$alpha = $this->components['a'];
383383
unset($componentsWithoutAlpha['a']);
384384
}
385385

src/Value/LineName.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@
1212
class LineName extends ValueList
1313
{
1414
/**
15-
* @param array<int, Value|string> $aComponents
15+
* @param array<int, Value|string> $components
1616
* @param int<0, max> $lineNumber
1717
*/
18-
public function __construct(array $aComponents = [], $lineNumber = 0)
18+
public function __construct(array $components = [], $lineNumber = 0)
1919
{
20-
parent::__construct($aComponents, ' ', $lineNumber);
20+
parent::__construct($components, ' ', $lineNumber);
2121
}
2222

2323
/**

src/Value/ValueList.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ abstract class ValueList extends Value
1919
*
2020
* @internal since 8.8.0
2121
*/
22-
protected $aComponents;
22+
protected $components;
2323

2424
/**
2525
* @var string
@@ -29,17 +29,17 @@ abstract class ValueList extends Value
2929
protected $sSeparator;
3030

3131
/**
32-
* @param array<array-key, Value|string>|Value|string $aComponents
32+
* @param array<array-key, Value|string>|Value|string $components
3333
* @param string $sSeparator
3434
* @param int<0, max> $lineNumber
3535
*/
36-
public function __construct($aComponents = [], $sSeparator = ',', $lineNumber = 0)
36+
public function __construct($components = [], $sSeparator = ',', $lineNumber = 0)
3737
{
3838
parent::__construct($lineNumber);
39-
if (!\is_array($aComponents)) {
40-
$aComponents = [$aComponents];
39+
if (!\is_array($components)) {
40+
$components = [$components];
4141
}
42-
$this->aComponents = $aComponents;
42+
$this->components = $components;
4343
$this->sSeparator = $sSeparator;
4444
}
4545

@@ -48,23 +48,23 @@ public function __construct($aComponents = [], $sSeparator = ',', $lineNumber =
4848
*/
4949
public function addListComponent($component): void
5050
{
51-
$this->aComponents[] = $component;
51+
$this->components[] = $component;
5252
}
5353

5454
/**
5555
* @return array<array-key, Value|string>
5656
*/
5757
public function getListComponents()
5858
{
59-
return $this->aComponents;
59+
return $this->components;
6060
}
6161

6262
/**
63-
* @param array<array-key, Value|string> $aComponents
63+
* @param array<array-key, Value|string> $components
6464
*/
65-
public function setListComponents(array $aComponents): void
65+
public function setListComponents(array $components): void
6666
{
67-
$this->aComponents = $aComponents;
67+
$this->components = $components;
6868
}
6969

7070
/**
@@ -96,7 +96,7 @@ public function render(OutputFormat $outputFormat): string
9696
return $outputFormat->implode(
9797
$outputFormat->spaceBeforeListArgumentSeparator($this->sSeparator) . $this->sSeparator
9898
. $outputFormat->spaceAfterListArgumentSeparator($this->sSeparator),
99-
$this->aComponents
99+
$this->components
100100
);
101101
}
102102
}

0 commit comments

Comments
 (0)