Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0cd8d72

Browse files
committed
[Form] Remove useless intl_get_error_code() call
Fix #63113 (review)
1 parent 69fb647 commit 0cd8d72

2 files changed

Lines changed: 2 additions & 3 deletions

File tree

src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToLocalizedStringTransformer.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,12 +215,11 @@ private function parse(\IntlDateFormatter $dateFormatter, string $value): int|fl
215215
// If parsing failed and the value contains regular spaces, try with ICU 72+ whitespace
216216
if ((false === $timestamp || 0 !== intl_get_error_code()) && str_contains($value, ' ')) {
217217
$icuValue = str_replace(' ', self::NARROW_NO_BREAK_SPACE, $value);
218-
intl_get_error_code(); // Clear previous error
219218

220219
try {
221220
$timestamp = @$dateFormatter->parse($icuValue);
222221
} catch (\IntlException) {
223-
// Ignore, we'll use the original error below
222+
// Ignore and return the failed timestamp
224223
}
225224
}
226225

src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToLocalizedStringTransformerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ public function testReverseTransformFromDifferentLocale()
238238

239239
$transformer = new DateTimeToLocalizedStringTransformer('UTC', 'UTC');
240240

241-
$this->assertDateTimeEquals($this->dateTimeWithoutSeconds, $transformer->reverseTransform('Feb 3, 2010, 4:05 AM'));
241+
$this->assertDateTimeEquals($this->dateTimeWithoutSeconds, $transformer->reverseTransform('Feb 3, 2010, 04:05 AM'));
242242
}
243243

244244
public function testReverseTransformWithDifferentTimezones()

0 commit comments

Comments
 (0)