ramsey/collection

PHP 8.1 compatibility issue: return type of AbstractArray::offsetGet($offset)

remorhaz opened this issue · 1 comments

Description

Hello! I use ramsey/uuid library in my code, and when I run my test on PHP 8.1 beta1 I'm getting the following error:

PHP Fatal error:  During inheritance of ArrayAccess: Uncaught Return type of Ramsey\Collection\AbstractArray::offsetGet($offset) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[ReturnTypeWillChange] attribute should be used to temporarily suppress the notice
/builds/tsp/quality-assurance/phpunit-allure/vendor/ramsey/collection/src/AbstractArray.php:87
/builds/tsp/quality-assurance/phpunit-allure/vendor/ramsey/collection/src/AbstractArray.php:30
/builds/tsp/quality-assurance/phpunit-allure/vendor/ramsey/collection/src/AbstractCollection.php:48
/builds/tsp/quality-assurance/phpunit-allure/vendor/ramsey/uuid/src/Builder/BuilderCollection.php:31
/builds/tsp/quality-assurance/phpunit-allure/vendor/ramsey/uuid/src/FeatureSet.php:435
/builds/tsp/quality-assurance/phpunit-allure/vendor/ramsey/uuid/src/FeatureSet.php:170
/builds/tsp/quality-assurance/phpunit-allure/vendor/ramsey/uuid/src/UuidFactory.php:108

Steps to reproduce

Just extend \Ramsey\Collection\AbstractArray and try to create instance under PHP 8.1 beta.

Expected behavior

The instance is successfully created.

Environment details

  • version of this package: 1.1.4
  • PHP version: 8.1.0 beta1

Thanks for the report!

This is fixed in version 1.2.0.