Skip to content

Commit 104b842

Browse files
authored
#2024 - Fixed deprecation warning for DateTimeInterface::RFC7231 (#2025)
* FIxed deprecation warning for DateTimeInterface::RFC7231 * fixed generated code * use string instead of constant * fixed generator * cs fix
1 parent 8efa3d7 commit 104b842

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

src/Generator/InputGenerator.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -595,9 +595,8 @@ private function stringify(string $variable, Member $member, string $part): stri
595595
throw new \InvalidArgumentException('Constant "\DateTimeInterface::' . $format . '" does not exists.');
596596
}
597597

598-
if ('RFC822' === $format) {
599-
$variable .= '->setTimezone(new \\DateTimeZone("GMT"))';
600-
$format = 'RFC7231';
598+
if ('RFC822' === $format || 'RFC7231' === $format) {
599+
return $variable . '->setTimezone(new \\DateTimeZone("GMT"))->format(\'D, d M Y H:i:s \G\M\T\')';
601600
}
602601

603602
return $variable . '->format(\DateTimeInterface::' . $format . ')';

0 commit comments

Comments
 (0)