Skip to content

[CLEANUP] Use common ancestor Value in type specifications #507

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -813,12 +813,7 @@ classDiagram
RuleSet --> "*" Comment : aComments
RuleSet --> "*" Rule : aRules
URL --> "1" CSSString : oURL
ValueList --> "*" CSSFunction : aComponents
ValueList --> "*" CSSString : aComponents
ValueList --> "*" LineName : aComponents
ValueList --> "*" RuleValueList : aComponents
ValueList --> "*" Size : aComponents
ValueList --> "*" URL : aComponents
ValueList --> "*" Value : aComponents
```

## Contributors/Thanks to
Expand Down
4 changes: 2 additions & 2 deletions src/Value/CSSFunction.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class CSSFunction extends ValueList

/**
* @param string $sName
* @param RuleValueList|array<int, RuleValueList|CSSFunction|CSSString|LineName|Size|URL|string> $aArguments
* @param RuleValueList|array<int, Value|string> $aArguments
* @param string $sSeparator
* @param int $iLineNo
*/
Expand Down Expand Up @@ -72,7 +72,7 @@ public function setName($sName)
}

/**
* @return array<int, RuleValueList|CSSFunction|CSSString|LineName|Size|URL|string>
* @return array<int, Value|string>
*/
public function getArguments()
{
Expand Down
6 changes: 3 additions & 3 deletions src/Value/Color.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
class Color extends CSSFunction
{
/**
* @param array<int, RuleValueList|CSSFunction|CSSString|LineName|Size|URL|string> $aColor
* @param array<int, Value|string> $aColor
* @param int $iLineNo
*/
public function __construct(array $aColor, $iLineNo = 0)
Expand Down Expand Up @@ -125,15 +125,15 @@ private static function mapRange($fVal, $fFromMin, $fFromMax, $fToMin, $fToMax)
}

/**
* @return array<int, RuleValueList|CSSFunction|CSSString|LineName|Size|URL|string>
* @return array<int, Value|string>
*/
public function getColor()
{
return $this->aComponents;
}

/**
* @param array<int, RuleValueList|CSSFunction|CSSString|LineName|Size|URL|string> $aColor
* @param array<int, Value|string> $aColor
*
* @return void
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Value/LineName.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
class LineName extends ValueList
{
/**
* @param array<int, RuleValueList|CSSFunction|CSSString|LineName|Size|URL|string> $aComponents
* @param array<int, Value|string> $aComponents
* @param int $iLineNo
*/
public function __construct(array $aComponents = [], $iLineNo = 0)
Expand Down
4 changes: 2 additions & 2 deletions src/Value/Value.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ public function __construct($iLineNo = 0)
/**
* @param array<array-key, string> $aListDelimiters
*
* @return RuleValueList|CSSFunction|CSSString|LineName|Size|URL|string
* @return Value|string
*
* @throws UnexpectedTokenException
* @throws UnexpectedEOFException
*/
public static function parseValue(ParserState $oParserState, array $aListDelimiters = [])
{
/** @var array<int, RuleValueList|CSSFunction|CSSString|LineName|Size|URL|string> $aStack */
/** @var array<int, Value|string> $aStack */
$aStack = [];
$oParserState->consumeWhiteSpace();
//Build a list of delimiters and parsed values
Expand Down
11 changes: 5 additions & 6 deletions src/Value/ValueList.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
abstract class ValueList extends Value
{
/**
* @var array<int, RuleValueList|CSSFunction|CSSString|LineName|Size|URL|string>
* @var array<int, Value|string>
*/
protected $aComponents;

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

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

/**
* @param RuleValueList|CSSFunction|CSSString|LineName|Size|URL|string $mComponent
* @param Value|string $mComponent
*
* @return void
*/
Expand All @@ -49,15 +48,15 @@ public function addListComponent($mComponent)
}

/**
* @return array<int, RuleValueList|CSSFunction|CSSString|LineName|Size|URL|string>
* @return array<int, Value|string>
*/
public function getListComponents()
{
return $this->aComponents;
}

/**
* @param array<int, RuleValueList|CSSFunction|CSSString|LineName|Size|URL|string> $aComponents
* @param array<int, Value|string> $aComponents
*
* @return void
*/
Expand Down