laminas / laminas-component-installer

Composer plugin for injecting modules and configuration providers into application configuration
https://docs.laminas.dev/laminas-component-installer/
BSD 3-Clause "New" or "Revised" License
27 stars 12 forks source link

PHP 8.1: Incompatibility with `IteratorAggregate::getIterator` #35

Closed boesing closed 2 years ago

boesing commented 3 years ago

Bug Report

Q A
Version(s) latest

Summary

The Collection implements the IteratorAggregate and thus triggers deprecations in PHP 8.1

https://wiki.php.net/rfc/deprecations_php_8_1

Current behavior

Tests are failing.

How to reproduce

Execute tests with PHP 8.1

Expected behavior

Tests are passing.

arueckauer commented 2 years ago

Trying to understand the issue here. Running this on 8.1.0RC3 with upgraded dependencies (composer u --ignore-platform-reqs) I do get the following depcrecation notices. The tests pass however.

Deprecated: Return type of Laminas\ComponentInstaller\Collection::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 [..]\src\Collection.php on line 187
Deprecated: Return type of Laminas\ComponentInstaller\Collection::offsetGet($offset) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in [..]\src\Collection.php on line 199
Deprecated: Return type of Laminas\ComponentInstaller\Collection::offsetSet($offset, $value) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in [..]\src\Collection.php on line 220
Deprecated: Return type of Laminas\ComponentInstaller\Collection::offsetUnset($offset) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in [..]\src\Collection.php on line 236
Deprecated: Return type of Laminas\ComponentInstaller\Collection::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in [..]\src\Collection.php on line 248
Deprecated: Return type of Laminas\ComponentInstaller\Collection::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in [..]\src\Collection.php on line 268

I was not able to reproduce an issue with IteratorAggregate::getIterator. What am I missing?

boesing commented 2 years ago

You are mentioning the getIterator problem, so what exactly are you asking for?

this issue is related to the deprecation you are quoting. I did created plenty of issues via cli in a batch - so actually thats the "incompatibility". Yes, it is deprecation only but laminas aims for resolving deprecations when adding support for new minors.