Skip to content

[BUGFIX] Fix type errors in PHP strict mode #695

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 1 commit into from
Aug 28, 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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ This project adheres to [Semantic Versioning](https://semver.org/).

### Fixed

- Fix type errors in PHP strict mode (#695)
- Fix comment parsing to support multiple comments (#671)

## 8.6.0
Expand Down
2 changes: 1 addition & 1 deletion src/Value/Size.php
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ public function render(OutputFormat $oOutputFormat)
$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;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I presume this branch doesn't include the coding style change requiring space after cast operator.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, correct.

return preg_replace(["/$sPoint/", "/^(-?)0\./"], ['.', '$1.'], $sSize)
. ($this->sUnit === null ? '' : $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 @@ -279,7 +279,7 @@ public function specificity()
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