Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit ede0a12

Browse filesBrowse files
committed
minor #38072 [Intl] Skip test cases that produce a TypeError on php 8 (derrabus)
This PR was merged into the 3.4 branch. Discussion ---------- [Intl] Skip test cases that produce a TypeError on php 8 | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | #36872 | License | MIT | Doc PR | N/A On php 8, `NumberFormatter::setAttribute()` will throw a type error if the provided value is not of type `int|float`. This is why I'm skipping the corresponding tests for now. Alternatively, we could check for the PHP version in Symfony's implementation of that class and throw the `TypeError` as well, if we're on php 8. But since this is a breaking change, I'm was unsure if I sould go that way. Commits ------- 7f1055b [Intl] Skip test cases that produce a TypeError on php 8.
2 parents 44dc0cd + 7f1055b commit ede0a12
Copy full SHA for ede0a12

File tree

1 file changed

+20
-16
lines changed
Filter options

1 file changed

+20
-16
lines changed

‎src/Symfony/Component/Intl/Tests/NumberFormatter/AbstractNumberFormatterTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Intl/Tests/NumberFormatter/AbstractNumberFormatterTest.php
+20-16Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -377,14 +377,16 @@ public function testFormatFractionDigits($value, $expected, $fractionDigits = nu
377377

378378
public function formatFractionDigitsProvider()
379379
{
380-
return [
381-
[1.123, '1.123', null, 0],
382-
[1.123, '1', 0, 0],
383-
[1.123, '1.1', 1, 1],
384-
[1.123, '1.12', 2, 2],
385-
[1.123, '1.123', -1, 0],
386-
[1.123, '1', 'abc', 0],
387-
];
380+
yield [1.123, '1.123', null, 0];
381+
yield [1.123, '1', 0, 0];
382+
yield [1.123, '1.1', 1, 1];
383+
yield [1.123, '1.12', 2, 2];
384+
yield [1.123, '1.123', -1, 0];
385+
386+
if (\PHP_VERSION_ID < 80000) {
387+
// This dataset will produce a TypeError on php 8.
388+
yield [1.123, '1', 'abc', 0];
389+
}
388390
}
389391

390392
/**
@@ -410,14 +412,16 @@ public function testFormatGroupingUsed($value, $expected, $groupingUsed = null,
410412

411413
public function formatGroupingUsedProvider()
412414
{
413-
return [
414-
[1000, '1,000', null, 1],
415-
[1000, '1000', 0, 0],
416-
[1000, '1,000', 1, 1],
417-
[1000, '1,000', 2, 1],
418-
[1000, '1000', 'abc', 0],
419-
[1000, '1,000', -1, 1],
420-
];
415+
yield [1000, '1,000', null, 1];
416+
yield [1000, '1000', 0, 0];
417+
yield [1000, '1,000', 1, 1];
418+
yield [1000, '1,000', 2, 1];
419+
yield [1000, '1,000', -1, 1];
420+
421+
if (\PHP_VERSION_ID < 80000) {
422+
// This dataset will produce a TypeError on php 8.
423+
yield [1000, '1000', 'abc', 0];
424+
}
421425
}
422426

423427
/**

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.