Skip to content

Commit f185d93

Browse files
committed
[CLEANUP] Use common ancestor Value in type specifications
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 f9f3e40 commit f185d93

File tree

6 files changed

+12
-18
lines changed

6 files changed

+12
-18
lines changed

README.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -813,12 +813,6 @@ 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
822816
```
823817

824818
## 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: 4 additions & 4 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

@@ -24,7 +24,7 @@ abstract class ValueList extends Value
2424

2525
/**
2626
* phpcs:ignore Generic.Files.LineLength
27-
* @param array<int, RuleValueList|CSSFunction|CSSString|LineName|Size|URL|string>|RuleValueList|CSSFunction|CSSString|LineName|Size|URL|string $aComponents
27+
* @param array<int, Value|string>|Value|string $aComponents
2828
* @param string $sSeparator
2929
* @param int $iLineNo
3030
*/
@@ -49,15 +49,15 @@ public function addListComponent($mComponent)
4949
}
5050

5151
/**
52-
* @return array<int, RuleValueList|CSSFunction|CSSString|LineName|Size|URL|string>
52+
* @return array<int, Value|string>
5353
*/
5454
public function getListComponents()
5555
{
5656
return $this->aComponents;
5757
}
5858

5959
/**
60-
* @param array<int, RuleValueList|CSSFunction|CSSString|LineName|Size|URL|string> $aComponents
60+
* @param array<int, Value|string> $aComponents
6161
*
6262
* @return void
6363
*/

0 commit comments

Comments
 (0)