Permalink
Browse files

added PHP 7.1 typehints

  • Loading branch information...
dg committed Mar 26, 2018
1 parent d5fffba commit 4c338860125aed39526c794160b4dbb4ae334b7f
@@ -39,7 +39,7 @@ public function create(callable $onSuccess): Form
$form->addSubmit('send', 'Sign in');
$form->onSuccess[] = function (Form $form, $values) use ($onSuccess) {
$form->onSuccess[] = function (Form $form, \stdClass $values) use ($onSuccess): void {
try {
$this->user->setExpiration($values->remember ? '14 days' : '20 minutes');
$this->user->login($values->username, $values->password);
@@ -44,7 +44,7 @@ public function create(callable $onSuccess): Form
$form->addSubmit('send', 'Sign up');
$form->onSuccess[] = function (Form $form, $values) use ($onSuccess) {
$form->onSuccess[] = function (Form $form, \stdClass $values) use ($onSuccess): void {
try {
$this->userManager->add($values->username, $values->email, $values->password);
} catch (Model\DuplicateNameException $e) {
@@ -8,7 +8,7 @@
class Error4xxPresenter extends BasePresenter
{
public function startup()
public function startup(): void
{
parent::startup();
if (!$this->getRequest()->isMethod(Nette\Application\Request::FORWARD)) {
@@ -17,7 +17,7 @@ public function startup()
}
public function renderDefault(Nette\Application\BadRequestException $exception)
public function renderDefault(Nette\Application\BadRequestException $exception): void
{
// load template 403.latte or 404.latte or ... 4xx.latte
$file = __DIR__ . "/templates/Error/{$exception->getCode()}.latte";
@@ -38,7 +38,7 @@ public function run(Nette\Application\Request $request): Nette\Application\IResp
}
$this->logger->log($e, ILogger::EXCEPTION);
return new Responses\CallbackResponse(function (Http\IRequest $httpRequest, Http\IResponse $httpResponse) {
return new Responses\CallbackResponse(function (Http\IRequest $httpRequest, Http\IResponse $httpResponse): void {
if (preg_match('#^text/html(?:;|$)#', $httpResponse->getHeader('Content-Type'))) {
require __DIR__ . '/templates/Error/500.phtml';
}
@@ -6,7 +6,7 @@
class HomepagePresenter extends BasePresenter
{
public function renderDefault()
public function renderDefault(): void
{
$this->template->anyVariable = 'any value';
}
@@ -31,7 +31,7 @@ public function __construct(Forms\SignInFormFactory $signInFactory, Forms\SignUp
*/
protected function createComponentSignInForm(): Form
{
return $this->signInFactory->create(function () {
return $this->signInFactory->create(function (): void {
$this->restoreRequest($this->backlink);
$this->redirect('Homepage:');
});
@@ -43,13 +43,13 @@ protected function createComponentSignInForm(): Form
*/
protected function createComponentSignUpForm(): Form
{
return $this->signUpFactory->create(function () {
return $this->signUpFactory->create(function (): void {
$this->redirect('Homepage:');
});
}
public function actionOut()
public function actionOut(): void
{
$this->getUser()->logout();
}

0 comments on commit 4c33886

Please sign in to comment.