This repository was archived by the owner on May 26, 2022. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 642
This repository was archived by the owner on May 26, 2022. It is now read-only.
Deprecated warnings for incompatible return types in PHP 8.1 #846
Copy link
Copy link
Closed
Description
Since PHP 8.1 most methods of internal classes require a compatible return type when overriding them (see Return Type Compatibility with Internal Classes).
This results in deprecated warnings for the following classes:
Box\Spout\Reader\CSV\RowIteratorBox\Spout\Reader\CSV\SheetIteratorBox\Spout\Reader\ODS\RowIteratorBox\Spout\Reader\ODS\SheetIteratorBox\Spout\Reader\Wrapper\XMLReaderBox\Spout\Reader\XLSX\RowIteratorBox\Spout\Reader\XLSX\SheetIterator
Sample output for Box\Spout\Reader\CSV\RowIterator:
❯ vendor/bin/phpunit | grep -i "deprecated: return type" | grep -i 'csv\\rowiterator'
Deprecated: Return type of Box\Spout\Reader\CSV\RowIterator::current() should either be compatible with Iterator::current(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in src/Spout/Reader/CSV/RowIterator.php on line 227
Deprecated: Return type of Box\Spout\Reader\CSV\RowIterator::next() should either be compatible with Iterator::next(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in src/Spout/Reader/CSV/RowIterator.php on line 129
Deprecated: Return type of Box\Spout\Reader\CSV\RowIterator::key() should either be compatible with Iterator::key(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in src/Spout/Reader/CSV/RowIterator.php on line 238
Deprecated: Return type of Box\Spout\Reader\CSV\RowIterator::valid() should either be compatible with Iterator::valid(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in src/Spout/Reader/CSV/RowIterator.php on line 117
Deprecated: Return type of Box\Spout\Reader\CSV\RowIterator::rewind() should either be compatible with Iterator::rewind(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in src/Spout/Reader/CSV/RowIterator.php on line 87Adding the #[\ReturnTypeWillChange] attribute to these methods fixes the issue. I can PR if appreciated.
ankurk91, spaceemotion and jonnott
Metadata
Metadata
Assignees
Labels
No labels