[Vortex] Fix phpstan error about possible undefined variable

Review Request #1037 — Created Oct. 18, 2023 and submitted — Latest diff uploaded

pprkut
Lunr.Vortex
d760786...
lunr

Adding @throws did, contrary to expectations, not help here.
phpstan also doesn't detect that RequestsExceptionHTTP is a useless catch when limiting the try-catch block on the post() call (while it does for a randomly picked one to check that), which means it detects that somewhere down the stack of post() a Http exception is thrown.

Therefore, rather than working with the local $response, fetch the Response class the Exception was thrown from (data for a Http exception seems to always be a Response object, though no type-safety for that so far).

GitHub actions run: https://github.com/pprkut/lunr.vortex/actions/runs/6560049049

Loading...