Description
Since #38616 there's exception type variance in getSession()
between RequestStack
and Request
, when the session is not found
symfony/src/Symfony/Component/HttpFoundation/RequestStack.php
Lines 110 to 112 in a12db94
vs.
symfony/src/Symfony/Component/HttpFoundation/Request.php
Lines 737 to 738 in a12db94
for simplicity, i think we should throw the same exception type in Request::getSession(), and let RequestStack simply forward the call.
the catch(BadMethodCallException)
as "cheap hasSession" will break, but we explicitly mentioned to use hasSession instead already
symfony/src/Symfony/Component/HttpFoundation/Request.php
Lines 726 to 727 in f1a7dca
ppl doing it as of 5.x rely on implementation details (the @throws BadMethodCallException
isnt documented)
so, given both are LogicException it seems reasonable :)
cc @jderusse