Skip to content

Use InvalidScalarArgument only when we can be sure PHP attempts coercion#7188

Merged
weirdan merged 3 commits intomasterfrom
muglug-use-invalidscalarargument-less
Jan 3, 2022
Merged

Use InvalidScalarArgument only when we can be sure PHP attempts coercion#7188
weirdan merged 3 commits intomasterfrom
muglug-use-invalidscalarargument-less

Conversation

@muglug
Copy link
Copy Markdown
Collaborator

@muglug muglug commented Dec 19, 2021

This is an alternative to #7181

It narrows the occasions where InvalidScalarArgument is emitted to only the places where we're sure that PHP will attempt to coerce one scalar type to another. This matches the original intent of InvalidScalarArgument — a lesser issue than InvalidArgument, for when the PHP runtime may not care.

@muglug muglug added the release:fix The PR will be included in 'Fixes' section of the release notes label Dec 19, 2021
@muglug muglug force-pushed the muglug-use-invalidscalarargument-less branch from 78450c2 to 87a7a88 Compare December 19, 2021 11:17
@orklah
Copy link
Copy Markdown
Collaborator

orklah commented Dec 19, 2021

This would make sense. It would be great to document this somewhere. Maybe a comment on the scalar_type_match_found property and an explanation in the Issue page?

@orklah
Copy link
Copy Markdown
Collaborator

orklah commented Dec 23, 2021

@weirdan should we merge this now or is it something we will add to Psalm 5?

@weirdan
Copy link
Copy Markdown
Collaborator

weirdan commented Dec 23, 2021

is it something we will add to Psalm 5?

That would be my preference, yes.

@weirdan weirdan added this to the Psalm 5 milestone Dec 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release:fix The PR will be included in 'Fixes' section of the release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants