Presenter#sendResponse() is not taken as early terminating method call even it is stated in config file
dakur opened this issue · 5 comments
I have following code placed in action method of a presenter.
try {
$identity = $this->accountFacade->authenticate($params);
} catch (AccountNotFound $e) {
$this->error('', IResponse::S404_NOT_FOUND);
} catch (AccountExpired $e) {
$template->setFile(__DIR__ . '/...');
$this->sendTemplate();
}
$this->getUser()->login($identity);Unfortunately phpstan reports Variable $identity might not be defined. for the AccountExpired catch block. When I added throw new \Nette\Application\AbortException() after $this->sendTemplate(), it stopped reporting the error.
sendTemplate() has @throw Nette\Application\AbortException annotated and sendResponse() is listed in early terminated method calls so I don't know where the problem is.
sendTemplate has to be added to the config file.
@ondrejmirtes Is this a note for yourself to do it in phpstan-nette, or an instruction for me to add it to my local config?
It’s a note for you to send a PR to phpstan-nette 😊
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.