Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bug symfony#53057 [HttpKernel] Move
@internal
from `AbstractSessi…
…onListener` class to its methods and properties (Florian-Merle) This PR was merged into the 5.4 branch. Discussion ---------- [HttpKernel] Move ``@internal`` from `AbstractSessionListener` class to its methods and properties | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | | License | MIT The `AbstractSessionListener` being marked as internal, its public constant `NO_AUTO_CACHE_CONTROL_HEADER` should not be used while the documentation [states it can](https://symfony.com/doc/current/http_cache.html#http-caching-and-user-sessions). In fact, static analysis tools like psalm says there is an error with code using this constant. ``` ERROR: InternalClass - xxx.php:32:33 - Symfony\Component\HttpKernel\EventListener\AbstractSessionListener is internal to Symfony but called from xxx (see https://psalm.dev/174) $response->headers->set(AbstractSessionListener::NO_AUTO_CACHE_CONTROL_HEADER, 'true'); ``` ~~Another solution is to make every method of the `AbstractSessionListener` internal but this means the class could be extended.~~ ~~Also, maybe the class `AbstractSessionListener` should not be internal, but I don't think so.~~ ~~This is why I introduced a new interface that is not internal and allows to not introduce BC.~~ ~~The documentation will need to be updated if this pull request is merged, I'd be happy to do it later.~~ As discussed, I made public/protected properties and methods internal and removed the original internal mark on the class. This solves the issue and allows us to use the `AbstractSessionListener::NO_AUTO_CACHE_CONTROL_HEADER` const just like the documentation says we can. Commits ------- defe229 [HttpKernel] Move `@internal` from AbstractSessionListener class to its methods and properties
- Loading branch information