Add phpstan until level 7
This commit is contained in:
1 parent
ab973cab34
commit
bfb7c2c68f
114 files changed
+527
-319
No files matched your search
@@ -5,7 +5,6 @@ namespace Box\Spout\Writer\Common\Creator;
|
||||
use Box\Spout\Common\Entity\Cell;
|
||||
use Box\Spout\Common\Entity\Row;
|
||||
use Box\Spout\Common\Entity\Style\Style;
|
||||
use Box\Spout\Common\Exception\UnsupportedTypeException;
|
||||
use Box\Spout\Common\Type;
|
||||
use Box\Spout\Writer\WriterInterface;
|
||||
|
||||
@@ -46,11 +45,10 @@ class WriterEntityFactory
|
||||
*/
|
||||
public static function createCSVWriter()
|
||||
{
|
||||
try {
|
||||
return WriterFactory::createFromType(Type::CSV);
|
||||
} catch (UnsupportedTypeException $e) {
|
||||
// should never happen
|
||||
}
|
||||
/** @var \Box\Spout\Writer\CSV\Writer $csvWriter */
|
||||
$csvWriter = WriterFactory::createFromType(Type::CSV);
|
||||
|
||||
return $csvWriter;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -60,11 +58,10 @@ class WriterEntityFactory
|
||||
*/
|
||||
public static function createXLSXWriter()
|
||||
{
|
||||
try {
|
||||
return WriterFactory::createFromType(Type::XLSX);
|
||||
} catch (UnsupportedTypeException $e) {
|
||||
// should never happen
|
||||
}
|
||||
/** @var \Box\Spout\Writer\XLSX\Writer $xlsxWriter */
|
||||
$xlsxWriter = WriterFactory::createFromType(Type::XLSX);
|
||||
|
||||
return $xlsxWriter;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -74,11 +71,10 @@ class WriterEntityFactory
|
||||
*/
|
||||
public static function createODSWriter()
|
||||
{
|
||||
try {
|
||||
return WriterFactory::createFromType(Type::ODS);
|
||||
} catch (UnsupportedTypeException $e) {
|
||||
// should never happen
|
||||
}
|
||||
/** @var \Box\Spout\Writer\ODS\Writer $odsWriter */
|
||||
$odsWriter = WriterFactory::createFromType(Type::ODS);
|
||||
|
||||
return $odsWriter;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -92,7 +88,7 @@ class WriterEntityFactory
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $cellValues
|
||||
* @param array<mixed> $cellValues
|
||||
* @param Style|null $rowStyle
|
||||
* @return Row
|
||||
*/
|
||||
|
||||
@@ -33,7 +33,7 @@ class Workbook
|
||||
/**
|
||||
* @param Worksheet[] $worksheets
|
||||
*/
|
||||
public function setWorksheets($worksheets)
|
||||
public function setWorksheets($worksheets) : void
|
||||
{
|
||||
$this->worksheets = $worksheets;
|
||||
}
|
||||
|
||||
@@ -11,10 +11,10 @@ class Worksheet
|
||||
/** @var string Path to the XML file that will contain the sheet data */
|
||||
private $filePath;
|
||||
|
||||
/** @var resource Pointer to the sheet data file (e.g. xl/worksheets/sheet1.xml) */
|
||||
/** @var resource|null Pointer to the sheet data file (e.g. xl/worksheets/sheet1.xml) */
|
||||
private $filePointer;
|
||||
|
||||
/** @var Sheet The "external" sheet */
|
||||
/** @var Sheet|null The "external" sheet */
|
||||
private $externalSheet;
|
||||
|
||||
/** @var int Maximum number of columns among all the written rows */
|
||||
@@ -57,7 +57,7 @@ class Worksheet
|
||||
/**
|
||||
* @param resource $filePointer
|
||||
*/
|
||||
public function setFilePointer($filePointer)
|
||||
public function setFilePointer($filePointer) : void
|
||||
{
|
||||
$this->filePointer = $filePointer;
|
||||
}
|
||||
@@ -81,7 +81,7 @@ class Worksheet
|
||||
/**
|
||||
* @param int $maxNumColumns
|
||||
*/
|
||||
public function setMaxNumColumns($maxNumColumns)
|
||||
public function setMaxNumColumns($maxNumColumns) : void
|
||||
{
|
||||
$this->maxNumColumns = $maxNumColumns;
|
||||
}
|
||||
@@ -97,7 +97,7 @@ class Worksheet
|
||||
/**
|
||||
* @param int $lastWrittenRowIndex
|
||||
*/
|
||||
public function setLastWrittenRowIndex($lastWrittenRowIndex)
|
||||
public function setLastWrittenRowIndex($lastWrittenRowIndex) : void
|
||||
{
|
||||
$this->lastWrittenRowIndex = $lastWrittenRowIndex;
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace Box\Spout\Writer\Common\Helper;
|
||||
*/
|
||||
class CellHelper
|
||||
{
|
||||
/** @var array Cache containing the mapping column index => column letters */
|
||||
/** @var array<int, string> Cache containing the mapping column index => column letters */
|
||||
private static $columnIndexToColumnLettersCache = [];
|
||||
|
||||
/**
|
||||
|
||||
@@ -181,9 +181,13 @@ class ZipHelper
|
||||
*/
|
||||
protected function getNormalizedRealPath($path)
|
||||
{
|
||||
/** @var string $realPath */
|
||||
$realPath = \realpath($path);
|
||||
|
||||
return \str_replace(DIRECTORY_SEPARATOR, '/', $realPath);
|
||||
/** @var string $normalized */
|
||||
$normalized = \str_replace(DIRECTORY_SEPARATOR, '/', $realPath);
|
||||
|
||||
return $normalized;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -210,6 +214,7 @@ class ZipHelper
|
||||
*/
|
||||
protected function copyZipToStream($zipFilePath, $pointer)
|
||||
{
|
||||
/** @var resource $zipFilePointer */
|
||||
$zipFilePointer = \fopen($zipFilePath, 'r');
|
||||
\stream_copy_to_stream($zipFilePointer, $pointer);
|
||||
\fclose($zipFilePointer);
|
||||
|
||||
@@ -15,10 +15,10 @@ class SheetManager
|
||||
/** Sheet name should not exceed 31 characters */
|
||||
const MAX_LENGTH_SHEET_NAME = 31;
|
||||
|
||||
/** @var array Invalid characters that cannot be contained in the sheet name */
|
||||
/** @var array<string> Invalid characters that cannot be contained in the sheet name */
|
||||
private static $INVALID_CHARACTERS_IN_SHEET_NAME = ['\\', '/', '?', '*', ':', '[', ']'];
|
||||
|
||||
/** @var array Associative array [WORKBOOK_ID] => [[SHEET_INDEX] => [SHEET_NAME]] keeping track of sheets' name to enforce uniqueness per workbook */
|
||||
/** @var array<string, array> Associative array [WORKBOOK_ID] => [[SHEET_INDEX] => [SHEET_NAME]] keeping track of sheets' name to enforce uniqueness per workbook */
|
||||
private static $SHEETS_NAME_USED = [];
|
||||
|
||||
/** @var StringHelper */
|
||||
@@ -126,7 +126,7 @@ class SheetManager
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $workbookId Workbook ID associated to a Sheet
|
||||
* @param string $workbookId Workbook ID associated to a Sheet
|
||||
* @return void
|
||||
*/
|
||||
public function markWorkbookIdAsUsed($workbookId)
|
||||
|
||||
@@ -10,10 +10,10 @@ use Box\Spout\Common\Entity\Style\Style;
|
||||
*/
|
||||
class StyleRegistry
|
||||
{
|
||||
/** @var array [SERIALIZED_STYLE] => [STYLE_ID] mapping table, keeping track of the registered styles */
|
||||
/** @var array<string, int> [SERIALIZED_STYLE] => [STYLE_ID] mapping table, keeping track of the registered styles */
|
||||
protected $serializedStyleToStyleIdMappingTable = [];
|
||||
|
||||
/** @var array [STYLE_ID] => [STYLE] mapping table, keeping track of the registered styles */
|
||||
/** @var array<int, Style> [STYLE_ID] => [STYLE] mapping table, keeping track of the registered styles */
|
||||
protected $styleIdToStyleMappingTable = [];
|
||||
|
||||
/**
|
||||
|
||||
@@ -44,7 +44,7 @@ abstract class WorkbookManagerAbstract implements WorkbookManagerInterface
|
||||
/** @var InternalEntityFactory Factory to create entities */
|
||||
protected $entityFactory;
|
||||
|
||||
/** @var ManagerFactoryInterface $managerFactory Factory to create managers */
|
||||
/** @var ManagerFactoryInterface Factory to create managers */
|
||||
protected $managerFactory;
|
||||
|
||||
/** @var Worksheet The worksheet where data will be written to */
|
||||
@@ -265,6 +265,7 @@ abstract class WorkbookManagerAbstract implements WorkbookManagerInterface
|
||||
|
||||
/**
|
||||
* @param Row $row
|
||||
* @return void
|
||||
*/
|
||||
private function applyDefaultRowStyle(Row $row)
|
||||
{
|
||||
|
||||
@@ -7,6 +7,9 @@ use Box\Spout\Writer\Exception\WriterException;
|
||||
|
||||
class InvalidNameException extends WriterException
|
||||
{
|
||||
/**
|
||||
* @param string $name
|
||||
*/
|
||||
public function __construct($name)
|
||||
{
|
||||
$msg = '%s is not a valid name identifier for a border. Valid identifiers are: %s.';
|
||||
|
||||
@@ -7,6 +7,9 @@ use Box\Spout\Writer\Exception\WriterException;
|
||||
|
||||
class InvalidStyleException extends WriterException
|
||||
{
|
||||
/**
|
||||
* @param string $name
|
||||
*/
|
||||
public function __construct($name)
|
||||
{
|
||||
$msg = '%s is not a valid style identifier for a border. Valid identifiers are: %s.';
|
||||
|
||||
@@ -7,6 +7,9 @@ use Box\Spout\Writer\Exception\WriterException;
|
||||
|
||||
class InvalidWidthException extends WriterException
|
||||
{
|
||||
/**
|
||||
* @param string $name
|
||||
*/
|
||||
public function __construct($name)
|
||||
{
|
||||
$msg = '%s is not a valid width identifier for a border. Valid identifiers are: %s.';
|
||||
|
||||
@@ -30,7 +30,7 @@ class HelperFactory extends \Box\Spout\Common\Creator\HelperFactory
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $entityFactory
|
||||
* @param InternalEntityFactory $entityFactory
|
||||
* @return ZipHelper
|
||||
*/
|
||||
private function createZipHelper($entityFactory)
|
||||
|
||||
@@ -22,7 +22,7 @@ class ManagerFactory implements ManagerFactoryInterface
|
||||
/** @var InternalEntityFactory */
|
||||
protected $entityFactory;
|
||||
|
||||
/** @var HelperFactory $helperFactory */
|
||||
/** @var HelperFactory */
|
||||
protected $helperFactory;
|
||||
|
||||
/**
|
||||
|
||||
@@ -24,7 +24,7 @@ class BorderHelper
|
||||
/**
|
||||
* Width mappings
|
||||
*
|
||||
* @var array
|
||||
* @var array<string, string>
|
||||
*/
|
||||
protected static $widthMap = [
|
||||
Border::WIDTH_THIN => '0.75pt',
|
||||
@@ -35,7 +35,7 @@ class BorderHelper
|
||||
/**
|
||||
* Style mapping
|
||||
*
|
||||
* @var array
|
||||
* @var array<string, string>
|
||||
*/
|
||||
protected static $styleMap = [
|
||||
Border::STYLE_SOLID => 'solid',
|
||||
|
||||
@@ -210,6 +210,7 @@ EOD;
|
||||
|
||||
// Append sheets content to "content.xml"
|
||||
$contentXmlFilePath = $this->rootFolder . '/' . self::CONTENT_XML_FILE_NAME;
|
||||
/** @var resource $contentXmlHandle */
|
||||
$contentXmlHandle = \fopen($contentXmlFilePath, 'a');
|
||||
|
||||
foreach ($worksheets as $worksheet) {
|
||||
@@ -241,6 +242,7 @@ EOD;
|
||||
*/
|
||||
protected function copyFileContentsToTarget($sourceFilePath, $targetResource)
|
||||
{
|
||||
/** @var resource $sourceHandle */
|
||||
$sourceHandle = \fopen($sourceFilePath, 'r');
|
||||
\stream_copy_to_stream($sourceHandle, $targetResource);
|
||||
\fclose($sourceHandle);
|
||||
|
||||
@@ -10,7 +10,7 @@ use Box\Spout\Common\Entity\Style\Style;
|
||||
*/
|
||||
class StyleRegistry extends \Box\Spout\Writer\Common\Manager\Style\StyleRegistry
|
||||
{
|
||||
/** @var array [FONT_NAME] => [] Map whose keys contain all the fonts used */
|
||||
/** @var array<string, bool> [FONT_NAME] => [] Map whose keys contain all the fonts used */
|
||||
protected $usedFontsSet = [];
|
||||
|
||||
/**
|
||||
|
||||
@@ -16,6 +16,7 @@ class WorkbookManager extends WorkbookManagerAbstract
|
||||
/**
|
||||
* Maximum number of rows a ODS sheet can contain
|
||||
* @see https://ask.libreoffice.org/en/question/8631/upper-limit-to-number-of-rows-in-calc/
|
||||
* @var int
|
||||
*/
|
||||
protected static $maxRowsPerWorksheet = 1048576;
|
||||
|
||||
|
||||
@@ -61,6 +61,7 @@ class WorksheetManager implements WorksheetManagerInterface
|
||||
*/
|
||||
public function startSheet(Worksheet $worksheet)
|
||||
{
|
||||
/** @var resource $sheetFilePointer */
|
||||
$sheetFilePointer = \fopen($worksheet->getFilePath(), 'w');
|
||||
$this->throwIfSheetFilePointerIsNotAvailable($sheetFilePointer);
|
||||
|
||||
@@ -85,7 +86,7 @@ class WorksheetManager implements WorksheetManagerInterface
|
||||
* Returns the table XML root node as string.
|
||||
*
|
||||
* @param Worksheet $worksheet
|
||||
* @return string <table> node as string
|
||||
* @return string "<table> node as string"
|
||||
*/
|
||||
public function getTableElementStartAsString(Worksheet $worksheet)
|
||||
{
|
||||
|
||||
@@ -24,7 +24,7 @@ abstract class WriterAbstract implements WriterInterface
|
||||
/** @var string Path to the output file */
|
||||
protected $outputFilePath;
|
||||
|
||||
/** @var resource Pointer to the file/stream we will write to */
|
||||
/** @var resource|null Pointer to the file/stream we will write to */
|
||||
protected $filePointer;
|
||||
|
||||
/** @var bool Indicates whether the writer has been opened or not */
|
||||
@@ -33,7 +33,7 @@ abstract class WriterAbstract implements WriterInterface
|
||||
/** @var GlobalFunctionsHelper Helper to work with global functions */
|
||||
protected $globalFunctionsHelper;
|
||||
|
||||
/** @var HelperFactory $helperFactory */
|
||||
/** @var HelperFactory */
|
||||
protected $helperFactory;
|
||||
|
||||
/** @var OptionsManagerInterface Writer options manager */
|
||||
@@ -99,7 +99,10 @@ abstract class WriterAbstract implements WriterInterface
|
||||
{
|
||||
$this->outputFilePath = $outputFilePath;
|
||||
|
||||
$this->filePointer = $this->globalFunctionsHelper->fopen($this->outputFilePath, 'wb+');
|
||||
/** @var resource $filePointer */
|
||||
$filePointer = $this->globalFunctionsHelper->fopen($this->outputFilePath, 'wb+');
|
||||
|
||||
$this->filePointer = $filePointer;
|
||||
$this->throwIfFilePointerIsNotAvailable();
|
||||
|
||||
$this->openWriter();
|
||||
@@ -115,8 +118,10 @@ abstract class WriterAbstract implements WriterInterface
|
||||
public function openToBrowser($outputFileName)
|
||||
{
|
||||
$this->outputFilePath = $this->globalFunctionsHelper->basename($outputFileName);
|
||||
/** @var resource $filePointer */
|
||||
$filePointer = $this->globalFunctionsHelper->fopen('php://output', 'w');
|
||||
|
||||
$this->filePointer = $this->globalFunctionsHelper->fopen('php://output', 'w');
|
||||
$this->filePointer = $filePointer;
|
||||
$this->throwIfFilePointerIsNotAvailable();
|
||||
|
||||
// Clear any previous output (otherwise the generated file will be corrupted)
|
||||
|
||||
@@ -25,7 +25,7 @@ abstract class WriterMultiSheetsAbstract extends WriterAbstract
|
||||
/** @var ManagerFactoryInterface */
|
||||
private $managerFactory;
|
||||
|
||||
/** @var WorkbookManagerInterface */
|
||||
/** @var WorkbookManagerInterface|null */
|
||||
private $workbookManager;
|
||||
|
||||
/**
|
||||
@@ -143,7 +143,7 @@ abstract class WriterMultiSheetsAbstract extends WriterAbstract
|
||||
*/
|
||||
protected function throwIfWorkbookIsNotAvailable()
|
||||
{
|
||||
if (!$this->workbookManager->getWorkbook()) {
|
||||
if ($this->workbookManager === null) {
|
||||
throw new WriterNotOpenedException('The writer must be opened before performing this action.');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ class ManagerFactory implements ManagerFactoryInterface
|
||||
/** @var InternalEntityFactory */
|
||||
protected $entityFactory;
|
||||
|
||||
/** @var HelperFactory $helperFactory */
|
||||
/** @var HelperFactory */
|
||||
protected $helperFactory;
|
||||
|
||||
/**
|
||||
|
||||
@@ -7,6 +7,9 @@ use Box\Spout\Common\Entity\Style\BorderPart;
|
||||
|
||||
class BorderHelper
|
||||
{
|
||||
/**
|
||||
* @var array<string, array>
|
||||
*/
|
||||
public static $xlsxStyleMap = [
|
||||
Border::STYLE_SOLID => [
|
||||
Border::WIDTH_THIN => 'thin',
|
||||
|
||||
@@ -24,7 +24,7 @@ EOD;
|
||||
*/
|
||||
const DEFAULT_STRINGS_COUNT_PART = 'count="9999999999999" uniqueCount="9999999999999"';
|
||||
|
||||
/** @var resource Pointer to the sharedStrings.xml file */
|
||||
/** @var resource|false Pointer to the sharedStrings.xml file */
|
||||
protected $sharedStringsFilePointer;
|
||||
|
||||
/** @var int Number of shared strings already written */
|
||||
@@ -40,13 +40,17 @@ EOD;
|
||||
public function __construct($xlFolder, $stringsEscaper)
|
||||
{
|
||||
$sharedStringsFilePath = $xlFolder . '/' . self::SHARED_STRINGS_FILE_NAME;
|
||||
$this->sharedStringsFilePointer = \fopen($sharedStringsFilePath, 'w');
|
||||
|
||||
/** @var resource $sharedStringsFilePointer */
|
||||
$sharedStringsFilePointer =\fopen($sharedStringsFilePath, 'w');
|
||||
|
||||
$this->sharedStringsFilePointer = $sharedStringsFilePointer;
|
||||
|
||||
$this->throwIfSharedStringsFilePointerIsNotAvailable();
|
||||
|
||||
// the headers is split into different parts so that we can fseek and put in the correct count and uniqueCount later
|
||||
$header = self::SHARED_STRINGS_XML_FILE_FIRST_PART_HEADER . ' ' . self::DEFAULT_STRINGS_COUNT_PART . '>';
|
||||
\fwrite($this->sharedStringsFilePointer, $header);
|
||||
\fwrite($sharedStringsFilePointer, $header);
|
||||
|
||||
$this->stringsEscaper = $stringsEscaper;
|
||||
}
|
||||
@@ -59,7 +63,7 @@ EOD;
|
||||
*/
|
||||
protected function throwIfSharedStringsFilePointerIsNotAvailable()
|
||||
{
|
||||
if (!$this->sharedStringsFilePointer) {
|
||||
if ($this->sharedStringsFilePointer === false) {
|
||||
throw new IOException('Unable to open shared strings file for writing.');
|
||||
}
|
||||
}
|
||||
@@ -73,7 +77,10 @@ EOD;
|
||||
*/
|
||||
public function writeString($string)
|
||||
{
|
||||
\fwrite($this->sharedStringsFilePointer, '<si><t xml:space="preserve">' . $this->stringsEscaper->escape($string) . '</t></si>');
|
||||
/** @var resource $sharedStringsFilePointer */
|
||||
$sharedStringsFilePointer = $this->sharedStringsFilePointer;
|
||||
|
||||
\fwrite($sharedStringsFilePointer, '<si><t xml:space="preserve">' . $this->stringsEscaper->escape($string) . '</t></si>');
|
||||
$this->numSharedStrings++;
|
||||
|
||||
// Shared string ID is zero-based
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace Box\Spout\Writer\XLSX\Manager\Style;
|
||||
|
||||
use Box\Spout\Common\Entity\Style\BorderPart;
|
||||
use Box\Spout\Common\Entity\Style\Color;
|
||||
use Box\Spout\Common\Entity\Style\Style;
|
||||
use Box\Spout\Writer\XLSX\Helper\BorderHelper;
|
||||
@@ -196,7 +197,7 @@ EOD;
|
||||
|
||||
foreach ($sortOrder as $partName) {
|
||||
if ($border->hasPart($partName)) {
|
||||
/** @var $part \Box\Spout\Common\Entity\Style\BorderPart */
|
||||
/** @var BorderPart $part */
|
||||
$part = $border->getPart($partName);
|
||||
$content .= BorderHelper::serializeBorderPart($part);
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ class StyleRegistry extends \Box\Spout\Writer\Common\Manager\Style\StyleRegistry
|
||||
{
|
||||
/**
|
||||
* @see https://msdn.microsoft.com/en-us/library/ff529597(v=office.12).aspx
|
||||
* @var array Mapping between built-in format and the associated numFmtId
|
||||
* @var array<int|string, int> Mapping between built-in format and the associated numFmtId
|
||||
*/
|
||||
protected static $builtinNumFormatToIdMapping = [
|
||||
'General' => 0,
|
||||
@@ -65,12 +65,12 @@ class StyleRegistry extends \Box\Spout\Writer\Common\Manager\Style\StyleRegistry
|
||||
];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
* @var array<string, int>
|
||||
*/
|
||||
protected $registeredFormats = [];
|
||||
|
||||
/**
|
||||
* @var array [STYLE_ID] => [FORMAT_ID] maps a style to a format declaration
|
||||
* @var array <int, int> [STYLE_ID] => [FORMAT_ID] maps a style to a format declaration
|
||||
*/
|
||||
protected $styleIdToFormatsMappingTable = [];
|
||||
|
||||
@@ -84,12 +84,12 @@ class StyleRegistry extends \Box\Spout\Writer\Common\Manager\Style\StyleRegistry
|
||||
protected $formatIndex = 164;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
* @var array<string, int>
|
||||
*/
|
||||
protected $registeredFills = [];
|
||||
|
||||
/**
|
||||
* @var array [STYLE_ID] => [FILL_ID] maps a style to a fill declaration
|
||||
* @var array<int, int> [STYLE_ID] => [FILL_ID] maps a style to a fill declaration
|
||||
*/
|
||||
protected $styleIdToFillMappingTable = [];
|
||||
|
||||
@@ -102,12 +102,12 @@ class StyleRegistry extends \Box\Spout\Writer\Common\Manager\Style\StyleRegistry
|
||||
protected $fillIndex = 2;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
* @var array<string, int>
|
||||
*/
|
||||
protected $registeredBorders = [];
|
||||
|
||||
/**
|
||||
* @var array [STYLE_ID] => [BORDER_ID] maps a style to a border declaration
|
||||
* @var array<int, int> [STYLE_ID] => [BORDER_ID] maps a style to a border declaration
|
||||
*/
|
||||
protected $styleIdToBorderMappingTable = [];
|
||||
|
||||
@@ -132,8 +132,9 @@ class StyleRegistry extends \Box\Spout\Writer\Common\Manager\Style\StyleRegistry
|
||||
*
|
||||
* @param Style $style
|
||||
*/
|
||||
protected function registerFormat(Style $style)
|
||||
protected function registerFormat(Style $style) : void
|
||||
{
|
||||
/** @var int $styleId */
|
||||
$styleId = $style->getId();
|
||||
|
||||
$format = $style->getFormat();
|
||||
@@ -172,8 +173,9 @@ class StyleRegistry extends \Box\Spout\Writer\Common\Manager\Style\StyleRegistry
|
||||
*
|
||||
* @param Style $style
|
||||
*/
|
||||
private function registerFill(Style $style)
|
||||
private function registerFill(Style $style) : void
|
||||
{
|
||||
/** @var int $styleId */
|
||||
$styleId = $style->getId();
|
||||
|
||||
// Currently - only solid backgrounds are supported
|
||||
@@ -215,8 +217,9 @@ class StyleRegistry extends \Box\Spout\Writer\Common\Manager\Style\StyleRegistry
|
||||
*
|
||||
* @param Style $style
|
||||
*/
|
||||
private function registerBorder(Style $style)
|
||||
private function registerBorder(Style $style) : void
|
||||
{
|
||||
/** @var int $styleId */
|
||||
$styleId = $style->getId();
|
||||
|
||||
if ($style->shouldApplyBorder()) {
|
||||
@@ -251,7 +254,7 @@ class StyleRegistry extends \Box\Spout\Writer\Common\Manager\Style\StyleRegistry
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
* @return array<string, int>
|
||||
*/
|
||||
public function getRegisteredFills()
|
||||
{
|
||||
@@ -259,7 +262,7 @@ class StyleRegistry extends \Box\Spout\Writer\Common\Manager\Style\StyleRegistry
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
* @return array<string, int>
|
||||
*/
|
||||
public function getRegisteredBorders()
|
||||
{
|
||||
@@ -267,7 +270,7 @@ class StyleRegistry extends \Box\Spout\Writer\Common\Manager\Style\StyleRegistry
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
* @return array<string, int>
|
||||
*/
|
||||
public function getRegisteredFormats()
|
||||
{
|
||||
|
||||
@@ -14,6 +14,7 @@ use Box\Spout\Writer\XLSX\Manager\Style\StyleManager;
|
||||
class WorkbookManager extends WorkbookManagerAbstract
|
||||
{
|
||||
/**
|
||||
* @var int
|
||||
* Maximum number of rows a XLSX sheet can contain
|
||||
* @see http://office.microsoft.com/en-us/excel-help/excel-specifications-and-limits-HP010073849.aspx
|
||||
*/
|
||||
|
||||
@@ -107,6 +107,7 @@ EOD;
|
||||
*/
|
||||
public function startSheet(Worksheet $worksheet)
|
||||
{
|
||||
/** @var resource $sheetFilePointer */
|
||||
$sheetFilePointer = \fopen($worksheet->getFilePath(), 'w');
|
||||
$this->throwIfSheetFilePointerIsNotAvailable($sheetFilePointer);
|
||||
|
||||
|
||||
Reference in new issue
Block a user