upgraded dependencies
This commit is contained in:
41
vendor/symfony/http-foundation/RequestStack.php
vendored
41
vendor/symfony/http-foundation/RequestStack.php
vendored
@@ -11,6 +11,9 @@
|
||||
|
||||
namespace Symfony\Component\HttpFoundation;
|
||||
|
||||
use Symfony\Component\HttpFoundation\Exception\SessionNotFoundException;
|
||||
use Symfony\Component\HttpFoundation\Session\SessionInterface;
|
||||
|
||||
/**
|
||||
* Request stack that controls the lifecycle of requests.
|
||||
*
|
||||
@@ -62,15 +65,13 @@ class RequestStack
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the master Request.
|
||||
* Gets the main request.
|
||||
*
|
||||
* Be warned that making your code aware of the master request
|
||||
* Be warned that making your code aware of the main request
|
||||
* might make it un-compatible with other features of your framework
|
||||
* like ESI support.
|
||||
*
|
||||
* @return Request|null
|
||||
*/
|
||||
public function getMasterRequest()
|
||||
public function getMainRequest(): ?Request
|
||||
{
|
||||
if (!$this->requests) {
|
||||
return null;
|
||||
@@ -79,6 +80,20 @@ class RequestStack
|
||||
return $this->requests[0];
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the master request.
|
||||
*
|
||||
* @return Request|null
|
||||
*
|
||||
* @deprecated since symfony/http-foundation 5.3, use getMainRequest() instead
|
||||
*/
|
||||
public function getMasterRequest()
|
||||
{
|
||||
trigger_deprecation('symfony/http-foundation', '5.3', '"%s()" is deprecated, use "getMainRequest()" instead.', __METHOD__);
|
||||
|
||||
return $this->getMainRequest();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the parent request of the current.
|
||||
*
|
||||
@@ -86,7 +101,7 @@ class RequestStack
|
||||
* might make it un-compatible with other features of your framework
|
||||
* like ESI support.
|
||||
*
|
||||
* If current Request is the master request, it returns null.
|
||||
* If current Request is the main request, it returns null.
|
||||
*
|
||||
* @return Request|null
|
||||
*/
|
||||
@@ -96,4 +111,18 @@ class RequestStack
|
||||
|
||||
return $this->requests[$pos] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the current session.
|
||||
*
|
||||
* @throws SessionNotFoundException
|
||||
*/
|
||||
public function getSession(): SessionInterface
|
||||
{
|
||||
if ((null !== $request = end($this->requests) ?: null) && $request->hasSession()) {
|
||||
return $request->getSession();
|
||||
}
|
||||
|
||||
throw new SessionNotFoundException();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user