8000 [HttpFoundation]  Improve PHPDoc of Cache attribute by GromNaN · Pull Request #51968 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[HttpFoundation]  Improve PHPDoc of Cache attribute #51968

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 11, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 26 additions & 3 deletions src/Symfony/Component/HttpKernel/Attribute/Cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@

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

/**
* Whether the response is public or not.
* If true, the contents will be stored in a public cache and served to all
* the next requests.
*/
public ?bool $public = null,

/**
* Whether or not the response must be revalidated.
* If true, the response is not served stale by a cache in any circumstance
* without first revalidating with the origin.
*/
public bool $mustRevalidate = false,

/**
* Additional "Vary:"-headers.
* Set "Vary" header.
*
* Example:
* ['Accept-Encoding', 'User-Agent']
*
* @see https://symfony.com/doc/current/http_cache/cache_vary.html
*
* @var string[]
*/
public array $vary = [],

/**
* An expression to compute the Last-Modified HTTP header.
*
* The expression is evaluated by the ExpressionLanguage component, it
* receives all the request attributes and the resolved controller arguments.
*
* The result of the expression must be a DateTimeInterface.
*/
public ?string $lastModified = null,

/**
* An expression to compute the ETag HTTP header.
*
* The expression is evaluated by the ExpressionLanguage component, it
* receives all the request attributes and the resolved controller arguments.
*
* The result must be a string that will be hashed.
*/
public ?string $etag = null,

Expand Down
0