diff --git a/CHANGELOG.md b/CHANGELOG.md index 08e271b2..088c8550 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -47,6 +47,7 @@ This project adheres to [Semantic Versioning](https://semver.org/). ### Fixed +- Fix type errors in PHP strict mode (#664) - Fix comment parsing to support multiple comments (#672) - Fix undefined local variable in `CalcFunction::parse()` (#593) - Fix PHP notice caused by parsing invalid color values having less than 6 characters (#485) diff --git a/src/Value/Size.php b/src/Value/Size.php index bf40f4a0..179e739f 100644 --- a/src/Value/Size.php +++ b/src/Value/Size.php @@ -204,7 +204,7 @@ public function render(OutputFormat $oOutputFormat): string $l = \localeconv(); $sPoint = \preg_quote($l['decimal_point'], '/'); $sSize = \preg_match('/[\\d\\.]+e[+-]?\\d+/i', (string) $this->fSize) - ? \preg_replace("/$sPoint?0+$/", '', \sprintf('%f', $this->fSize)) : $this->fSize; + ? \preg_replace("/$sPoint?0+$/", '', \sprintf('%f', $this->fSize)) : (string) $this->fSize; return \preg_replace(["/$sPoint/", '/^(-?)0\\./'], ['.', '$1.'], $sSize) . ($this->sUnit ?? ''); } diff --git a/tests/ParserTest.php b/tests/ParserTest.php index 2262224f..e25c789d 100644 --- a/tests/ParserTest.php +++ b/tests/ParserTest.php @@ -278,7 +278,7 @@ public function specificity(): void new Selector('ol li::before', true), ], $oDoc->getSelectorsBySpecificity('< 100')); self::assertEquals([new Selector('li.green', true)], $oDoc->getSelectorsBySpecificity('11')); - self::assertEquals([new Selector('ol li::before', true)], $oDoc->getSelectorsBySpecificity(3)); + self::assertEquals([new Selector('ol li::before', true)], $oDoc->getSelectorsBySpecificity('3')); } /**