Skip to content

Commit c26f4a3

Browse files
authored
[BUGFIX] Correct type annotation for ValueList components (#826)
The `Color` class uses this property (`aComponents`) as an associative array. Therefore all related type annotations need `array-key` rather than `int` for the array key type. Co-authored-by: Jake Hotson <[email protected]>
1 parent 59bcb6c commit c26f4a3

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

src/Value/CSSFunction.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class CSSFunction extends ValueList
2020

2121
/**
2222
* @param string $sName
23-
* @param RuleValueList|array<int, Value|string> $aArguments
23+
* @param RuleValueList|array<array-key, Value|string> $aArguments
2424
* @param string $sSeparator
2525
* @param int $iLineNo
2626
*/
@@ -91,7 +91,7 @@ public function setName($sName): void
9191
}
9292

9393
/**
94-
* @return array<int, Value|string>
94+
* @return array<array-key, Value|string>
9595
*/
9696
public function getArguments()
9797
{

src/Value/Color.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
class Color extends CSSFunction
1717
{
1818
/**
19-
* @param array<int, Value|string> $colorValues
19+
* @param array<array-key, Value|string> $colorValues
2020
* @param int $lineNumber
2121
*/
2222
public function __construct(array $colorValues, $lineNumber = 0)
@@ -193,15 +193,15 @@ private static function mapRange(float $value, float $fromMin, float $fromMax, f
193193
}
194194

195195
/**
196-
* @return array<int, Value|string>
196+
* @return array<array-key, Value|string>
197197
*/
198198
public function getColor()
199199
{
200200
return $this->aComponents;
201201
}
202202

203203
/**
204-
* @param array<int, Value|string> $colorValues
204+
* @param array<array-key, Value|string> $colorValues
205205
*/
206206
public function setColor(array $colorValues): void
207207
{

src/Value/ValueList.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
abstract class ValueList extends Value
1616
{
1717
/**
18-
* @var array<int, Value|string>
18+
* @var array<array-key, Value|string>
1919
*/
2020
protected $aComponents;
2121

@@ -25,7 +25,7 @@ abstract class ValueList extends Value
2525
protected $sSeparator;
2626

2727
/**
28-
* @param array<int, Value|string>|Value|string $aComponents
28+
* @param array<array-key, Value|string>|Value|string $aComponents
2929
* @param string $sSeparator
3030
* @param int $iLineNo
3131
*/
@@ -48,15 +48,15 @@ public function addListComponent($mComponent): void
4848
}
4949

5050
/**
51-
* @return array<int, Value|string>
51+
* @return array<array-key, Value|string>
5252
*/
5353
public function getListComponents()
5454
{
5555
return $this->aComponents;
5656
}
5757

5858
/**
59-
* @param array<int, Value|string> $aComponents
59+
* @param array<array-key, Value|string> $aComponents
6060
*/
6161
public function setListComponents(array $aComponents): void
6262
{

0 commit comments

Comments
 (0)