8000 Revert callable type of Form::$onSuccess to accept mixed by jiripudil · Pull Request #223 · nette/forms · GitHub
[go: up one dir, main page]

Skip to content

Revert callable type of Form::$onSuccess to accept mixed#223

Merged
dg merged 3 commits intonette:masterfrom
jiripudil:patch-1
Jul 8, 2019
Merged

Revert callable type of Form::$onSuccess to accept mixed#223
dg merged 3 commits intonette:masterfrom
jiripudil:patch-1

Conversation

@jiripudil
Copy link
Contributor
@jiripudil jiripudil commented May 29, 2019

See forum thread. The import was missing, causing static analysis to report false positives.

@mabar
Copy link
Contributor
mabar commented May 29, 2019

https://github.com/nette/forms/blob/d9fc6d6/src/Forms/Form.php#L84

Could you also change (callable(Form, ArrayHash): void) to (callable(Form, mixed): void)? To prevent phpstan warnings for mapped types.

@mabar
Copy link
Contributor
mabar commented May 29, 2019

Currently best workaround is

function(Form $form, $mappedValues): void {
  /** @var MappedValues $values */
  $mappedValues = $mappedValues;
}

@jiripudil
Copy link
Contributor Author

I've opened an issue for that (#224) but yes, mixed seems to be the way to go.

@adaamz
Copy link
Contributor
adaamz commented May 29, 2019

@mabar I'm for ArrayHash => object, mixed is too wide.

@jiripudil jiripudil changed the title Add missing ArrayHash import Use ArrayHash FQN in callable type in Form::$onSuccess May 29, 2019
@jiripudil jiripudil changed the title Use ArrayHash FQN in callable type in Form::$onSuccess Revert callable type of Form::$onSuccess to accept mixed Jul 8, 2019
@jiripudil
Copy link
Contributor Author

Updated the PR to fix #224

@dg
Copy link
Member
dg commented Jul 8, 2019

Thanks

@dg dg merged commit 7b21449 into nette:master Jul 8, 2019
dg pushed a commit that referenced this pull request Jul 8, 2019
dg pushed a commit that referenced this pull request Jul 12, 2019
The second parameter for `onValidate` callback (`$values`) documented as `mixed` to follow the consensus for `onSuccess` (in #223)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

0