From 36573eaa8a2e01a54e082b287fb1883191c7c8ce Mon Sep 17 00:00:00 2001 From: Alexander Hofstede Date: Fri, 20 Dec 2019 23:59:17 +0100 Subject: [PATCH] Satisfy php-cs-fixer --- src/Spout/Writer/Common/Manager/ManagesCellSize.php | 1 - .../Writer/Common/Manager/WorkbookManagerAbstract.php | 1 - src/Spout/Writer/ODS/Manager/Style/StyleManager.php | 5 ++++- src/Spout/Writer/ODS/Manager/WorksheetManager.php | 2 +- src/Spout/Writer/WriterMultiSheetsAbstract.php | 8 +++++--- src/Spout/Writer/XLSX/Manager/WorksheetManager.php | 4 +++- 6 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/Spout/Writer/Common/Manager/ManagesCellSize.php b/src/Spout/Writer/Common/Manager/ManagesCellSize.php index 00ac8c1..8a517f0 100644 --- a/src/Spout/Writer/Common/Manager/ManagesCellSize.php +++ b/src/Spout/Writer/Common/Manager/ManagesCellSize.php @@ -60,5 +60,4 @@ trait ManagesCellSize { $this->columnWidths[] = [$start, $end, $width]; } - } diff --git a/src/Spout/Writer/Common/Manager/WorkbookManagerAbstract.php b/src/Spout/Writer/Common/Manager/WorkbookManagerAbstract.php index 1f2331f..272484d 100644 --- a/src/Spout/Writer/Common/Manager/WorkbookManagerAbstract.php +++ b/src/Spout/Writer/Common/Manager/WorkbookManagerAbstract.php @@ -15,7 +15,6 @@ use Box\Spout\Writer\Common\Helper\FileSystemWithRootFolderHelperInterface; use Box\Spout\Writer\Common\Manager\Style\StyleManagerInterface; use Box\Spout\Writer\Common\Manager\Style\StyleMerger; use Box\Spout\Writer\Exception\SheetNotFoundException; -use Box\Spout\Writer\Exception\WriterException; /** * Class WorkbookManagerAbstract diff --git a/src/Spout/Writer/ODS/Manager/Style/StyleManager.php b/src/Spout/Writer/ODS/Manager/Style/StyleManager.php index eabff06..32500ab 100644 --- a/src/Spout/Writer/ODS/Manager/Style/StyleManager.php +++ b/src/Spout/Writer/ODS/Manager/Style/StyleManager.php @@ -191,9 +191,10 @@ EOD; // Sort column widths since ODS cares about order usort($this->columnWidths, function ($a, $b) { - if ($a[0] == $b[0]) { + if ($a[0] === $b[0]) { return 0; } + return ($a[0] < $b[0]) ? -1 : 1; }); $content .= $this->getTableColumnStylesXMLContent(); @@ -415,6 +416,7 @@ EOD; EOD; } + return $content; } @@ -434,6 +436,7 @@ EOD; // Note: This assumes the column widths are contiguous and default width is // only applied to columns after the last custom column with a custom width $content .= ''; + return $content; } } diff --git a/src/Spout/Writer/ODS/Manager/WorksheetManager.php b/src/Spout/Writer/ODS/Manager/WorksheetManager.php index a114749..5a3ec50 100644 --- a/src/Spout/Writer/ODS/Manager/WorksheetManager.php +++ b/src/Spout/Writer/ODS/Manager/WorksheetManager.php @@ -102,7 +102,7 @@ class WorksheetManager implements WorksheetManagerInterface $escapedSheetName = $this->stringsEscaper->escape($externalSheet->getName()); $tableStyleName = 'ta' . ($externalSheet->getIndex() + 1); - $tableElement = ''; + $tableElement = ''; $tableElement .= $this->styleManager->getStyledTableColumnXMLContent($worksheet->getMaxNumColumns()); return $tableElement; diff --git a/src/Spout/Writer/WriterMultiSheetsAbstract.php b/src/Spout/Writer/WriterMultiSheetsAbstract.php index 77d58d8..b349b04 100644 --- a/src/Spout/Writer/WriterMultiSheetsAbstract.php +++ b/src/Spout/Writer/WriterMultiSheetsAbstract.php @@ -57,8 +57,10 @@ abstract class WriterMultiSheetsAbstract extends WriterAbstract { $this->throwIfWriterAlreadyOpened('Writer must be configured before opening it.'); - $this->optionsManager->setOption(Options::SHOULD_CREATE_NEW_SHEETS_AUTOMATICALLY, - $shouldCreateNewSheetsAutomatically); + $this->optionsManager->setOption( + Options::SHOULD_CREATE_NEW_SHEETS_AUTOMATICALLY, + $shouldCreateNewSheetsAutomatically + ); return $this; } @@ -77,8 +79,8 @@ abstract class WriterMultiSheetsAbstract extends WriterAbstract /** * Returns all the workbook's sheets * - * @return Sheet[] All the workbook's sheets * @throws WriterNotOpenedException If the writer has not been opened yet + * @return Sheet[] All the workbook's sheets */ public function getSheets() { diff --git a/src/Spout/Writer/XLSX/Manager/WorksheetManager.php b/src/Spout/Writer/XLSX/Manager/WorksheetManager.php index 1d19f47..e430b3c 100644 --- a/src/Spout/Writer/XLSX/Manager/WorksheetManager.php +++ b/src/Spout/Writer/XLSX/Manager/WorksheetManager.php @@ -232,7 +232,7 @@ EOD; if ($cell->isString()) { $cellXML .= $this->getCellXMLFragmentForNonEmptyString($cell->getValue()); } elseif ($cell->isBoolean()) { - $cellXML .= ' t="b">' . (int)($cell->getValue()) . ''; + $cellXML .= ' t="b">' . (int) ($cell->getValue()) . ''; } elseif ($cell->isNumeric()) { $cellXML .= '>' . $cell->getValue() . ''; } elseif ($cell->isError() && is_string($cell->getValueEvenIfError())) { @@ -291,6 +291,7 @@ EOD; $xml .= ''; } $xml .= ''; + return $xml; } @@ -308,6 +309,7 @@ EOD; } // Ensure that the required defaultRowHeight is set $rowHeightXml = empty($rowHeightXml) ? ' defaultRowHeight="0"' : $rowHeightXml; + return ""; }