Commit 1de8768
committed
bug symfony#53057 [HttpKernel] Move
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@internal from AbstractSessionListener class to its methods and properties (Florian-Merle)File tree
1 file changed
+27
-2
lines changed- src/Symfony/Component/HttpKernel/EventListener
1 file changed
+27
-2
lines changedLines changed: 27 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | | - | |
40 | | - | |
41 | 39 | | |
42 | 40 | | |
43 | 41 | | |
44 | 42 | | |
45 | 43 | | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
46 | 48 | | |
47 | 49 | | |
48 | 50 | | |
| |||
52 | 54 | | |
53 | 55 | | |
54 | 56 | | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
55 | 60 | | |
56 | 61 | | |
57 | 62 | | |
58 | 63 | | |
59 | 64 | | |
60 | 65 | | |
61 | 66 | | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
62 | 70 | | |
63 | 71 | | |
64 | 72 | | |
| |||
94 | 102 | | |
95 | 103 | | |
96 | 104 | | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
97 | 108 | | |
98 | 109 | | |
99 | 110 | | |
| |||
222 | 233 | | |
223 | 234 | | |
224 | 235 | | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
225 | 239 | | |
226 | 240 | | |
227 | 241 | | |
228 | 242 | | |
229 | 243 | | |
230 | 244 | | |
231 | 245 | | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
232 | 249 | | |
233 | 250 | | |
234 | 251 | | |
| |||
264 | 281 | | |
265 | 282 | | |
266 | 283 | | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
267 | 287 | | |
268 | 288 | | |
269 | 289 | | |
| |||
274 | 294 | | |
275 | 295 | | |
276 | 296 | | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
277 | 300 | | |
278 | 301 | | |
279 | 302 | | |
| |||
291 | 314 | | |
292 | 315 | | |
293 | 316 | | |
| 317 | + | |
| 318 | + | |
294 | 319 | | |
295 | 320 | | |
296 | 321 | | |
| |||
0 commit comments