Form events errors

Open
#82 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
25/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
php
Domain
tooling

Research direction

Start by reproducing the reported PHPStan diagnostics with the presenter snippet; no repository file or test is named. Inspect how the extension handles Nette form onSuccess callbacks, and consider the issue done when valid callback signatures no longer produce the reported errors.

Written by the indexing model from the issue text.

Description

Hi, i have problems with latest nette/forms and phpstan 1.0.. i will describe it on presenter, but same errors are in control...

<?php declare(strict_types = 1);

namespace App\Presenters;

use Nette\Application\UI\Form;
use Nette\Application\UI\Presenter;
use Nette\Utils\ArrayHash;

final class HomepagePresenter extends Presenter
{

	protected function createCompomentForm(): Form
	{
		$form = new Form();
		$form->onSuccess[] = function (Form $form, ArrayHash $values): void {

		};
		$form->onSuccess[] = [$this, 'formOnSuccess'];

		return $form;
	}

	public function formOnSuccess(Form $form, ArrayHash $values): void
	{

	}

}
 ------ ---------------------------------------------------------------------------------
  Line   Presenters/HomepagePresenter.php
 ------ ---------------------------------------------------------------------------------
  15     Array (array<callable(Nette\Application\UI\Form, mixed): void>) does not accept
         Closure(Nette\Application\UI\Form, Nette\Utils\ArrayHash): void.
  18     Array (array<callable(Nette\Application\UI\Form, mixed): void>) does not accept
         array{$this(App\Presenters\HomepagePresenter), 'formOnSuccess'}.
 ------ ---------------------------------------------------------------------------------
Dominant language
PHP
Stars
118
Forks
44
Avg merge
17d 5h
Merged PRs (30d)
1

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from phpstan/phpstan-nette

All issues in phpstan/phpstan-nette

Similar issues

More PHP issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.