Elastica icon indicating copy to clipboard operation
Elastica copied to clipboard

Bump PHPStan to level 5

Open franmomu opened this issue 3 years ago • 0 comments

Most of the ignored errors are expected because they are testing exceptions using wrong types and PHPStan complains about that. Like:

https://github.com/ruflin/Elastica/blob/8fe61767b604a10e40b0b59c9511c4317cae3cb8/tests/Aggregation/GeohashGridTest.php#L51-L57

 ------ ---------------------------------------------------------------------------------------------------------------------
  Line   tests/Aggregation/GeohashGridTest.php
 ------ ---------------------------------------------------------------------------------------------------------------------
  56     Parameter #1 $precision of method Elastica\Aggregation\GeohashGrid::setPrecision() expects int|string, float given.
 ------ ---------------------------------------------------------------------------------------------------------------------

The different ones are:

  • The ones in tests/Query/FunctionScoreTest.php, which I think it's fine to add TODO just in case someone has overridden FunctionScore::addDecayFunction() method, if this is fine we can close https://github.com/ruflin/Elastica/pull/2089
  • In ClientFunctionTest, there is a call to Document::setIndex() passing null which is not allowed, that is done to make sure that the index is properly set when deleting the documents. Instead of that a new document can be passed as we do lines above to update them: https://github.com/ruflin/Elastica/blob/8fe61767b604a10e40b0b59c9511c4317cae3cb8/tests/ClientFunctionalTest.php#L161-L182

franmomu avatar Aug 04 '22 14:08 franmomu