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 9c4c0f3

Browse filesBrowse files
feature #23614 [VarDumper] Remove low PHP version and hhvm compat in interval caster (maidmaid)
This PR was merged into the 4.0-dev branch. Discussion ---------- [VarDumper] Remove low PHP version and hhvm compat in interval caster | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | no | BC breaks? | yes | Deprecations? | no | Tests pass? | yes | Fixed tickets | #23357 (comment) | License | MIT | Doc PR | / Commits ------- ccca65b Remove hhvm compat
2 parents d024d79 + ccca65b commit 9c4c0f3
Copy full SHA for 9c4c0f3

File tree

Expand file treeCollapse file tree

2 files changed

+9
-17
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+9
-17
lines changed

‎src/Symfony/Component/VarDumper/Caster/DateCaster.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/VarDumper/Caster/DateCaster.php
+1-6Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,9 @@ private static function formatInterval(\DateInterval $i)
5656
.($i->y ? '%yy ' : '')
5757
.($i->m ? '%mm ' : '')
5858
.($i->d ? '%dd ' : '')
59+
.($i->h || $i->i || $i->s || $i->f ? '%H:%I:%S.%F' : '')
5960
;
6061

61-
if (\PHP_VERSION_ID >= 70100 && isset($i->f)) {
62-
$format .= $i->h || $i->i || $i->s || $i->f ? '%H:%I:%S.%F' : '';
63-
} else {
64-
$format .= $i->h || $i->i || $i->s ? '%H:%I:%S' : '';
65-
}
66-
6762
$format = '%R ' === $format ? '0s' : $format;
6863

6964
return $i->format(rtrim($format));

‎src/Symfony/Component/VarDumper/Tests/Caster/DateCasterTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/VarDumper/Tests/Caster/DateCasterTest.php
+8-11Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -157,27 +157,24 @@ public function testCastInterval($intervalSpec, $invert, $xInterval, $xSeconds)
157157

158158
public function provideIntervals()
159159
{
160-
$i = new \DateInterval('PT0S');
161-
$ms = \PHP_VERSION_ID >= 70100 && isset($i->f) ? '.000000' : '';
162-
163160
return array(
164161
array('PT0S', 0, '0s', '0s'),
165-
array('PT1S', 0, '+ 00:00:01'.$ms, '1s'),
166-
array('PT2M', 0, '+ 00:02:00'.$ms, '120s'),
167-
array('PT3H', 0, '+ 03:00:00'.$ms, '10 800s'),
162+
array('PT1S', 0, '+ 00:00:01.000000', '1s'),
163+
array('PT2M', 0, '+ 00:02:00.000000', '120s'),
164+
array('PT3H', 0, '+ 03:00:00.000000', '10 800s'),
168165
array('P4D', 0, '+ 4d', '345 600s'),
169166
array('P5M', 0, '+ 5m', null),
170167
array('P6Y', 0, '+ 6y', null),
171-
array('P1Y2M3DT4H5M6S', 0, '+ 1y 2m 3d 04:05:06'.$ms, null),
168+
array('P1Y2M3DT4H5M6S', 0, '+ 1y 2m 3d 04:05:06.000000', null),
172169

173170
array('PT0S', 1, '0s', '0s'),
174-
array('PT1S', 1, '- 00:00:01'.$ms, '-1s'),
175-
array('PT2M', 1, '- 00:02:00'.$ms, '-120s'),
176-
array('PT3H', 1, '- 03:00:00'.$ms, '-10 800s'),
171+
array('PT1S', 1, '- 00:00:01.000000', '-1s'),
172+
array('PT2M', 1, '- 00:02:00.000000', '-120s'),
173+
array('PT3H', 1, '- 03:00:00.000000', '-10 800s'),
177174
array('P4D', 1, '- 4d', '-345 600s'),
178175
array('P5M', 1, '- 5m', null),
179176
array('P6Y', 1, '- 6y', null),
180-
array('P1Y2M3DT4H5M6S', 1, '- 1y 2m 3d 04:05:06'.$ms, null),
177+
array('P1Y2M3DT4H5M6S', 1, '- 1y 2m 3d 04:05:06.000000', null),
181178
);
182179
}
183180
}

0 commit comments

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