lstrojny / functional-php

Primitives for functional programming in PHP
MIT License
1.98k stars 204 forks source link

Add null to docblock of `minimum` and `maximum`. #210

Closed jasonmm closed 3 years ago

jasonmm commented 4 years ago

The minimum and maximum functions can return null if the $collection is empty. This commit adds to their @return annotation that a null return is a possibility.

I'm not sure if this relates to #208, but psalm does report handling the possibility of a null return with DocblockTypeContradiction.

For example, maximum([]) ?? -1 will produce a DocblockTypeContradiction.

lstrojny commented 4 years ago

I am currently adding psalm support (see #208). Since you seem to be using psalm and in case you are interested, feel free to check the psalm branch and report any issue you might encounter. I’ll leave this PR open for the time being to not create conflicts with the psalm work.

jasonmm commented 4 years ago

@lstrojny, would it be helpful if I were to make this pull request against the psalm branch?

lstrojny commented 4 years ago

@jasonmm sure, that would be awesome. In this case though, minimum and maximum are correct in psalm already.

jasonmm commented 3 years ago

This pull request is no longer applicable.