algolia / algoliasearch-client-php

⚡️ A fully-featured and blazing-fast PHP API client to interact with Algolia.
https://www.algolia.com/doc/api-client/php/getting-started/
MIT License
671 stars 116 forks source link

PHP 8.1 AbstractResponse offset methods deprecation #694

Closed sebastiansulinski closed 2 years ago

sebastiansulinski commented 2 years ago

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?

greg0ire commented 2 years ago

or the #[\ReturnTypeWillChange] attribute

sebastiansulinski commented 2 years ago

Yeah - or that - could you add and push?

greg0ire commented 2 years ago

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

sebastiansulinski commented 2 years ago

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.

damcou commented 2 years ago

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.

sebastiansulinski commented 2 years ago

Thanks @damcou appreciate it.