Skip to content

Commit 086fa00

Browse files
authored
[CLEANUP] Use common ancestor Value in type specifications (#507)
Replace the list of various possible sub-types with the common ancestor. Update the class diagram to indicate that `ValueList::$aComponents` no longer has a dependency on the sub-types definitions. Resolves #499. Supersedes and closes #506.
1 parent 498d504 commit 086fa00

File tree

6 files changed

+14
-20
lines changed

6 files changed

+14
-20
lines changed

README.md

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -813,12 +813,7 @@ classDiagram
813813
RuleSet --> "*" Comment : aComments
814814
RuleSet --> "*" Rule : aRules
815815
URL --> "1" CSSString : oURL
816-
ValueList --> "*" CSSFunction : aComponents
817-
ValueList --> "*" CSSString : aComponents
818-
ValueList --> "*" LineName : aComponents
819-
ValueList --> "*" RuleValueList : aComponents
820-
ValueList --> "*" Size : aComponents
821-
ValueList --> "*" URL : aComponents
816+
ValueList --> "*" Value : aComponents
822817
```
823818

824819
## Contributors/Thanks to

src/Value/CSSFunction.php

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

1919
/**
2020
* @param string $sName
21-
* @param RuleValueList|array<int, RuleValueList|CSSFunction|CSSString|LineName|Size|URL|string> $aArguments
21+
* @param RuleValueList|array<int, Value|string> $aArguments
2222
* @param string $sSeparator
2323
* @param int $iLineNo
2424
*/
@@ -72,7 +72,7 @@ public function setName($sName)
7272
}
7373

7474
/**
75-
* @return array<int, RuleValueList|CSSFunction|CSSString|LineName|Size|URL|string>
75+
* @return array<int, Value|string>
7676
*/
7777
public function getArguments()
7878
{

src/Value/Color.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
class Color extends CSSFunction
1515
{
1616
/**
17-
* @param array<int, RuleValueList|CSSFunction|CSSString|LineName|Size|URL|string> $aColor
17+
* @param array<int, Value|string> $aColor
1818
* @param int $iLineNo
1919
*/
2020
public function __construct(array $aColor, $iLineNo = 0)
@@ -125,15 +125,15 @@ private static function mapRange($fVal, $fFromMin, $fFromMax, $fToMin, $fToMax)
125125
}
126126

127127
/**
128-
* @return array<int, RuleValueList|CSSFunction|CSSString|LineName|Size|URL|string>
128+
* @return array<int, Value|string>
129129
*/
130130
public function getColor()
131131
{
132132
return $this->aComponents;
133133
}
134134

135135
/**
136-
* @param array<int, RuleValueList|CSSFunction|CSSString|LineName|Size|URL|string> $aColor
136+
* @param array<int, Value|string> $aColor
137137
*
138138
* @return void
139139
*/

src/Value/LineName.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
class LineName extends ValueList
1111
{
1212
/**
13-
* @param array<int, RuleValueList|CSSFunction|CSSString|LineName|Size|URL|string> $aComponents
13+
* @param array<int, Value|string> $aComponents
1414
* @param int $iLineNo
1515
*/
1616
public function __construct(array $aComponents = [], $iLineNo = 0)

src/Value/Value.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,14 @@ public function __construct($iLineNo = 0)
3030
/**
3131
* @param array<array-key, string> $aListDelimiters
3232
*
33-
* @return RuleValueList|CSSFunction|CSSString|LineName|Size|URL|string
33+
* @return Value|string
3434
*
3535
* @throws UnexpectedTokenException
3636
* @throws UnexpectedEOFException
3737
*/
3838
public static function parseValue(ParserState $oParserState, array $aListDelimiters = [])
3939
{
40-
/** @var array<int, RuleValueList|CSSFunction|CSSString|LineName|Size|URL|string> $aStack */
40+
/** @var array<int, Value|string> $aStack */
4141
$aStack = [];
4242
$oParserState->consumeWhiteSpace();
4343
//Build a list of delimiters and parsed values

src/Value/ValueList.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
abstract class ValueList extends Value
1414
{
1515
/**
16-
* @var array<int, RuleValueList|CSSFunction|CSSString|LineName|Size|URL|string>
16+
* @var array<int, Value|string>
1717
*/
1818
protected $aComponents;
1919

@@ -23,8 +23,7 @@ abstract class ValueList extends Value
2323
protected $sSeparator;
2424

2525
/**
26-
* phpcs:ignore Generic.Files.LineLength
27-
* @param array<int, RuleValueList|CSSFunction|CSSString|LineName|Size|URL|string>|RuleValueList|CSSFunction|CSSString|LineName|Size|URL|string $aComponents
26+
* @param array<int, Value|string>|Value|string $aComponents
2827
* @param string $sSeparator
2928
* @param int $iLineNo
3029
*/
@@ -39,7 +38,7 @@ public function __construct($aComponents = [], $sSeparator = ',', $iLineNo = 0)
3938
}
4039

4140
/**
42-
* @param RuleValueList|CSSFunction|CSSString|LineName|Size|URL|string $mComponent
41+
* @param Value|string $mComponent
4342
*
4443
* @return void
4544
*/
@@ -49,15 +48,15 @@ public function addListComponent($mComponent)
4948
}
5049

5150
/**
52-
* @return array<int, RuleValueList|CSSFunction|CSSString|LineName|Size|URL|string>
51+
* @return array<int, Value|string>
5352
*/
5453
public function getListComponents()
5554
{
5655
return $this->aComponents;
5756
}
5857

5958
/**
60-
* @param array<int, RuleValueList|CSSFunction|CSSString|LineName|Size|URL|string> $aComponents
59+
* @param array<int, Value|string> $aComponents
6160
*
6261
* @return void
6362
*/

0 commit comments

Comments
 (0)