Skip to content

Deprecation Notices raised in PHP 8.1 due to ArrayAccess changes #26

Description

@michaelbutler

PHP 8.1 introduced typehints (or maybe PHP 8.0?) on some ArrayAccess interface methods, such as offsetExists. This means that (unfortunately) if your code base implements ArrayAccess, but omits the return typehints, you'll get Deprecation notices such as this:

Deprecated: Return type of ClickSend\Model\Email::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 /app/vendor/clicksend/clicksend-php/lib/Model/Email.php on line 461

See https://github.com/ClickSend/clicksend-php/blob/master/lib/Model/Email.php#L461

Here is an example PHP library which fixed this: patrickschur/language-detection@bca4cf7

As a workaround, I can wrap my calls to this library to squelch these messages.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions