minor #21461 [HttpFoundation] Mark more methods as @final
(nicolas-grekas)
This PR was merged into the 3.3-dev branch.
Discussion
----------
[HttpFoundation] Mark more methods as `@final`
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | yes
| Tests pass? | no
| Fixed tickets | -
| License | MIT
| Doc PR | -
Follow up of #19734 (ping @GuilhemN)
Commits
-------
84a664f929
[HttpFoundation] Mark more methods as `@final`
This commit is contained in:
commit
b465634a55
@ -201,6 +201,10 @@ class Response
|
||||
'isInvalid', 'isSuccessful', 'isRedirection',
|
||||
'isClientError', 'isOk', 'isForbidden',
|
||||
'isNotFound', 'isRedirect', 'isEmpty',
|
||||
'isCacheable', 'isFresh', 'isValidateable',
|
||||
'mustRevalidate', 'setCache', 'setNotModified',
|
||||
'isNotModified', 'isInformational', 'isServerError',
|
||||
'closeOutputBuffers', 'ensureIEOverSSLCompatibility',
|
||||
);
|
||||
private static $deprecationsTriggered = array(
|
||||
__CLASS__ => true,
|
||||
@ -465,6 +469,8 @@ class Response
|
||||
* @param string $version The HTTP protocol version
|
||||
*
|
||||
* @return $this
|
||||
*
|
||||
* @final since version 3.2
|
||||
*/
|
||||
public function setProtocolVersion($version)
|
||||
{
|
||||
@ -477,6 +483,8 @@ class Response
|
||||
* Gets the HTTP protocol version.
|
||||
*
|
||||
* @return string The HTTP protocol version
|
||||
*
|
||||
* @final since version 3.2
|
||||
*/
|
||||
public function getProtocolVersion()
|
||||
{
|
||||
@ -495,6 +503,8 @@ class Response
|
||||
* @return $this
|
||||
*
|
||||
* @throws \InvalidArgumentException When the HTTP status code is not valid
|
||||
*
|
||||
* @final since version 3.2
|
||||
*/
|
||||
public function setStatusCode($code, $text = null)
|
||||
{
|
||||
@ -524,6 +534,8 @@ class Response
|
||||
* Retrieves the status code for the current web response.
|
||||
*
|
||||
* @return int Status code
|
||||
*
|
||||
* @final since version 3.2
|
||||
*/
|
||||
public function getStatusCode()
|
||||
{
|
||||
@ -536,6 +548,8 @@ class Response
|
||||
* @param string $charset Character set
|
||||
*
|
||||
* @return $this
|
||||
*
|
||||
* @final since version 3.2
|
||||
*/
|
||||
public function setCharset($charset)
|
||||
{
|
||||
@ -548,6 +562,8 @@ class Response
|
||||
* Retrieves the response charset.
|
||||
*
|
||||
* @return string Character set
|
||||
*
|
||||
* @final since version 3.2
|
||||
*/
|
||||
public function getCharset()
|
||||
{
|
||||
@ -564,6 +580,8 @@ class Response
|
||||
* validator (Last-Modified, ETag) are considered uncacheable.
|
||||
*
|
||||
* @return bool true if the response is worth caching, false otherwise
|
||||
*
|
||||
* @final since version 3.3
|
||||
*/
|
||||
public function isCacheable()
|
||||
{
|
||||
@ -586,6 +604,8 @@ class Response
|
||||
* indicator or Expires header and the calculated age is less than the freshness lifetime.
|
||||
*
|
||||
* @return bool true if the response is fresh, false otherwise
|
||||
*
|
||||
* @final since version 3.3
|
||||
*/
|
||||
public function isFresh()
|
||||
{
|
||||
@ -597,6 +617,8 @@ class Response
|
||||
* the response with the origin server using a conditional GET request.
|
||||
*
|
||||
* @return bool true if the response is validateable, false otherwise
|
||||
*
|
||||
* @final since version 3.3
|
||||
*/
|
||||
public function isValidateable()
|
||||
{
|
||||
@ -609,6 +631,8 @@ class Response
|
||||
* It makes the response ineligible for serving other clients.
|
||||
*
|
||||
* @return $this
|
||||
*
|
||||
* @final since version 3.2
|
||||
*/
|
||||
public function setPrivate()
|
||||
{
|
||||
@ -624,6 +648,8 @@ class Response
|
||||
* It makes the response eligible for serving other clients.
|
||||
*
|
||||
* @return $this
|
||||
*
|
||||
* @final since version 3.2
|
||||
*/
|
||||
public function setPublic()
|
||||
{
|
||||
@ -642,6 +668,8 @@ class Response
|
||||
* greater than the value provided by the origin.
|
||||
*
|
||||
* @return bool true if the response must be revalidated by a cache, false otherwise
|
||||
*
|
||||
* @final since version 3.3
|
||||
*/
|
||||
public function mustRevalidate()
|
||||
{
|
||||
@ -654,6 +682,8 @@ class Response
|
||||
* @return \DateTime A \DateTime instance
|
||||
*
|
||||
* @throws \RuntimeException When the header is not parseable
|
||||
*
|
||||
* @final since version 3.2
|
||||
*/
|
||||
public function getDate()
|
||||
{
|
||||
@ -670,6 +700,8 @@ class Response
|
||||
* @param \DateTime $date A \DateTime instance
|
||||
*
|
||||
* @return $this
|
||||
*
|
||||
* @final since version 3.2
|
||||
*/
|
||||
public function setDate(\DateTime $date)
|
||||
{
|
||||
@ -683,6 +715,8 @@ class Response
|
||||
* Returns the age of the response.
|
||||
*
|
||||
* @return int The age of the response in seconds
|
||||
*
|
||||
* @final since version 3.2
|
||||
*/
|
||||
public function getAge()
|
||||
{
|
||||
@ -711,6 +745,8 @@ class Response
|
||||
* Returns the value of the Expires header as a DateTime instance.
|
||||
*
|
||||
* @return \DateTime|null A DateTime instance or null if the header does not exist
|
||||
*
|
||||
* @final since version 3.2
|
||||
*/
|
||||
public function getExpires()
|
||||
{
|
||||
@ -730,6 +766,8 @@ class Response
|
||||
* @param \DateTime|null $date A \DateTime instance or null to remove the header
|
||||
*
|
||||
* @return $this
|
||||
*
|
||||
* @final since version 3.2
|
||||
*/
|
||||
public function setExpires(\DateTime $date = null)
|
||||
{
|
||||
@ -752,6 +790,8 @@ class Response
|
||||
* back on an expires header. It returns null when no maximum age can be established.
|
||||
*
|
||||
* @return int|null Number of seconds
|
||||
*
|
||||
* @final since version 3.2
|
||||
*/
|
||||
public function getMaxAge()
|
||||
{
|
||||
@ -776,6 +816,8 @@ class Response
|
||||
* @param int $value Number of seconds
|
||||
*
|
||||
* @return $this
|
||||
*
|
||||
* @final since version 3.2
|
||||
*/
|
||||
public function setMaxAge($value)
|
||||
{
|
||||
@ -792,6 +834,8 @@ class Response
|
||||
* @param int $value Number of seconds
|
||||
*
|
||||
* @return $this
|
||||
*
|
||||
* @final since version 3.2
|
||||
*/
|
||||
public function setSharedMaxAge($value)
|
||||
{
|
||||
@ -810,6 +854,8 @@ class Response
|
||||
* revalidating with the origin.
|
||||
*
|
||||
* @return int|null The TTL in seconds
|
||||
*
|
||||
* @final since version 3.2
|
||||
*/
|
||||
public function getTtl()
|
||||
{
|
||||
@ -826,6 +872,8 @@ class Response
|
||||
* @param int $seconds Number of seconds
|
||||
*
|
||||
* @return $this
|
||||
*
|
||||
* @final since version 3.2
|
||||
*/
|
||||
public function setTtl($seconds)
|
||||
{
|
||||
@ -842,6 +890,8 @@ class Response
|
||||
* @param int $seconds Number of seconds
|
||||
*
|
||||
* @return $this
|
||||
*
|
||||
* @final since version 3.2
|
||||
*/
|
||||
public function setClientTtl($seconds)
|
||||
{
|
||||
@ -856,6 +906,8 @@ class Response
|
||||
* @return \DateTime|null A DateTime instance or null if the header does not exist
|
||||
*
|
||||
* @throws \RuntimeException When the HTTP header is not parseable
|
||||
*
|
||||
* @final since version 3.2
|
||||
*/
|
||||
public function getLastModified()
|
||||
{
|
||||
@ -870,6 +922,8 @@ class Response
|
||||
* @param \DateTime|null $date A \DateTime instance or null to remove the header
|
||||
*
|
||||
* @return $this
|
||||
*
|
||||
* @final since version 3.2
|
||||
*/
|
||||
public function setLastModified(\DateTime $date = null)
|
||||
{
|
||||
@ -888,6 +942,8 @@ class Response
|
||||
* Returns the literal value of the ETag HTTP header.
|
||||
*
|
||||
* @return string|null The ETag HTTP header or null if it does not exist
|
||||
*
|
||||
* @final since version 3.2
|
||||
*/
|
||||
public function getEtag()
|
||||
{
|
||||
@ -901,6 +957,8 @@ class Response
|
||||
* @param bool $weak Whether you want a weak ETag or not
|
||||
*
|
||||
* @return $this
|
||||
*
|
||||
* @final since version 3.2
|
||||
*/
|
||||
public function setEtag($etag = null, $weak = false)
|
||||
{
|
||||
@ -927,6 +985,8 @@ class Response
|
||||
* @return $this
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*
|
||||
* @final since version 3.3
|
||||
*/
|
||||
public function setCache(array $options)
|
||||
{
|
||||
@ -978,6 +1038,8 @@ class Response
|
||||
* @return $this
|
||||
*
|
||||
* @see http://tools.ietf.org/html/rfc2616#section-10.3.5
|
||||
*
|
||||
* @final since version 3.3
|
||||
*/
|
||||
public function setNotModified()
|
||||
{
|
||||
@ -996,6 +1058,8 @@ class Response
|
||||
* Returns true if the response includes a Vary header.
|
||||
*
|
||||
* @return bool true if the response includes a Vary header, false otherwise
|
||||
*
|
||||
* @final since version 3.2
|
||||
*/
|
||||
public function hasVary()
|
||||
{
|
||||
@ -1006,6 +1070,8 @@ class Response
|
||||
* Returns an array of header names given in the Vary header.
|
||||
*
|
||||
* @return array An array of Vary names
|
||||
*
|
||||
* @final since version 3.2
|
||||
*/
|
||||
public function getVary()
|
||||
{
|
||||
@ -1028,6 +1094,8 @@ class Response
|
||||
* @param bool $replace Whether to replace the actual value or not (true by default)
|
||||
*
|
||||
* @return $this
|
||||
*
|
||||
* @final since version 3.2
|
||||
*/
|
||||
public function setVary($headers, $replace = true)
|
||||
{
|
||||
@ -1046,6 +1114,8 @@ class Response
|
||||
* @param Request $request A Request instance
|
||||
*
|
||||
* @return bool true if the Response validators match the Request, false otherwise
|
||||
*
|
||||
* @final since version 3.3
|
||||
*/
|
||||
public function isNotModified(Request $request)
|
||||
{
|
||||
@ -1078,6 +1148,8 @@ class Response
|
||||
* @return bool
|
||||
*
|
||||
* @see http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
|
||||
*
|
||||
* @final since version 3.2
|
||||
*/
|
||||
public function isInvalid()
|
||||
{
|
||||
@ -1088,6 +1160,8 @@ class Response
|
||||
* Is response informative?
|
||||
*
|
||||
* @return bool
|
||||
*
|
||||
* @final since version 3.3
|
||||
*/
|
||||
public function isInformational()
|
||||
{
|
||||
@ -1098,6 +1172,8 @@ class Response
|
||||
* Is response successful?
|
||||
*
|
||||
* @return bool
|
||||
*
|
||||
* @final since version 3.2
|
||||
*/
|
||||
public function isSuccessful()
|
||||
{
|
||||
@ -1108,6 +1184,8 @@ class Response
|
||||
* Is the response a redirect?
|
||||
*
|
||||
* @return bool
|
||||
*
|
||||
* @final since version 3.2
|
||||
*/
|
||||
public function isRedirection()
|
||||
{
|
||||
@ -1118,6 +1196,8 @@ class Response
|
||||
* Is there a client error?
|
||||
*
|
||||
* @return bool
|
||||
*
|
||||
* @final since version 3.2
|
||||
*/
|
||||
public function isClientError()
|
||||
{
|
||||
@ -1128,6 +1208,8 @@ class Response
|
||||
* Was there a server side error?
|
||||
*
|
||||
* @return bool
|
||||
*
|
||||
* @final since version 3.3
|
||||
*/
|
||||
public function isServerError()
|
||||
{
|
||||
@ -1138,6 +1220,8 @@ class Response
|
||||
* Is the response OK?
|
||||
*
|
||||
* @return bool
|
||||
*
|
||||
* @final since version 3.2
|
||||
*/
|
||||
public function isOk()
|
||||
{
|
||||
@ -1148,6 +1232,8 @@ class Response
|
||||
* Is the response forbidden?
|
||||
*
|
||||
* @return bool
|
||||
*
|
||||
* @final since version 3.2
|
||||
*/
|
||||
public function isForbidden()
|
||||
{
|
||||
@ -1158,6 +1244,8 @@ class Response
|
||||
* Is the response a not found error?
|
||||
*
|
||||
* @return bool
|
||||
*
|
||||
* @final since version 3.2
|
||||
*/
|
||||
public function isNotFound()
|
||||
{
|
||||
@ -1170,6 +1258,8 @@ class Response
|
||||
* @param string $location
|
||||
*
|
||||
* @return bool
|
||||
*
|
||||
* @final since version 3.2
|
||||
*/
|
||||
public function isRedirect($location = null)
|
||||
{
|
||||
@ -1180,6 +1270,8 @@ class Response
|
||||
* Is the response empty?
|
||||
*
|
||||
* @return bool
|
||||
*
|
||||
* @final since version 3.2
|
||||
*/
|
||||
public function isEmpty()
|
||||
{
|
||||
@ -1193,6 +1285,8 @@ class Response
|
||||
*
|
||||
* @param int $targetLevel The target output buffering level
|
||||
* @param bool $flush Whether to flush or clean the buffers
|
||||
*
|
||||
* @final since version 3.3
|
||||
*/
|
||||
public static function closeOutputBuffers($targetLevel, $flush)
|
||||
{
|
||||
@ -1214,6 +1308,8 @@ class Response
|
||||
* Checks if we need to remove Cache-Control for SSL encrypted downloads when using IE < 9.
|
||||
*
|
||||
* @see http://support.microsoft.com/kb/323308
|
||||
*
|
||||
* @final since version 3.3
|
||||
*/
|
||||
protected function ensureIEOverSSLCompatibility(Request $request)
|
||||
{
|
||||
|
Reference in New Issue
Block a user