Skip to content

Commit ca03a78

Browse files
GromNaNfabpot
authored andcommitted
[HttpFoundation]  Improve PHPDoc of Cache attribute
1 parent d6c8797 commit ca03a78

File tree

1 file changed

+26
-3
lines changed
  • src/Symfony/Component/HttpKernel/Attribute

1 file changed

+26
-3
lines changed

src/Symfony/Component/HttpKernel/Attribute/Cache.php

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@
1313

1414
/**
1515
* Describes the default HTTP cache headers on controllers.
16+
* Headers defined in the Cache attribute are ignored if they are already set
17+
* by the controller.
18+
*
19+
* @see https://symfony.com/doc/current/http_cache.html#making-your-responses-http-cacheable
1620
*
1721
* @author Fabien Potencier <fabien@symfony.com>
1822
*/
@@ -38,27 +42,46 @@ public function __construct(
3842
public int|string|null $smaxage = null,
3943

4044
/**
41-
* Whether the response is public or not.
45+
* If true, the contents will be stored in a public cache and served to all
46+
* the next requests.
4247
*/
4348
public ?bool $public = null,
4449

4550
/**
46-
* Whether or not the response must be revalidated.
51+
* If true, the response is not served stale by a cache in any circumstance
52+
* without first revalidating with the origin.
4753
*/
4854
public bool $mustRevalidate = false,
4955

5056
/**
51-
* Additional "Vary:"-headers.
57+
* Set "Vary" header.
58+
*
59+
* Example:
60+
* ['Accept-Encoding', 'User-Agent']
61+
*
62+
* @see https://symfony.com/doc/current/http_cache/cache_vary.html
63+
*
64+
* @var string[]
5265
*/
5366
public array $vary = [],
5467

5568
/**
5669
* An expression to compute the Last-Modified HTTP header.
70+
*
71+
* The expression is evaluated by the ExpressionLanguage component, it
72+
* receives all the request attributes and the resolved controller arguments.
73+
*
74+
* The result of the expression must be a DateTimeInterface.
5775
*/
5876
public ?string $lastModified = null,
5977

6078
/**
6179
* An expression to compute the ETag HTTP header.
80+
*
81+
* The expression is evaluated by the ExpressionLanguage component, it
82+
* receives all the request attributes and the resolved controller arguments.
83+
*
84+
* The result must be a string that will be hashed.
6285
*/
6386
public ?string $etag = null,
6487

0 commit comments

Comments
 (0)