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

Conversation

@jiripudil
Copy link
Contributor

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

This comment has been minimized.

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

This comment has been minimized.

Copy link
Contributor

mabar commented May 29, 2019

Currently best workaround is

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

This comment has been minimized.

Copy link
Contributor Author

jiripudil commented May 29, 2019

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

@adaamz

This comment has been minimized.

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

This comment has been minimized.

Copy link
Contributor Author

jiripudil commented Jul 8, 2019

Updated the PR to fix #224

@dg

This comment has been minimized.

Copy link
Member

dg commented Jul 8, 2019

Thanks

@dg dg merged commit 7b21449 into nette:master Jul 8, 2019
2 checks passed
2 checks passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
coverage/coveralls Coverage increased (+0.003%) to 95.071%
Details
dg added a commit that referenced this pull request Jul 8, 2019
dg added 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
Projects
None yet
4 participants
You can’t perform that action at this time.