Merge branch 'master' of github.com:box/spout into add-phpstan
Conflicts: .travis.yml CONTRIBUTING.md composer.json src/Spout/Common/Entity/Cell.php tests/Spout/Writer/ODS/WriterTest.php
This commit is contained in:
commit
540667870a
49 files changed
+529
-152
No files matched your search
@@ -56,12 +56,25 @@ class RowManager
|
||||
$rowCells = $row->getCells();
|
||||
$maxCellIndex = $numCells;
|
||||
|
||||
// If the row has empty cells, calling "setCellAtIndex" will add the cell
|
||||
// but in the wrong place (the new cell is added at the end of the array).
|
||||
// Therefore, we need to sort the array using keys to have proper order.
|
||||
// @see https://github.com/box/spout/issues/740
|
||||
$needsSorting = false;
|
||||
|
||||
for ($cellIndex = 0; $cellIndex < $maxCellIndex; $cellIndex++) {
|
||||
if (!isset($rowCells[$cellIndex])) {
|
||||
$row->setCellAtIndex($this->entityFactory->createCell(''), $cellIndex);
|
||||
$needsSorting = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ($needsSorting) {
|
||||
$rowCells = $row->getCells();
|
||||
ksort($rowCells);
|
||||
$row->setCells($rowCells);
|
||||
}
|
||||
|
||||
return $row;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user