revert(svg): use %s instead of %.3F in transform formatting#218
Open
vlakoff wants to merge 1 commit intoBacon:mainfrom
Open
revert(svg): use %s instead of %.3F in transform formatting#218vlakoff wants to merge 1 commit intoBacon:mainfrom
vlakoff wants to merge 1 commit intoBacon:mainfrom
Conversation
This reverts Bacon#100 which replaced %s with %.3F. PHP ≥ 8.0 formatting is locale-independent, so %.3F is no longer necessary and introduced trailing zeroes in scale/translate attributes.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #218 +/- ##
=========================================
Coverage 70.81% 70.81%
Complexity 994 994
=========================================
Files 49 49
Lines 3169 3169
=========================================
Hits 2244 2244
Misses 925 925 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This was referenced Nov 27, 2025
Member
|
Mind adding a test for e.g. the SVG renderer which does calls |
Contributor
Author
|
Mmm… as always with writing tests, I struggle to find motivation for this one. Code snippets: Method A: public function testSomethingWithLocale()
{
$originalLocale = setlocale(LC_ALL, 0);
try {
$locale = (PHP_OS_FAMILY === 'Windows') ? 'French_France.1252' : 'fr_FR.UTF-8';
$result = setlocale(LC_ALL, $locale);
if ($result === false) {
$this->markTestSkipped("Locale {$locale} is not available on this system.");
}
// ... run your test code here ...
} finally {
// always executed, even if test fails or throws
setlocale(LC_ALL, $originalLocale);
}
}Method B: class LocaleTest extends TestCase
{
private $originalLocale;
#[Before]
public function switchLocale()
{
$this->originalLocale = setlocale(LC_ALL, 0);
$locale = (PHP_OS_FAMILY === 'Windows') ? 'French_France.1252' : 'fr_FR.UTF-8';
$result = setlocale(LC_ALL, $locale);
if ($result === false) {
$this->markTestSkipped("Locale {$locale} is not available on this system.");
}
}
#[After]
public function restoreLocale()
{
setlocale(LC_ALL, $this->originalLocale);
}
public function testLocalizedBehavior()
{
// ... test code that depends on locale ...
}
}edit: I've added a check to ensure that edit 2: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This reverts #100 which replaced
%swith%.3F.As I elaborated in this comment, PHP ≥ 8.0 formatting is locale-independent, so
%.3Fis no longer necessary and introduced trailing zeroes in scale/translate attributes.