In the readme, there was a reference to PHP, however, the link was referring the Go language.
(fix): correct parameter and return type
Description of the Change
width have incorrect type hints in the comments:
- Decay should be a float (or double in PHP): https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-function-score-query.html#function-weight
- Width should be a float (or double in PHP): https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-function-score-query.html#function-decay
They are now 'hinted' as strings: https://10up.github.io/ElasticPress/includes_classes_Feature_Search_Search.php.html#line481
This made our application crash (throw an exception), as the return was incorrect.
These properties should be corrected to reflect the correct type. Maybe even forced?
Better understanding what a user should return. Especially with PHP7+/8+ using better type-hinting.
None I can think about.
Only comments are changed with this PR. Maybe, if the returned value would be forced to the correct type, more validation is required.
- I have read the CONTRIBUTING document.
- My code follows the code style of this project.
- My change requires a change to the documentation.
- [-] I have updated the documentation accordingly.
- [-] I have added tests to cover my change.
- All new and existing tests passed.
- Correct type hints for
commit sha： bfec5480475899e03d2ab841560ba637a4077a0bpush time in 4 weeks ago