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 03dbcf8

Browse filesBrowse files
committed
[Validator][ConstraintValidator] Stop passing unnecessary timezone argument to \DateTime
1 parent 3b42ca9 commit 03dbcf8
Copy full SHA for 03dbcf8

File tree

Expand file treeCollapse file tree

2 files changed

+2
-8
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+2
-8
lines changed

‎src/Symfony/Component/Validator/ConstraintValidator.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Validator/ConstraintValidator.php
+1-4Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,7 @@ protected function formatValue($value, $format = 0)
9393
// neither the native nor the stub IntlDateFormatter support
9494
// DateTimeImmutable as of yet
9595
if (!$value instanceof \DateTime) {
96-
$value = new \DateTime(
97-
$value->format('Y-m-d H:i:s.u e'),
98-
$value->getTimezone()
99-
);
96+
$value = new \DateTime($value->format('Y-m-d H:i:s.u e'));
10097
}
10198

10299
return $formatter->format($value);

‎src/Symfony/Component/Validator/Tests/Constraints/AbstractComparisonValidatorTestCase.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Validator/Tests/Constraints/AbstractComparisonValidatorTestCase.php
+1-4Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,7 @@ protected static function addPhp5Dot5Comparisons(array $comparisons)
5353

5454
foreach ($comparison as $i => $value) {
5555
if ($value instanceof \DateTime) {
56-
$comparison[$i] = new \DateTimeImmutable(
57-
$value->format('Y-m-d H:i:s.u e'),
58-
$value->getTimezone()
59-
);
56+
$comparison[$i] = new \DateTimeImmutable($value->format('Y-m-d H:i:s.u e'));
6057
$add = true;
6158
} elseif ('DateTime' === $value) {
6259
$comparison[$i] = 'DateTimeImmutable';

0 commit comments

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