Attempt to satisfy php-cs-fixer

This commit is contained in:
Alexander Hofstede 2019-12-20 23:33:28 +01:00
parent bb83904083
commit ffec80422b
6 changed files with 32 additions and 30 deletions

View File

@ -1,9 +1,7 @@
<?php
namespace Box\Spout\Writer\Common\Manager;
trait ManagesCellSize
{
/** @var float|null The default column width to use */

View File

@ -116,8 +116,8 @@ abstract class WorkbookManagerAbstract implements WorkbookManagerInterface
/**
* Creates a new sheet in the workbook. The current sheet remains unchanged.
*
* @return Worksheet The created sheet
* @throws IOException
* @return Worksheet The created sheet
*/
private function addNewSheet()
{
@ -171,8 +171,8 @@ abstract class WorkbookManagerAbstract implements WorkbookManagerInterface
* The writing will resume where it stopped (i.e. data won't be truncated).
*
* @param Sheet $sheet The "external" sheet to set as current
* @return void
* @throws SheetNotFoundException If the given sheet does not exist in the workbook
* @return void
*/
public function setCurrentSheet(Sheet $sheet)
{
@ -220,9 +220,9 @@ abstract class WorkbookManagerAbstract implements WorkbookManagerInterface
*
* @param Row $row The row to be added
*
* @return void
* @throws IOException If trying to create a new sheet and unable to open the sheet for writing
* @throws \Box\Spout\Common\Exception\InvalidArgumentException
* @return void
*/
public function addRowToCurrentWorksheet(Row $row)
{
@ -260,9 +260,9 @@ abstract class WorkbookManagerAbstract implements WorkbookManagerInterface
* @param Worksheet $worksheet Worksheet to write the row to
* @param Row $row The row to be added
*
* @return void
* @throws IOException
* @throws \Box\Spout\Common\Exception\InvalidArgumentException
* @return void
*/
private function addRowToWorksheet(Worksheet $worksheet, Row $row)
{

View File

@ -329,9 +329,12 @@ EOD;
private function transformCellAlignment($cellAlignment)
{
switch ($cellAlignment) {
case CellAlignment::LEFT: return 'start';
case CellAlignment::RIGHT: return 'end';
default: return $cellAlignment;
case CellAlignment::LEFT:
return 'start';
case CellAlignment::RIGHT:
return 'end';
default:
return $cellAlignment;
}
}

View File

@ -50,14 +50,15 @@ abstract class WriterMultiSheetsAbstract extends WriterAbstract
* This must be set before opening the writer.
*
* @param bool $shouldCreateNewSheetsAutomatically Whether new sheets should be automatically created when the max rows limit per sheet is reached
* @return WriterMultiSheetsAbstract
* @throws WriterAlreadyOpenedException If the writer was already opened
* @return WriterMultiSheetsAbstract
*/
public function setShouldCreateNewSheetsAutomatically($shouldCreateNewSheetsAutomatically)
{
$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;
}
@ -97,9 +98,9 @@ abstract class WriterMultiSheetsAbstract extends WriterAbstract
/**
* Creates a new sheet and make it the current sheet. The data will now be written to this sheet.
*
* @return Sheet The created sheet
* @throws IOException
* @throws WriterNotOpenedException If the writer has not been opened yet
* @return Sheet The created sheet
*/
public function addNewSheetAndMakeItCurrent()
{
@ -112,8 +113,8 @@ abstract class WriterMultiSheetsAbstract extends WriterAbstract
/**
* Returns the current sheet
*
* @return Sheet The current sheet
* @throws WriterNotOpenedException If the writer has not been opened yet
* @return Sheet The current sheet
*/
public function getCurrentSheet()
{
@ -127,9 +128,9 @@ abstract class WriterMultiSheetsAbstract extends WriterAbstract
* The writing will resume where it stopped (i.e. data won't be truncated).
*
* @param Sheet $sheet The sheet to set as current
* @return void
* @throws SheetNotFoundException If the given sheet does not exist in the workbook
* @throws WriterNotOpenedException If the writer has not been opened yet
* @return void
*/
public function setCurrentSheet($sheet)
{
@ -183,8 +184,8 @@ abstract class WriterMultiSheetsAbstract extends WriterAbstract
/**
* Checks if the workbook has been created. Throws an exception if not created yet.
*
* @return void
* @throws WriterNotOpenedException If the workbook is not created yet
* @return void
*/
protected function throwIfWorkbookIsNotAvailable()
{

View File

@ -128,8 +128,8 @@ EOD;
* Checks if the sheet has been sucessfully created. Throws an exception if not.
*
* @param bool|resource $sheetFilePointer Pointer to the sheet data file or FALSE if unable to open the file
* @return void
* @throws IOException If the sheet data file cannot be opened for writing
* @return void
*/
private function throwIfSheetFilePointerIsNotAvailable($sheetFilePointer)
{
@ -155,9 +155,9 @@ EOD;
*
* @param Worksheet $worksheet The worksheet to add the row to
* @param Row $row The row to be written
* @return void
* @throws InvalidArgumentException If a cell value's type is not supported
* @throws IOException If the data cannot be written
* @return void
*/
private function addNonEmptyRow(Worksheet $worksheet, Row $row)
{
@ -197,8 +197,8 @@ EOD;
* @param int $rowIndexOneBased
* @param int $columnIndexZeroBased
*
* @return string
* @throws InvalidArgumentException If the given value cannot be processed
* @return string
*/
private function applyStyleAndGetCellXML(Cell $cell, Style $rowStyle, $rowIndexOneBased, $columnIndexZeroBased)
{
@ -220,8 +220,8 @@ EOD;
* @param Cell $cell
* @param int $styleId
*
* @return string
* @throws InvalidArgumentException If the given value cannot be processed
* @return string
*/
private function getCellXML($rowIndexOneBased, $columnIndexZeroBased, Cell $cell, $styleId)
{
@ -257,8 +257,8 @@ EOD;
* Returns the XML fragment for a cell containing a non empty string
*
* @param string $cellValue The cell value
* @return string The XML fragment representing the cell
* @throws InvalidArgumentException If the string exceeds the maximum number of characters allowed per cell
* @return string The XML fragment representing the cell
*/
private function getCellXMLFragmentForNonEmptyString($cellValue)
{

View File

@ -93,7 +93,7 @@ class SheetTest extends TestCase
$this->assertContains(' table:display="false"', $xmlContents, 'The sheet visibility should have been changed to "hidden"');
}
function testThrowsIfWorkbookIsNotInitialized()
public function testThrowsIfWorkbookIsNotInitialized()
{
$this->expectException(WriterNotOpenedException::class);
$writer = WriterEntityFactory::createODSWriter();