merged branch Tobion/request-stack-bc (PR #9059)
This PR was merged into the master branch.
Discussion
----------
[HttpKernel] made request stack feature BC
| Q | A
| ------------- | ---
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #8904 see comments
| License | MIT
Commits
-------
08a42e7
[HttpKernel] made request stack feature BC
This commit is contained in:
commit
77d79066d3
@ -42,12 +42,12 @@ class RequestStack
|
|||||||
* This method should generally not be called directly as the stack
|
* This method should generally not be called directly as the stack
|
||||||
* management should be taken care of by the application itself.
|
* management should be taken care of by the application itself.
|
||||||
*
|
*
|
||||||
* @return Request
|
* @return Request|null
|
||||||
*/
|
*/
|
||||||
public function pop()
|
public function pop()
|
||||||
{
|
{
|
||||||
if (!$this->requests) {
|
if (!$this->requests) {
|
||||||
throw new \LogicException('Unable to pop a Request as the stack is already empty.');
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return array_pop($this->requests);
|
return array_pop($this->requests);
|
||||||
|
@ -78,7 +78,7 @@ class LocaleListener implements EventSubscriberInterface
|
|||||||
public function onKernelFinishRequest(FinishRequestEvent $event)
|
public function onKernelFinishRequest(FinishRequestEvent $event)
|
||||||
{
|
{
|
||||||
if (null === $this->requestStack) {
|
if (null === $this->requestStack) {
|
||||||
throw new \LogicException('You must pass a RequestStack.');
|
return; // removed when requestStack is required
|
||||||
}
|
}
|
||||||
|
|
||||||
if (null !== $parentRequest = $this->requestStack->getParentRequest()) {
|
if (null !== $parentRequest = $this->requestStack->getParentRequest()) {
|
||||||
|
@ -94,7 +94,7 @@ class RouterListener implements EventSubscriberInterface
|
|||||||
public function onKernelFinishRequest(FinishRequestEvent $event)
|
public function onKernelFinishRequest(FinishRequestEvent $event)
|
||||||
{
|
{
|
||||||
if (null === $this->requestStack) {
|
if (null === $this->requestStack) {
|
||||||
throw new \LogicException('You must pass a RequestStack.');
|
return; // removed when requestStack is required
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->setRequest($this->requestStack->getParentRequest());
|
$this->setRequest($this->requestStack->getParentRequest());
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
"require": {
|
"require": {
|
||||||
"php": ">=5.3.3",
|
"php": ">=5.3.3",
|
||||||
"symfony/event-dispatcher": "~2.1",
|
"symfony/event-dispatcher": "~2.1",
|
||||||
"symfony/http-foundation": "~2.4",
|
"symfony/http-foundation": "~2.1",
|
||||||
"symfony/http-kernel": "~2.4"
|
"symfony/http-kernel": "~2.4"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
|
Reference in New Issue
Block a user