Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 3 commits into from Jul 8, 2019
Merged

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

merged 3 commits into from Jul 8, 2019

Conversation

jiripudil
Copy link
Contributor

@jiripudil jiripudil commented May 29, 2019

  • bug fix, related to #216
  • BC break? no
  • doc PR: not needed

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

@mabar
Copy link
Contributor

@mabar 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 mabar commented May 29, 2019

Currently best workaround is

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

@jiripudil
Copy link
Contributor Author

@jiripudil jiripudil commented May 29, 2019

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

@adaamz
Copy link
Contributor

@adaamz 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

@jiripudil jiripudil commented Jul 8, 2019

Updated the PR to fix #224

@dg
Copy link
Member

@dg dg commented Jul 8, 2019

Thanks

@dg dg merged commit 7b21449 into nette:master Jul 8, 2019
2 checks passed
dg pushed a commit that referenced this issue 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
Development

Successfully merging this pull request may close these issues.

None yet

4 participants