vimeo / psalm

A static analysis tool for finding errors in PHP applications
https://psalm.dev
MIT License
5.56k stars 661 forks source link

`array_product()` can be documented as variadic `AND` #10495

Open Ocramius opened 10 months ago

Ocramius commented 10 months ago

I just realized that array_product([true, false, true, false]) (called with array<bool>) is amazing to find out whether all values in an array are true :D

Possibly a bit evil, but I wonder if it's something too ugly too expose, or worth documenting here:

https://github.com/vimeo/psalm/blob/64dc2ff74762ace75156b324e73c0e9e1dee7b17/stubs/CoreGenericFunctions.phpstub#L817-L829

psalm-github-bot[bot] commented 10 months ago

Hey @Ocramius, can you reproduce the issue on https://psalm.dev ?

orklah commented 10 months ago

eh, if it works well with stubs, I have no issues with that, it's not like stubs are actually read by users

Ocramius commented 10 months ago

I use them as main docs when touching pho code 😁