Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix deprecation: Return types in ClientObjectCollection
PHP 8.1 logs deprecation warnings: > Return type of Office365\Runtime\ClientObjectCollection::getIterator() > should either be compatible with IteratorAggregate::getIterator(): Traversable, > or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress > the notice in vendor/vgrem/php-spo/src/Runtime/ClientObjectCollection.php on line 287 and > Return type of Office365\Runtime\ClientObjectCollection::offsetExists($offset) > should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool and > Return type of Office365\Runtime\ClientObjectCollection::offsetGet($offset) > should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, > or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice and > Return type of Office365\Runtime\ClientObjectCollection::offsetSet($offset, $value) > should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void and > Return type of Office365\Runtime\ClientObjectCollection::offsetUnset($offset) > should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void Those can be fixed by adding return types for getIterator(), offsetExists(), offsetSet() and offsetUnset(). For those, the minimum required PHP version needs to be raised to PHP 7.1, since the "void" return type only exists in there. The return type for offsetGet() is "mixed", which cannot be expressed in PHP 7.x, only PHP 8.0 and later. I decided to use the "#[\ReturnTypeWillChange]" annotation so the lib can stay compatible with PHP 7. Related: #293
- Loading branch information