@@ -317,7 +317,9 @@ public function cloneCellCollection(Worksheet $worksheet)
317
317
318
318
// Store new values
319
319
$ stored = $ newCollection ->cache ->setMultiple ($ newValues );
320
- $ this ->destructIfNeeded ($ stored , $ newCollection , 'Failed to copy cells in cache ' );
320
+ if ($ stored === false ) {
321
+ $ this ->destructIfNeeded ($ newCollection , 'Failed to copy cells in cache ' );
322
+ }
321
323
322
324
return $ newCollection ;
323
325
}
@@ -362,21 +364,21 @@ private function storeCurrentCell(): void
362
364
$ this ->currentCell ->detach ();
363
365
364
366
$ stored = $ this ->cache ->set ($ this ->cachePrefix . $ this ->currentCoordinate , $ this ->currentCell );
365
- $ this ->destructIfNeeded ($ stored , $ this , "Failed to store cell {$ this ->currentCoordinate } in cache " );
367
+ if ($ stored === false ) {
368
+ $ this ->destructIfNeeded ($ this , "Failed to store cell {$ this ->currentCoordinate } in cache " );
369
+ }
366
370
$ this ->currentCellIsDirty = false ;
367
371
}
368
372
369
373
$ this ->currentCoordinate = null ;
370
374
$ this ->currentCell = null ;
371
375
}
372
376
373
- private function destructIfNeeded (bool $ stored , self $ cells , string $ message ): void
377
+ private function destructIfNeeded (self $ cells , string $ message ): void
374
378
{
375
- if (!$ stored ) {
376
- $ cells ->__destruct ();
379
+ $ cells ->__destruct ();
377
380
378
- throw new PhpSpreadsheetException ($ message );
379
- }
381
+ throw new PhpSpreadsheetException ($ message );
380
382
}
381
383
382
384
/**
@@ -416,7 +418,7 @@ public function get($cellCoordinate)
416
418
$ this ->storeCurrentCell ();
417
419
418
420
// Return null if requested entry doesn't exist in collection
419
- if (! $ this ->has ($ cellCoordinate )) {
421
+ if ($ this ->has ($ cellCoordinate ) === false ) {
420
422
return null ;
421
423
}
422
424
0 commit comments