Skip to content

Commit

Permalink
[BUGFIX] Fix type errors in PHP strict mode (#664)
Browse files Browse the repository at this point in the history
  • Loading branch information
oliverklee authored Aug 27, 2024
1 parent f160607 commit 88ddf94
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/Value/Size.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 ?? '');
}
Expand Down
2 changes: 1 addition & 1 deletion tests/ParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
}

/**
Expand Down

0 comments on commit 88ddf94

Please sign in to comment.