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

[CLEANUP] Remove an impossible throw #1315

Merged
merged 1 commit into from
Sep 17, 2024

Conversation

JakeQZ
Copy link
Contributor

@JakeQZ JakeQZ commented Sep 16, 2024

PHPStan is able to determine that array_combine when passed the results of array_keys and array_values for the same array can never fail (in the sense of returning false), because the two passed arrays will always be the same length.

Psalm could not, which was why the return value check and throw was originally put in.

@JakeQZ JakeQZ added the cleanup label Sep 16, 2024
@JakeQZ JakeQZ added this to the 8.0.0 milestone Sep 16, 2024
@JakeQZ JakeQZ self-assigned this Sep 16, 2024
@coveralls
Copy link

coveralls commented Sep 16, 2024

Coverage Status

coverage: 97.318%. remained the same
when pulling 5dcdd64 on cleanup/remove-impossible-throw
into 178d3ef on main.

@JakeQZ
Copy link
Contributor Author

JakeQZ commented Sep 16, 2024

On the basis of this, and a few other things, PHPStan impresses me much. It keeps me warm in the middle of the night. I wonder if Shania Twain agrees.

@oliverklee
Copy link
Contributor

@JakeQZ And it warms my heart to see you so motivated by increasing code coverage and killing PHPStan warnings! ❤️

(It's the same for me. I find PHPStan quite addictive.)

PHPStan is able to determine that `array_combine` when passed the results of
`array_keys` and `array_values` for the same array can never fail (in the sense
of returning `false`), because the two passed arrays will always be the same
length.

Psalm could not, which was why the return value check and `throw` was originally
put in.
@oliverklee oliverklee force-pushed the cleanup/remove-impossible-throw branch from 3bc3d6a to 5dcdd64 Compare September 17, 2024 10:48
@oliverklee oliverklee merged commit c05b168 into main Sep 17, 2024
24 checks passed
@oliverklee oliverklee deleted the cleanup/remove-impossible-throw branch September 17, 2024 10:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants