Skip to content

PHP 8.1: offset* signature #276

@thekid

Description

@thekid

With recent PHP 8.1 builds, the following notice occurs:

Return type of util\Bytes::offsetUnset($offset) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[ReturnTypeWillChange] attribute should be used to temporarily suppress the notice

This was suggested in https://wiki.php.net/rfc/internal_method_return_types and introduced in php/php-src#7251

  • Adding void as a return type will break backwards compatibility with PHP 7.0
  • Adding mixed as type will break backwards compatibility with all PHP 7 versions

For the moment, adding #[ReturnTypeWillChange] seems like the way to go.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions