Moved ->setDate() before the deprecation handling.

This commit is contained in:
Matthew Donadio 2017-04-05 22:24:43 -04:00 committed by Nicolas Grekas
parent 32f264f3c8
commit b6df4e7834

View File

@ -226,6 +226,11 @@ class Response
$this->setStatusCode($status);
$this->setProtocolVersion('1.0');
/* RFC2616 - 14.18 says all Responses need to have a Date */
if (!$this->headers->has('Date')) {
$this->setDate(new \DateTime(null, new \DateTimeZone('UTC')));
}
// Deprecations
$class = get_class($this);
if ($this instanceof \PHPUnit_Framework_MockObject_MockObject || $this instanceof \Prophecy\Doubler\DoubleInterface) {
@ -242,11 +247,6 @@ class Response
@trigger_error(sprintf('Extending %s::%s() in %s is deprecated since version 3.2 and won\'t be supported anymore in 4.0 as it will be final.', __CLASS__, $method, $class), E_USER_DEPRECATED);
}
}
/* RFC2616 - 14.18 says all Responses need to have a Date */
if (!$this->headers->has('Date')) {
$this->setDate(new \DateTime(null, new \DateTimeZone('UTC')));
}
}
/**