diff --git a/CHANGELOG.md b/CHANGELOG.md index 4c17a928e..716779c78 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,7 +33,8 @@ Please also have a look at our - Make all non-private properties `@internal` (#886) - Use more native type declarations and strict mode (#641, #772, #774, #778, #804, #841, #873, #875, #891, #922, #923, #933, #958, - #964, #967, #1000, #1044, #1134, #1136, #1137, #1139, #1140, #1141, #1145) + #964, #967, #1000, #1044, #1134, #1136, #1137, #1139, #1140, #1141, #1145, + #1162) - Add visibility to all class/interface constants (#469) ### Deprecated diff --git a/src/Value/Size.php b/src/Value/Size.php index 9939160b7..bbf91eb5e 100644 --- a/src/Value/Size.php +++ b/src/Value/Size.php @@ -17,7 +17,7 @@ class Size extends PrimitiveValue /** * vh/vw/vm(ax)/vmin/rem are absolute insofar as they don’t scale to the immediate parent (only the viewport) * - * @var array + * @var list */ private const ABSOLUTE_SIZE_UNITS = [ 'px', @@ -38,17 +38,17 @@ class Size extends PrimitiveValue ]; /** - * @var array + * @var list */ private const RELATIVE_SIZE_UNITS = ['%', 'em', 'ex', 'ch', 'fr']; /** - * @var array + * @var list */ private const NON_SIZE_UNITS = ['deg', 'grad', 'rad', 's', 'ms', 'turn', 'Hz', 'kHz']; /** - * @var array>|null + * @var array, array>|null */ private static $SIZE_UNITS = null; @@ -69,11 +69,9 @@ class Size extends PrimitiveValue /** * @param float|int|string $size - * @param string|null $unit - * @param bool $isColorComponent * @param int<0, max> $lineNumber */ - public function __construct($size, $unit = null, $isColorComponent = false, int $lineNumber = 0) + public function __construct($size, ?string $unit = null, bool $isColorComponent = false, int $lineNumber = 0) { parent::__construct($lineNumber); $this->size = (float) $size; @@ -82,14 +80,12 @@ public function __construct($size, $unit = null, $isColorComponent = false, int } /** - * @param bool $isColorComponent - * * @throws UnexpectedEOFException * @throws UnexpectedTokenException * * @internal since V8.8.0 */ - public static function parse(ParserState $parserState, $isColorComponent = false): Size + public static function parse(ParserState $parserState, bool $isColorComponent = false): Size { $size = ''; if ($parserState->comes('-')) { @@ -125,9 +121,9 @@ public static function parse(ParserState $parserState, $isColorComponent = false } /** - * @return array> + * @return array, array> */ - private static function getSizeUnits() + private static function getSizeUnits(): array { if (!\is_array(self::$SIZE_UNITS)) { self::$SIZE_UNITS = []; @@ -146,18 +142,12 @@ private static function getSizeUnits() return self::$SIZE_UNITS; } - /** - * @param string $unit - */ - public function setUnit($unit): void + public function setUnit(string $unit): void { $this->unit = $unit; } - /** - * @return string|null - */ - public function getUnit() + public function getUnit(): ?string { return $this->unit; } @@ -170,18 +160,12 @@ public function setSize($size): void $this->size = (float) $size; } - /** - * @return float - */ - public function getSize() + public function getSize(): float { return $this->size; } - /** - * @return bool - */ - public function isColorComponent() + public function isColorComponent(): bool { return $this->isColorComponent; }