algolia/algoliasearch-client-php

PHP 8.1 AbstractResponse offset methods deprecation

sebastiansulinski opened this issue · 6 comments

Under PHP 8.1 we're getting errors such as:

Deprecated: Return type of Algolia\AlgoliaSearch\Response\AbstractResponse::offsetExists($offset) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in

Fix is simple - just adding return types, but it would break backward compatibility - perhaps a candidate for the next major release?

or the #[\ReturnTypeWillChange] attribute

Yeah - or that - could you add and push?

I'm not a maintainer of this project, how about you open a PR?

Oh sorry - thought you were :)
Let's see if any of the maintainers will pick it up, if not I'll have a look at it later - for now I'm just fetching it via fork to make it work with my project.

Hello @sebastiansulinski , thanks a lot for raising this issue, checking PHP8.1 compatibility is on my todo list. I'll should be on it this next or next week.

In the meantime, feel free to submit a PR with the #[\ReturnTypeWillChange] attribute , I'll have a look at it as well.

Thanks @damcou appreciate it.