bug #38894 [HttpKernel] Remove Symfony 3 compatibility code (derrabus)

This PR was merged into the 4.4 branch.

Discussion
----------

[HttpKernel] Remove Symfony 3 compatibility code

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #38892
| License       | MIT
| Doc PR        | N/A

This PR removes dead code that checks for the presence of the `Request::setSessionFactory()` method.

That method was added with #25836 in HttpFoundation 4.1. Since HttpKernel requires at least HttpFoundation 4.4, we can assume that the method is always present and thus simplify some code here.

Additionally, I also fix the doc block as described in #38892. 😉

Commits
-------

b9ca866bdd Remove Symfony 3 compatibility code.
This commit is contained in:
Nyholm 2020-10-30 16:05:23 +01:00
commit 2d511de6b3
No known key found for this signature in database
GPG Key ID: 1187B6F70C4F519E
2 changed files with 2 additions and 6 deletions

View File

@ -179,7 +179,7 @@ class Request
protected $format;
/**
* @var SessionInterface
* @var SessionInterface|callable
*/
protected $session;

View File

@ -55,12 +55,8 @@ abstract class AbstractSessionListener implements EventSubscriberInterface
$session = null;
$request = $event->getRequest();
if ($request->hasSession()) {
// no-op
} elseif (method_exists($request, 'setSessionFactory')) {
if (!$request->hasSession()) {
$request->setSessionFactory(function () { return $this->getSession(); });
} elseif ($session = $this->getSession()) {
$request->setSession($session);
}
$session = $session ?? ($this->container && $this->container->has('initialized_session') ? $this->container->get('initialized_session') : null);