Update to laravel 7

This commit is contained in:
KodeStar
2022-03-10 11:54:29 +00:00
parent 61a5a1a8b0
commit f9a19fce91
7170 changed files with 274189 additions and 283773 deletions

View File

@@ -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.
*
@@ -47,7 +50,7 @@ class RequestStack
public function pop()
{
if (!$this->requests) {
return;
return null;
}
return array_pop($this->requests);
@@ -62,23 +65,35 @@ 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;
return null;
}
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
*/
@@ -94,10 +109,20 @@ class RequestStack
{
$pos = \count($this->requests) - 2;
if (!isset($this->requests[$pos])) {
return;
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();
}
return $this->requests[$pos];
throw new SessionNotFoundException();
}
}