Added code required to handle Traversable objects #4
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When using apcu-simple-cache with latest version of PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) we're getting this error:
Fatal error: Uncaught TypeError: Argument 1 passed to Paillechat\ApcuSimpleCache\ApcuCache::assertKeyNames() must be of the type array, object given, called in /var/www/orders/vendor/paillechat/apcu-simple-cache/src/ApcuCache.php on line 124 and defined in /var/www/orders/vendor/paillechat/apcu-simple-cache/src/ApcuCache.php:183 Stack trace: #0 /var/www/orders/vendor/paillechat/apcu-simple-cache/src/ApcuCache.php(124): Paillechat\ApcuSimpleCache\ApcuCache->assertKeyNames(Object(Generator)) #1 /var/www/orders/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Collection/Cells.php(492): Paillechat\ApcuSimpleCache\ApcuCache->deleteMultiple(Object(Generator)) #2 /var/www/orders/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Collection/Cells.php(479): PhpOffice\PhpSpreadsheet\Collection\Cells->__destruct() #3 /var/www/orders/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/Worksheet.php(385): PhpOffice\PhpSpreadsheet\Collection\Cells->unsetWorksheetCells() #4 /var/www/orders/vendor/phpoffice/phpspreadsheet/src/ in /var/www/orders/vendor/paillechat/apcu-simple-cache/src/ApcuCache.php on line 183
It seems that apcu-simple-cache does not work with Traversable objects as defined in PSR-16 (https://www.php-fig.org/psr/psr-16/).
To solve this I've added few checks for object and in the end decided to convert Traversable objects to arrays. I've done this so, because Generators can be traversed only once.