bug #24431 [FrameworkBundle] Fix bad interface hint in AbstractController (nicolas-grekas)
This PR was merged into the 3.3 branch.
Discussion
----------
[FrameworkBundle] Fix bad interface hint in AbstractController
| Q | A
| ------------- | ---
| Branch? | 3.3
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
As spotted by @stof
Commits
-------
5d29dd0d28
[FrameworkBundle] Fix bad interface hint in AbstractController
This commit is contained in:
commit
7a4fe8c01b
@ -231,10 +231,10 @@ trait ControllerTrait
|
||||
protected function render($view, array $parameters = array(), Response $response = null)
|
||||
{
|
||||
if ($this->container->has('templating')) {
|
||||
return $this->container->get('templating')->renderResponse($view, $parameters, $response);
|
||||
}
|
||||
|
||||
if (!$this->container->has('twig')) {
|
||||
$content = $this->container->get('templating')->render($view, $parameters);
|
||||
} elseif ($this->container->has('twig')) {
|
||||
$content = $this->container->get('twig')->render($view, $parameters);
|
||||
} else {
|
||||
throw new \LogicException('You can not use the "render" method if the Templating Component or the Twig Bundle are not available.');
|
||||
}
|
||||
|
||||
@ -242,7 +242,7 @@ trait ControllerTrait
|
||||
$response = new Response();
|
||||
}
|
||||
|
||||
$response->setContent($this->container->get('twig')->render($view, $parameters));
|
||||
$response->setContent($content);
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
@ -451,7 +451,7 @@ abstract class ControllerTraitTest extends TestCase
|
||||
public function testRenderTemplating()
|
||||
{
|
||||
$templating = $this->getMockBuilder('Symfony\Bundle\FrameworkBundle\Templating\EngineInterface')->getMock();
|
||||
$templating->expects($this->once())->method('renderResponse')->willReturn(new Response('bar'));
|
||||
$templating->expects($this->once())->method('render')->willReturn('bar');
|
||||
|
||||
$container = new Container();
|
||||
$container->set('templating', $templating);
|
||||
|
Reference in New Issue
Block a user