10000 early return includes null condition. added phpdoc · symfony/symfony@b3a292e · GitHub
[go: up one dir, main page]

Skip to content

Commit b3a292e

Browse files
committed
early return includes null condition. added phpdoc
1 parent 969b4ba commit b3a292e

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/Symfony/Component/HttpFoundation/ParameterBag.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -190,19 +190,19 @@ public function getBoolean($key, $default = false)
190190
/**
191191
* Returns the parameter value converted to a DateTime object.
192192
*
193-
* @param string $key The parameter key
194-
* @param string $format The expected date format
195-
* @param \DateTimeInterface|string $default The default value to be converted to a DateTime object if the parameter key does not exist
196-
* @param \DateTimeZone|null $timeZone A DateTimeZone object representing the desired time zone
193+
* @param string $key The parameter key
194+
* @param string $format The expected date format
195+
* @param \DateTimeInterface|string|null $default The default value to be converted to a DateTime object if the parameter key does not exist
196+
* @param \DateTimeZone|null $timeZone A DateTimeZone object representing the desired time zone
197197
*
198198
* @return \DateTimeInterface|null
199199
*/
200200
public function getDate($key, $format, $default = null, \DateTimeZone $timeZone = null)
201201
{
202202
$time = $this->get($key, $default);
203203

204-
if ($time instanceof \DateTimeInterface) {
205-
return $default;
204+
if ((null === $time) || $time instanceof \DateTimeInterface) {
205+
return $time;
206206
}
207207

208208
// if the user has specified a timezone then pass that

0 commit comments

Comments
 (0)
0