Elastica icon indicating copy to clipboard operation
Elastica copied to clipboard

Allow `int` and `float` for `FunctionScore::addDecayFunction()` origin and scale

Open franmomu opened this issue 3 years ago • 0 comments

Here we have the same situation as before about types, in this case origin and scale are required as string, but in tests there are some calls with int and float

https://github.com/ruflin/Elastica/blob/a0a2dc27f4d8ef633893de6edf088b3c922f3767/tests/Query/FunctionScoreTest.php#L26-L33

https://github.com/ruflin/Elastica/blob/a0a2dc27f4d8ef633893de6edf088b3c922f3767/tests/Query/FunctionScoreTest.php#L130

Apparently in the documentation those values are allowed: https://www.elastic.co/guide/en/elasticsearch/reference/7.17/query-dsl-function-score-query.html#function-decay

My concern here is if this class is more likely to be inherited than the previous ones (Settings and SetProcessor), so maybe we could update the PHPDoc (and add a reminder) and ignore the PHPStan issue and in next major version allow those types apart from string.

~We could do the same thing for AbstractUpdateAction::setId() which expects a string, but int also is allowed.~

franmomu avatar Jun 24 '22 10:06 franmomu