With the following configuration:
parameters:
earlyTerminatingMethodCalls:
Nette\Application\UI\Presenter:
- redirect
- redirectUrl
- sendJson
- sendResponse
The following code works inside presenters but not inside controls because getPresenter() may return NULL inside controls and not in presenters.
public function test()
{
if (rand() === 0) {
$foo = 13;
} else {
$this->getPresenter()->redirect('Homepage:default');
}
echo $foo;
}