diff --git a/src/Spout/Writer/Common/Entity/Cell.php b/src/Spout/Writer/Common/Entity/Cell.php index 587de27..6b881c1 100644 --- a/src/Spout/Writer/Common/Entity/Cell.php +++ b/src/Spout/Writer/Common/Entity/Cell.php @@ -70,15 +70,12 @@ class Cell /** * Cell constructor. * @param $value mixed - * @param $style Style + * @param $style|null Style */ public function __construct($value, Style $style = null) { $this->setValue($value); - if ($style) { - $this->setStyle($style); - } - + $this->setStyle($style); $this->styleMerger = new StyleMerger(); } @@ -108,7 +105,7 @@ class Cell } /** - * @return Style + * @return Style|null */ public function getStyle() { @@ -205,15 +202,15 @@ class Cell /** * @param Style $style|null - * @return $this + * @return Cell */ public function applyStyle(Style $style = null) { if ($style === null) { return $this; } - $merged = $this->styleMerger->merge($this->getStyle(), $style); - $this->setStyle($merged); + $mergedStyle = $this->styleMerger->merge($this->getStyle(), $style); + $this->setStyle($mergedStyle); return $this; } } diff --git a/src/Spout/Writer/ODS/Manager/WorksheetManager.php b/src/Spout/Writer/ODS/Manager/WorksheetManager.php index 7b2a242..642899e 100644 --- a/src/Spout/Writer/ODS/Manager/WorksheetManager.php +++ b/src/Spout/Writer/ODS/Manager/WorksheetManager.php @@ -119,6 +119,7 @@ class WorksheetManager implements WorksheetManagerInterface /** @var Cell|null $nextCell */ $nextCell = isset($cells[$nextCellIndex]) ? $cells[$nextCellIndex] : null; + // @TODO refactoring: move this to its own method if (null === $nextCell || $cell->getValue() !== $nextCell->getValue()) { // Apply styles - the row style is merged at this point diff --git a/src/Spout/Writer/XLSX/Manager/WorksheetManager.php b/src/Spout/Writer/XLSX/Manager/WorksheetManager.php index 73f908f..8eb2f76 100644 --- a/src/Spout/Writer/XLSX/Manager/WorksheetManager.php +++ b/src/Spout/Writer/XLSX/Manager/WorksheetManager.php @@ -149,6 +149,7 @@ EOD; $rowXML = ''; + // @TODO refactoring: move this to its own method /** @var Cell $cell */ foreach($row->getCells() as $cell) { // Apply styles - the row style is merged at this point