@@ -71,30 +71,21 @@ if you type-hint an argument with :class:`Symfony\\Component\\HttpFoundation\\Re
71
71
$session = new Session();
72
72
$session->start();
73
73
74
- From a Symfony controller, type-hint an argument with
75
- :class: `Symfony\\ Component\\ HttpFoundation\\ RequestStack ` or
74
+ From a Symfony controller, you can also type-hint an argument with
76
75
:class: `Symfony\\ Component\\ HttpFoundation\\ Request `::
77
76
78
77
use Symfony\Component\HttpFoundation\Request;
79
- use Symfony\Component\HttpFoundation\RequestStack;
80
78
use Symfony\Component\HttpFoundation\Response;
81
79
82
- public function index(RequestStack $requestStack): Response
83
- {
84
- $session = $requestStack->getSession();
85
-
86
- // ...
87
- }
88
-
89
80
public function index(Request $request): Response
90
81
{
91
82
$session = $request->getSession();
92
83
93
84
// ...
94
85
}
95
86
96
- Attributes
97
- ----------
87
+ Session Attributes
88
+ ------------------
98
89
99
90
PHP's session management requires the use of the ``$_SESSION `` super-global.
100
91
However, this interferes with code testability and encapsulation in an OOP
@@ -1363,7 +1354,7 @@ Session Proxies
1363
1354
---------------
1364
1355
1365
1356
The session proxy mechanism has a variety of uses and this article demonstrates
1366
- two common uses . Rather than using the regular session handler, you can create
1357
+ two common ones . Rather than using the regular session handler, you can create
1367
1358
a custom save handler by defining a class that extends the
1368
1359
:class: `Symfony\\ Component\\ HttpFoundation\\ Session\\ Storage\\ Proxy\\ SessionHandlerProxy `
1369
1360
class.
0 commit comments