propelorm / Propel2

Propel2 is an open-source high-performance Object-Relational Mapping (ORM) for modern PHP
http://propelorm.org/
MIT License
1.26k stars 399 forks source link

Add annotations that allows array values for filterBy* function #1712

Closed nederdirk closed 3 years ago

nederdirk commented 3 years ago

The generated filterByXXX functions actually allow for arrays to be passed as a first parameter, in the case when the comparison operator is IN or NOT IN. This patch extends the phpdoc annotations to allow type|type[] for these functions, and an even more specific @psalm-param annotation to projects using Psalm will have even better type checking.

nederdirk commented 3 years ago

Hi @dereuromark, thank you for your review. I implemented your suggestion!

nederdirk commented 3 years ago

HI @dereuromark, I think this is done. What's the best procedure to get this reviewed and merged?

mringler commented 3 years ago

HI @dereuromark, I think this is done. What's the best procedure to get this reviewed and merged?

Oh, if it helps, I am happy to approve the changes. Though I think it still does not handle null values correctly. Theses statements would be flagged, though they are perfectly valid:

and also

Am I missing something here?

dereuromark commented 3 years ago

Shall we move forward? How can we resolve the open issues regarding null?

dereuromark commented 3 years ago

@nederdirk Regarding the null value handling, can we check and possibly add those in the annotations as requested?

nederdirk commented 3 years ago

@nederdirk Regarding the null value handling, can we check and possibly add those in the annotations as requested?

I have tried to come up with a solution, but couldn't get anything to work properly. I think this PR can better be closed, and we'll just ignore this class of psalm-warnings in our code-base