Skip to content

Commit

Permalink
phpDoc: fixed event type hints [Closes #265]
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed Feb 4, 2021
1 parent 9650ade commit 05d14fe
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
5 changes: 4 additions & 1 deletion src/Forms/Container.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ class Container extends Nette\ComponentModel\Container implements \ArrayAccess

private const ARRAY = 'array';

/** @var callable[]&((callable(Container, array|object|null): void)|(callable(array|object|null): void))[]; Occurs when the form was validated */
/**
* Occurs when the form was validated
* @var array<callable(self, array|object): void|callable(array|object): void>
*/
public $onValidate = [];

/** @var ControlGroup|null */
Expand Down
7 changes: 5 additions & 2 deletions src/Forms/Controls/SubmitButton.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,13 @@
*/
class SubmitButton extends Button implements Nette\Forms\SubmitterControl
{
/** @var callable[]&((callable(Nette\Forms\Form|SubmitButton, array|object): void)|(callable(array|object): void))[]; Occurs when the button is clicked and form is successfully validated */
/**
* Occurs when the button is clicked and form is successfully validated
* @var array<callable(self, array|object): void|callable(Nette\Forms\Form, array|object): void|callable(array|object): void>
*/
public $onClick = [];

/** @var callable[]&(callable(SubmitButton): void)[]; Occurs when the button is clicked and form is not validated */
/** @var array<callable(self): void> Occurs when the button is clicked and form is not validated */
public $onInvalidClick = [];

/** @var array|null */
Expand Down
11 changes: 7 additions & 4 deletions src/Forms/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,16 +82,19 @@ class Form extends Container implements Nette\HtmlStringable
/** @internal protection token ID */
public const PROTECTOR_ID = '_token_';

/** @var callable[]&((callable(Form, array|object): void)|(callable(array|object): void))[]; Occurs when the form is submitted and successfully validated */
/**
* Occurs when the form is submitted and successfully validated
* @var array<callable(self, array|object): void|callable(array|object): void>
*/
public $onSuccess = [];

/** @var callable[]&(callable(Form): void)[]; Occurs when the form is submitted and is not valid */
/** @var array<callable(self): void> Occurs when the form is submitted and is not valid */
public $onError = [];

/** @var callable[]&(callable(Form): void)[]; Occurs when the form is submitted */
/** @var array<callable(self): void> Occurs when the form is submitted */
public $onSubmit = [];

/** @var callable[]&(callable(Form): void)[]; Occurs before the form is rendered */
/** @var array<callable(self): void> Occurs before the form is rendered */
public $onRender = [];

/** @internal @var Nette\Http\IRequest used only by standalone form */
Expand Down

0 comments on commit 05d14fe

Please sign in to comment.