From f9532231d2ba124713620a28ac39bd512d75c99e Mon Sep 17 00:00:00 2001 From: Adrien Crivelli Date: Sun, 4 Apr 2021 22:20:00 +0900 Subject: [PATCH] PHPStan Level 3 --- phpstan.neon.dist | 4 +- .../Calculation/Calculation.php | 4 +- .../Calculation/Database/DatabaseAbstract.php | 2 +- .../Calculation/Engineering.php | 4 +- .../Calculation/Engineering/ConvertBinary.php | 2 +- .../Calculation/Engineering/ConvertHex.php | 4 +- .../Calculation/Engineering/ConvertOctal.php | 4 +- .../Calculation/Engineering/ConvertUOM.php | 4 +- .../Calculation/FormulaParser.php | 4 +- src/PhpSpreadsheet/Calculation/Functions.php | 2 +- .../Calculation/LookupRef/Offset.php | 2 +- .../Calculation/MathTrig/Fact.php | 2 +- .../Calculation/Statistical.php | 4 +- .../Calculation/Statistical/Trends.php | 4 +- src/PhpSpreadsheet/Cell/Cell.php | 5 +- src/PhpSpreadsheet/Chart/Axis.php | 16 ++--- src/PhpSpreadsheet/Chart/DataSeries.php | 20 +++--- src/PhpSpreadsheet/Chart/DataSeriesValues.php | 4 +- src/PhpSpreadsheet/Chart/PlotArea.php | 2 +- src/PhpSpreadsheet/Collection/Cells.php | 6 +- src/PhpSpreadsheet/Document/Properties.php | 2 +- src/PhpSpreadsheet/HashTable.php | 4 +- src/PhpSpreadsheet/Reader/BaseReader.php | 2 +- src/PhpSpreadsheet/Reader/Xls.php | 6 +- src/PhpSpreadsheet/Reader/Xlsx.php | 5 +- src/PhpSpreadsheet/Reader/Xlsx/Theme.php | 12 ++-- src/PhpSpreadsheet/Settings.php | 2 +- src/PhpSpreadsheet/Shared/Date.php | 2 +- src/PhpSpreadsheet/Shared/Drawing.php | 6 +- src/PhpSpreadsheet/Shared/Font.php | 2 +- .../Shared/JAMA/LUDecomposition.php | 2 +- src/PhpSpreadsheet/Shared/JAMA/Matrix.php | 8 +-- .../Shared/OLE/ChainedBlockStream.php | 4 +- src/PhpSpreadsheet/Shared/OLERead.php | 2 +- src/PhpSpreadsheet/Shared/Trend/BestFit.php | 23 +++---- .../Shared/Trend/PolynomialBestFit.php | 5 +- src/PhpSpreadsheet/Shared/Xls.php | 10 +-- src/PhpSpreadsheet/Spreadsheet.php | 25 ++++---- src/PhpSpreadsheet/Style/Alignment.php | 12 ++-- src/PhpSpreadsheet/Style/Border.php | 2 +- src/PhpSpreadsheet/Style/Fill.php | 8 +-- src/PhpSpreadsheet/Style/Font.php | 34 +++++----- src/PhpSpreadsheet/Style/NumberFormat.php | 8 +-- src/PhpSpreadsheet/Worksheet/AutoFilter.php | 8 +-- .../Worksheet/AutoFilter/Column.php | 10 +-- .../Worksheet/AutoFilter/Column/Rule.php | 4 +- src/PhpSpreadsheet/Worksheet/BaseDrawing.php | 12 ++-- src/PhpSpreadsheet/Worksheet/CellIterator.php | 1 + src/PhpSpreadsheet/Worksheet/Column.php | 1 + .../Worksheet/ColumnCellIterator.php | 2 +- .../Worksheet/ColumnIterator.php | 1 + .../Worksheet/Drawing/Shadow.php | 6 +- src/PhpSpreadsheet/Worksheet/Iterator.php | 8 --- .../Worksheet/MemoryDrawing.php | 1 - src/PhpSpreadsheet/Worksheet/PageSetup.php | 2 +- src/PhpSpreadsheet/Worksheet/Row.php | 1 + src/PhpSpreadsheet/Worksheet/RowIterator.php | 8 --- src/PhpSpreadsheet/Worksheet/Worksheet.php | 34 +++++----- src/PhpSpreadsheet/Writer/Html.php | 4 +- src/PhpSpreadsheet/Writer/Pdf.php | 2 +- src/PhpSpreadsheet/Writer/Xls.php | 6 +- src/PhpSpreadsheet/Writer/Xls/BIFFwriter.php | 2 +- src/PhpSpreadsheet/Writer/Xls/Font.php | 2 +- src/PhpSpreadsheet/Writer/Xls/Worksheet.php | 63 +++++-------------- src/PhpSpreadsheet/Writer/Xls/Xf.php | 8 +-- src/PhpSpreadsheet/Writer/Xlsx.php | 7 +++ src/PhpSpreadsheet/Writer/Xlsx/DocProps.php | 4 +- src/PhpSpreadsheet/Writer/Xlsx/Theme.php | 6 +- .../Functions/Engineering/ImConjugateTest.php | 5 -- .../Functions/Engineering/ImCosTest.php | 5 -- .../Functions/Engineering/ImCoshTest.php | 5 -- .../Functions/Engineering/ImCotTest.php | 5 -- .../Functions/Engineering/ImCscTest.php | 5 -- .../Functions/Engineering/ImCschTest.php | 5 -- .../Functions/Engineering/ImDivTest.php | 5 -- .../Functions/Engineering/ImExpTest.php | 5 -- .../Functions/Engineering/ImLnTest.php | 5 -- .../Functions/Engineering/ImLog10Test.php | 5 -- .../Functions/Engineering/ImLog2Test.php | 5 -- .../Functions/Engineering/ImPowerTest.php | 5 -- .../Functions/Engineering/ImProductTest.php | 5 -- .../Functions/Engineering/ImSecTest.php | 5 -- .../Functions/Engineering/ImSechTest.php | 5 -- .../Functions/Engineering/ImSinTest.php | 5 -- .../Functions/Engineering/ImSinhTest.php | 5 -- .../Functions/Engineering/ImSqrtTest.php | 5 -- .../Functions/Engineering/ImSubTest.php | 5 -- .../Functions/Engineering/ImSumTest.php | 5 -- .../Functions/Engineering/ImTanTest.php | 5 -- tests/PhpSpreadsheetTests/SettingsTest.php | 2 +- 90 files changed, 225 insertions(+), 370 deletions(-) diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 53bbb0e6..6917c78c 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -1,8 +1,10 @@ parameters: - level: 2 + level: 3 paths: - src/ - tests/ + parallel: + processTimeout: 300.0 ignoreErrors: - '~^Class GdImage not found\.$~' - '~^Return typehint of method .* has invalid type GdImage\.$~' diff --git a/src/PhpSpreadsheet/Calculation/Calculation.php b/src/PhpSpreadsheet/Calculation/Calculation.php index 9477131f..a11b8a12 100644 --- a/src/PhpSpreadsheet/Calculation/Calculation.php +++ b/src/PhpSpreadsheet/Calculation/Calculation.php @@ -5234,10 +5234,8 @@ class Calculation /** * Get a list of all implemented functions as an array of function objects. - * - * @return array of Category */ - public function getFunctions() + public function getFunctions(): array { return self::$phpSpreadsheetFunctions; } diff --git a/src/PhpSpreadsheet/Calculation/Database/DatabaseAbstract.php b/src/PhpSpreadsheet/Calculation/Database/DatabaseAbstract.php index cf48bd88..2c9bb2de 100644 --- a/src/PhpSpreadsheet/Calculation/Database/DatabaseAbstract.php +++ b/src/PhpSpreadsheet/Calculation/Database/DatabaseAbstract.php @@ -57,7 +57,7 @@ abstract class DatabaseAbstract * the column label in which you specify a condition for the * column. * - * @return array of mixed + * @return mixed[] */ protected static function filter(array $database, array $criteria): array { diff --git a/src/PhpSpreadsheet/Calculation/Engineering.php b/src/PhpSpreadsheet/Calculation/Engineering.php index 7584556a..a70ddac5 100644 --- a/src/PhpSpreadsheet/Calculation/Engineering.php +++ b/src/PhpSpreadsheet/Calculation/Engineering.php @@ -1395,7 +1395,7 @@ class Engineering * * @see Use the getConversionMultipliers() method in the ConvertUOM class instead * - * @return array of mixed + * @return mixed[] */ public static function getConversionMultipliers() { @@ -1412,7 +1412,7 @@ class Engineering * * @see Use the getBinaryConversionMultipliers() method in the ConvertUOM class instead * - * @return array of mixed + * @return mixed[] */ public static function getBinaryConversionMultipliers() { diff --git a/src/PhpSpreadsheet/Calculation/Engineering/ConvertBinary.php b/src/PhpSpreadsheet/Calculation/Engineering/ConvertBinary.php index ff4873ac..a662b78d 100644 --- a/src/PhpSpreadsheet/Calculation/Engineering/ConvertBinary.php +++ b/src/PhpSpreadsheet/Calculation/Engineering/ConvertBinary.php @@ -38,7 +38,7 @@ class ConvertBinary extends ConvertBase return '-' . (512 - bindec($value)); } - return bindec($value); + return (string) bindec($value); } /** diff --git a/src/PhpSpreadsheet/Calculation/Engineering/ConvertHex.php b/src/PhpSpreadsheet/Calculation/Engineering/ConvertHex.php index cbf155ed..de1b0704 100644 --- a/src/PhpSpreadsheet/Calculation/Engineering/ConvertHex.php +++ b/src/PhpSpreadsheet/Calculation/Engineering/ConvertHex.php @@ -85,10 +85,10 @@ class ConvertHex extends ConvertBase $binX[$i] = ($binX[$i] == '1' ? '0' : '1'); } - return (bindec($binX) + 1) * -1; + return (string) ((bindec($binX) + 1) * -1); } - return bindec($binX); + return (string) bindec($binX); } /** diff --git a/src/PhpSpreadsheet/Calculation/Engineering/ConvertOctal.php b/src/PhpSpreadsheet/Calculation/Engineering/ConvertOctal.php index 872f0b70..1181e2ee 100644 --- a/src/PhpSpreadsheet/Calculation/Engineering/ConvertOctal.php +++ b/src/PhpSpreadsheet/Calculation/Engineering/ConvertOctal.php @@ -85,10 +85,10 @@ class ConvertOctal extends ConvertBase $binX[$i] = ($binX[$i] == '1' ? '0' : '1'); } - return (bindec($binX) + 1) * -1; + return (string) ((bindec($binX) + 1) * -1); } - return bindec($binX); + return (string) bindec($binX); } /** diff --git a/src/PhpSpreadsheet/Calculation/Engineering/ConvertUOM.php b/src/PhpSpreadsheet/Calculation/Engineering/ConvertUOM.php index 0aafe05e..d169ae54 100644 --- a/src/PhpSpreadsheet/Calculation/Engineering/ConvertUOM.php +++ b/src/PhpSpreadsheet/Calculation/Engineering/ConvertUOM.php @@ -490,7 +490,7 @@ class ConvertUOM * getConversionMultipliers * Returns an array of the Multiplier prefixes that can be used with Units of Measure in CONVERTUOM(). * - * @return array of mixed + * @return mixed[] */ public static function getConversionMultipliers() { @@ -501,7 +501,7 @@ class ConvertUOM * getBinaryConversionMultipliers * Returns an array of the additional Multiplier prefixes that can be used with Information Units of Measure in CONVERTUOM(). * - * @return array of mixed + * @return mixed[] */ public static function getBinaryConversionMultipliers() { diff --git a/src/PhpSpreadsheet/Calculation/FormulaParser.php b/src/PhpSpreadsheet/Calculation/FormulaParser.php index c11af834..cd1402fd 100644 --- a/src/PhpSpreadsheet/Calculation/FormulaParser.php +++ b/src/PhpSpreadsheet/Calculation/FormulaParser.php @@ -90,10 +90,8 @@ class FormulaParser * Get Token. * * @param int $pId Token id - * - * @return string */ - public function getToken($pId = 0) + public function getToken(int $pId = 0): FormulaToken { if (isset($this->tokens[$pId])) { return $this->tokens[$pId]; diff --git a/src/PhpSpreadsheet/Calculation/Functions.php b/src/PhpSpreadsheet/Calculation/Functions.php index 34ebefed..aea2323e 100644 --- a/src/PhpSpreadsheet/Calculation/Functions.php +++ b/src/PhpSpreadsheet/Calculation/Functions.php @@ -303,7 +303,7 @@ class Functions * * @param mixed $value Value to check * - * @return bool + * @return int|string */ public static function errorType($value = '') { diff --git a/src/PhpSpreadsheet/Calculation/LookupRef/Offset.php b/src/PhpSpreadsheet/Calculation/LookupRef/Offset.php index 25ec498b..c027d83c 100644 --- a/src/PhpSpreadsheet/Calculation/LookupRef/Offset.php +++ b/src/PhpSpreadsheet/Calculation/LookupRef/Offset.php @@ -38,7 +38,7 @@ class Offset * @param mixed $width The width, in number of columns, that you want the returned reference to be. * Width must be a positive number. * - * @return array|string An array containing a cell or range of cells, or a string on error + * @return array|int|string An array containing a cell or range of cells, or a string on error */ public static function OFFSET($cellAddress = null, $rows = 0, $columns = 0, $height = null, $width = null, ?Cell $pCell = null) { diff --git a/src/PhpSpreadsheet/Calculation/MathTrig/Fact.php b/src/PhpSpreadsheet/Calculation/MathTrig/Fact.php index 026cb9a2..298ccbac 100644 --- a/src/PhpSpreadsheet/Calculation/MathTrig/Fact.php +++ b/src/PhpSpreadsheet/Calculation/MathTrig/Fact.php @@ -19,7 +19,7 @@ class Fact * * @param float $factVal Factorial Value * - * @return int|string Factorial, or a string containing an error + * @return float|int|string Factorial, or a string containing an error */ public static function funcFact($factVal) { diff --git a/src/PhpSpreadsheet/Calculation/Statistical.php b/src/PhpSpreadsheet/Calculation/Statistical.php index 003f06be..a0f4cd7c 100644 --- a/src/PhpSpreadsheet/Calculation/Statistical.php +++ b/src/PhpSpreadsheet/Calculation/Statistical.php @@ -729,7 +729,7 @@ class Statistical * @param mixed[] $newValues Values of X for which we want to find Y * @param bool $const a logical value specifying whether to force the intersect to equal 0 * - * @return array of float + * @return float[] */ public static function GROWTH($yValues, $xValues = [], $newValues = [], $const = true) { @@ -1795,7 +1795,7 @@ class Statistical * @param mixed[] $newValues Values of X for which we want to find Y * @param bool $const a logical value specifying whether to force the intersect to equal 0 * - * @return array of float + * @return float[] */ public static function TREND($yValues, $xValues = [], $newValues = [], $const = true) { diff --git a/src/PhpSpreadsheet/Calculation/Statistical/Trends.php b/src/PhpSpreadsheet/Calculation/Statistical/Trends.php index e745d1b7..f1fd91ae 100644 --- a/src/PhpSpreadsheet/Calculation/Statistical/Trends.php +++ b/src/PhpSpreadsheet/Calculation/Statistical/Trends.php @@ -142,7 +142,7 @@ class Trends * @param mixed[] $newValues Values of X for which we want to find Y * @param mixed $const A logical (boolean) value specifying whether to force the intersect to equal 0 or not * - * @return array of float + * @return float[] */ public static function GROWTH($yValues, $xValues = [], $newValues = [], $const = true) { @@ -399,7 +399,7 @@ class Trends * @param mixed[] $newValues Values of X for which we want to find Y * @param mixed $const A logical (boolean) value specifying whether to force the intersect to equal 0 or not * - * @return array of float + * @return float[] */ public static function TREND($yValues, $xValues = [], $newValues = [], $const = true) { diff --git a/src/PhpSpreadsheet/Cell/Cell.php b/src/PhpSpreadsheet/Cell/Cell.php index f971a3c8..89aa32cd 100644 --- a/src/PhpSpreadsheet/Cell/Cell.php +++ b/src/PhpSpreadsheet/Cell/Cell.php @@ -78,6 +78,7 @@ class Cell public function detach(): void { + // @phpstan-ignore-next-line $this->parent = null; } @@ -201,7 +202,7 @@ class Cell break; case DataType::TYPE_STRING2: $pDataType = DataType::TYPE_STRING; - // no break + // no break case DataType::TYPE_STRING: // Synonym for string case DataType::TYPE_INLINE: @@ -563,7 +564,7 @@ class Cell // Verify if cell is in range return ($rangeStart[0] <= $myColumn) && ($rangeEnd[0] >= $myColumn) && - ($rangeStart[1] <= $myRow) && ($rangeEnd[1] >= $myRow); + ($rangeStart[1] <= $myRow) && ($rangeEnd[1] >= $myRow); } /** diff --git a/src/PhpSpreadsheet/Chart/Axis.php b/src/PhpSpreadsheet/Chart/Axis.php index 6a2e2df5..27e61060 100644 --- a/src/PhpSpreadsheet/Chart/Axis.php +++ b/src/PhpSpreadsheet/Chart/Axis.php @@ -13,7 +13,7 @@ class Axis extends Properties /** * Axis Number. * - * @var array of mixed + * @var mixed[] */ private $axisNumber = [ 'format' => self::FORMAT_CODE_GENERAL, @@ -23,7 +23,7 @@ class Axis extends Properties /** * Axis Options. * - * @var array of mixed + * @var mixed[] */ private $axisOptions = [ 'minimum' => null, @@ -41,7 +41,7 @@ class Axis extends Properties /** * Fill Properties. * - * @var array of mixed + * @var mixed[] */ private $fillProperties = [ 'type' => self::EXCEL_COLOR_TYPE_ARGB, @@ -52,7 +52,7 @@ class Axis extends Properties /** * Line Properties. * - * @var array of mixed + * @var mixed[] */ private $lineProperties = [ 'type' => self::EXCEL_COLOR_TYPE_ARGB, @@ -63,7 +63,7 @@ class Axis extends Properties /** * Line Style Properties. * - * @var array of mixed + * @var mixed[] */ private $lineStyleProperties = [ 'width' => '9525', @@ -86,7 +86,7 @@ class Axis extends Properties /** * Shadow Properties. * - * @var array of mixed + * @var mixed[] */ private $shadowProperties = [ 'presets' => self::SHADOW_PRESETS_NOSHADOW, @@ -111,7 +111,7 @@ class Axis extends Properties /** * Glow Properties. * - * @var array of mixed + * @var mixed[] */ private $glowProperties = [ 'size' => null, @@ -125,7 +125,7 @@ class Axis extends Properties /** * Soft Edge Properties. * - * @var array of mixed + * @var mixed[] */ private $softEdges = [ 'size' => null, diff --git a/src/PhpSpreadsheet/Chart/DataSeries.php b/src/PhpSpreadsheet/Chart/DataSeries.php index 3a44b335..067d30e5 100644 --- a/src/PhpSpreadsheet/Chart/DataSeries.php +++ b/src/PhpSpreadsheet/Chart/DataSeries.php @@ -75,21 +75,21 @@ class DataSeries /** * Order of plots in Series. * - * @var array of integer + * @var int[] */ private $plotOrder = []; /** * Plot Label. * - * @var array of DataSeriesValues + * @var DataSeriesValues[] */ private $plotLabel = []; /** * Plot Category. * - * @var array of DataSeriesValues + * @var DataSeriesValues[] */ private $plotCategory = []; @@ -103,7 +103,7 @@ class DataSeries /** * Plot Values. * - * @var array of DataSeriesValues + * @var DataSeriesValues[] */ private $plotValues = []; @@ -231,7 +231,7 @@ class DataSeries /** * Get Plot Labels. * - * @return array of DataSeriesValues + * @return DataSeriesValues[] */ public function getPlotLabels() { @@ -243,7 +243,7 @@ class DataSeries * * @param mixed $index * - * @return DataSeriesValues + * @return DataSeriesValues|false */ public function getPlotLabelByIndex($index) { @@ -260,7 +260,7 @@ class DataSeries /** * Get Plot Categories. * - * @return array of DataSeriesValues + * @return DataSeriesValues[] */ public function getPlotCategories() { @@ -272,7 +272,7 @@ class DataSeries * * @param mixed $index * - * @return DataSeriesValues + * @return DataSeriesValues|false */ public function getPlotCategoryByIndex($index) { @@ -313,7 +313,7 @@ class DataSeries /** * Get Plot Values. * - * @return array of DataSeriesValues + * @return DataSeriesValues[] */ public function getPlotValues() { @@ -325,7 +325,7 @@ class DataSeries * * @param mixed $index * - * @return DataSeriesValues + * @return DataSeriesValues|false */ public function getPlotValuesByIndex($index) { diff --git a/src/PhpSpreadsheet/Chart/DataSeriesValues.php b/src/PhpSpreadsheet/Chart/DataSeriesValues.php index c1bd973a..88063336 100644 --- a/src/PhpSpreadsheet/Chart/DataSeriesValues.php +++ b/src/PhpSpreadsheet/Chart/DataSeriesValues.php @@ -55,7 +55,7 @@ class DataSeriesValues /** * Data Values. * - * @var array of mixed + * @var mixed[] */ private $dataValues = []; @@ -313,7 +313,7 @@ class DataSeriesValues /** * Get Series Data Values. * - * @return array of mixed + * @return mixed[] */ public function getDataValues() { diff --git a/src/PhpSpreadsheet/Chart/PlotArea.php b/src/PhpSpreadsheet/Chart/PlotArea.php index fbd01184..ecb7b6c9 100644 --- a/src/PhpSpreadsheet/Chart/PlotArea.php +++ b/src/PhpSpreadsheet/Chart/PlotArea.php @@ -67,7 +67,7 @@ class PlotArea /** * Get Plot Series. * - * @return array of DataSeries + * @return DataSeries[] */ public function getPlotGroup() { diff --git a/src/PhpSpreadsheet/Collection/Cells.php b/src/PhpSpreadsheet/Collection/Cells.php index 48f34f41..7859965b 100644 --- a/src/PhpSpreadsheet/Collection/Cells.php +++ b/src/PhpSpreadsheet/Collection/Cells.php @@ -19,21 +19,21 @@ class Cells /** * Parent worksheet. * - * @var Worksheet + * @var null|Worksheet */ private $parent; /** * The currently active Cell. * - * @var Cell + * @var null|Cell */ private $currentCell; /** * Coordinate of the currently active Cell. * - * @var string + * @var null|string */ private $currentCoordinate; diff --git a/src/PhpSpreadsheet/Document/Properties.php b/src/PhpSpreadsheet/Document/Properties.php index 911d53ce..c099bccc 100644 --- a/src/PhpSpreadsheet/Document/Properties.php +++ b/src/PhpSpreadsheet/Document/Properties.php @@ -100,7 +100,7 @@ class Properties /** * Custom Properties. * - * @var string[] + * @var array{value: mixed, type: string}[] */ private $customProperties = []; diff --git a/src/PhpSpreadsheet/HashTable.php b/src/PhpSpreadsheet/HashTable.php index 0823236c..5d4444e7 100644 --- a/src/PhpSpreadsheet/HashTable.php +++ b/src/PhpSpreadsheet/HashTable.php @@ -126,7 +126,7 @@ class HashTable * * @param int $pIndex * - * @return T + * @return null|T */ public function getByIndex($pIndex) { @@ -142,7 +142,7 @@ class HashTable * * @param string $pHashCode * - * @return T + * @return null|T */ public function getByHashCode($pHashCode) { diff --git a/src/PhpSpreadsheet/Reader/BaseReader.php b/src/PhpSpreadsheet/Reader/BaseReader.php index eb0e3ba2..80348132 100644 --- a/src/PhpSpreadsheet/Reader/BaseReader.php +++ b/src/PhpSpreadsheet/Reader/BaseReader.php @@ -38,7 +38,7 @@ abstract class BaseReader implements IReader * Restrict which sheets should be loaded? * This property holds an array of worksheet names to be loaded. If null, then all worksheets will be loaded. * - * @var array of string + * @var null|string[] */ protected $loadSheetsOnly; diff --git a/src/PhpSpreadsheet/Reader/Xls.php b/src/PhpSpreadsheet/Reader/Xls.php index 35b55bc0..c389105b 100644 --- a/src/PhpSpreadsheet/Reader/Xls.php +++ b/src/PhpSpreadsheet/Reader/Xls.php @@ -374,7 +374,7 @@ class Xls extends BaseReader * * @var int */ - private $encryptionStartPos = false; + private $encryptionStartPos = 0; /** * The current RC4 decryption object. @@ -659,7 +659,7 @@ class Xls extends BaseReader $this->definedname = []; $this->sst = []; $this->drawingGroupData = ''; - $this->xfIndex = ''; + $this->xfIndex = 0; $this->mapCellXfIndex = []; $this->mapCellStyleXfIndex = []; @@ -1296,7 +1296,7 @@ class Xls extends BaseReader // TODO Provide support for named values } } - $this->data = null; + $this->data = ''; return $this->spreadsheet; } diff --git a/src/PhpSpreadsheet/Reader/Xlsx.php b/src/PhpSpreadsheet/Reader/Xlsx.php index 85b6c174..cd0fd149 100644 --- a/src/PhpSpreadsheet/Reader/Xlsx.php +++ b/src/PhpSpreadsheet/Reader/Xlsx.php @@ -879,10 +879,11 @@ class Xlsx extends BaseReader // Loop through contents foreach ($commentsFile->commentList->comment as $comment) { + $commentModel = $docSheet->getComment((string) $comment['ref']); if (!empty($comment['authorId'])) { - $docSheet->getComment((string) $comment['ref'])->setAuthor($authors[(string) $comment['authorId']]); + $commentModel->setAuthor($authors[$comment['authorId']]); } - $docSheet->getComment((string) $comment['ref'])->setText($this->parseRichText($comment->text)); + $commentModel->setText($this->parseRichText($comment->text)); } } diff --git a/src/PhpSpreadsheet/Reader/Xlsx/Theme.php b/src/PhpSpreadsheet/Reader/Xlsx/Theme.php index c105f3c1..1f2b863c 100644 --- a/src/PhpSpreadsheet/Reader/Xlsx/Theme.php +++ b/src/PhpSpreadsheet/Reader/Xlsx/Theme.php @@ -21,16 +21,16 @@ class Theme /** * Colour Map. * - * @var array of string + * @var string[] */ private $colourMap; /** * Create a new Theme. * - * @param mixed $themeName - * @param mixed $colourSchemeName - * @param mixed $colourMap + * @param string $themeName + * @param string $colourSchemeName + * @param string[] $colourMap */ public function __construct($themeName, $colourSchemeName, $colourMap) { @@ -63,9 +63,9 @@ class Theme /** * Get colour Map Value by Position. * - * @param mixed $index + * @param int $index * - * @return string + * @return null|string */ public function getColourByIndex($index) { diff --git a/src/PhpSpreadsheet/Settings.php b/src/PhpSpreadsheet/Settings.php index cfa50573..8fdccbad 100644 --- a/src/PhpSpreadsheet/Settings.php +++ b/src/PhpSpreadsheet/Settings.php @@ -118,7 +118,7 @@ class Settings if (self::$libXmlLoaderOptions === null && defined('LIBXML_DTDLOAD')) { self::setLibXmlLoaderOptions(LIBXML_DTDLOAD | LIBXML_DTDATTR); } elseif (self::$libXmlLoaderOptions === null) { - self::$libXmlLoaderOptions = true; + self::$libXmlLoaderOptions = 0; } return self::$libXmlLoaderOptions; diff --git a/src/PhpSpreadsheet/Shared/Date.php b/src/PhpSpreadsheet/Shared/Date.php index 49b3425c..898dd523 100644 --- a/src/PhpSpreadsheet/Shared/Date.php +++ b/src/PhpSpreadsheet/Shared/Date.php @@ -255,7 +255,7 @@ class Date * * @param int $dateValue Unix Timestamp * - * @return float MS Excel serialized date/time value + * @return false|float MS Excel serialized date/time value */ public static function timestampToExcel($dateValue) { diff --git a/src/PhpSpreadsheet/Shared/Drawing.php b/src/PhpSpreadsheet/Shared/Drawing.php index 67c015c4..ebb87ed1 100644 --- a/src/PhpSpreadsheet/Shared/Drawing.php +++ b/src/PhpSpreadsheet/Shared/Drawing.php @@ -15,7 +15,7 @@ class Drawing */ public static function pixelsToEMU($pValue) { - return round($pValue * 9525); + return $pValue * 9525; } /** @@ -28,7 +28,7 @@ class Drawing public static function EMUToPixels($pValue) { if ($pValue != 0) { - return round($pValue / 9525); + return (int) round($pValue / 9525); } return 0; @@ -141,7 +141,7 @@ class Drawing public static function angleToDegrees($pValue) { if ($pValue != 0) { - return round($pValue / 60000); + return (int) round($pValue / 60000); } return 0; diff --git a/src/PhpSpreadsheet/Shared/Font.php b/src/PhpSpreadsheet/Shared/Font.php index 94e35dfe..00629e69 100644 --- a/src/PhpSpreadsheet/Shared/Font.php +++ b/src/PhpSpreadsheet/Shared/Font.php @@ -268,7 +268,7 @@ class Font $columnWidth = Drawing::pixelsToCellDimension($columnWidth, $defaultFont); // Return - return round($columnWidth, 6); + return (int) round($columnWidth, 6); } /** diff --git a/src/PhpSpreadsheet/Shared/JAMA/LUDecomposition.php b/src/PhpSpreadsheet/Shared/JAMA/LUDecomposition.php index e16d6a21..ecfe42ba 100644 --- a/src/PhpSpreadsheet/Shared/JAMA/LUDecomposition.php +++ b/src/PhpSpreadsheet/Shared/JAMA/LUDecomposition.php @@ -221,7 +221,7 @@ class LUDecomposition /** * Count determinants. * - * @return array d matrix deterninat + * @return float */ public function det() { diff --git a/src/PhpSpreadsheet/Shared/JAMA/Matrix.php b/src/PhpSpreadsheet/Shared/JAMA/Matrix.php index 9cbc9530..adf399ac 100644 --- a/src/PhpSpreadsheet/Shared/JAMA/Matrix.php +++ b/src/PhpSpreadsheet/Shared/JAMA/Matrix.php @@ -147,7 +147,7 @@ class Matrix * @param int $i Row position * @param int $j Column position * - * @return mixed Element (int/float/double) + * @return float|int */ public function get($i = null, $j = null) { @@ -323,11 +323,9 @@ class Matrix * * @param int $i Row position * @param int $j Column position - * @param mixed $c Int/float/double value - * - * @return mixed Element (int/float/double) + * @param float|int $c value */ - public function set($i = null, $j = null, $c = null) + public function set($i = null, $j = null, $c = null): void { // Optimized set version just has this $this->A[$i][$j] = $c; diff --git a/src/PhpSpreadsheet/Shared/OLE/ChainedBlockStream.php b/src/PhpSpreadsheet/Shared/OLE/ChainedBlockStream.php index 1863ae34..43e4804d 100644 --- a/src/PhpSpreadsheet/Shared/OLE/ChainedBlockStream.php +++ b/src/PhpSpreadsheet/Shared/OLE/ChainedBlockStream.php @@ -9,7 +9,7 @@ class ChainedBlockStream /** * The OLE container of the file that is being read. * - * @var OLE + * @var null|OLE */ public $ole; @@ -112,7 +112,7 @@ class ChainedBlockStream * * @param int $count maximum number of bytes to read * - * @return string + * @return false|string */ public function stream_read($count) // @codingStandardsIgnoreLine { diff --git a/src/PhpSpreadsheet/Shared/OLERead.php b/src/PhpSpreadsheet/Shared/OLERead.php index 78417741..c4dc572a 100644 --- a/src/PhpSpreadsheet/Shared/OLERead.php +++ b/src/PhpSpreadsheet/Shared/OLERead.php @@ -188,7 +188,7 @@ class OLERead * * @param int $stream * - * @return string + * @return null|string */ public function getStream($stream) { diff --git a/src/PhpSpreadsheet/Shared/Trend/BestFit.php b/src/PhpSpreadsheet/Shared/Trend/BestFit.php index 6d6f6283..7df48953 100644 --- a/src/PhpSpreadsheet/Shared/Trend/BestFit.php +++ b/src/PhpSpreadsheet/Shared/Trend/BestFit.php @@ -2,7 +2,7 @@ namespace PhpOffice\PhpSpreadsheet\Shared\Trend; -class BestFit +abstract class BestFit { /** * Indicator flag for a calculation error. @@ -96,24 +96,18 @@ class BestFit * * @param float $xValue X-Value * - * @return bool Y-Value + * @return float Y-Value */ - public function getValueOfYForX($xValue) - { - return false; - } + abstract public function getValueOfYForX($xValue); /** * Return the X-Value for a specified value of Y. * * @param float $yValue Y-Value * - * @return bool X-Value + * @return float X-Value */ - public function getValueOfXForY($yValue) - { - return false; - } + abstract public function getValueOfXForY($yValue); /** * Return the original set of X-Values. @@ -130,12 +124,9 @@ class BestFit * * @param int $dp Number of places of decimal precision to display * - * @return bool + * @return string */ - public function getEquation($dp = 0) - { - return false; - } + abstract public function getEquation($dp = 0); /** * Return the Slope of the line. diff --git a/src/PhpSpreadsheet/Shared/Trend/PolynomialBestFit.php b/src/PhpSpreadsheet/Shared/Trend/PolynomialBestFit.php index 1d34e81c..2c8eea5b 100644 --- a/src/PhpSpreadsheet/Shared/Trend/PolynomialBestFit.php +++ b/src/PhpSpreadsheet/Shared/Trend/PolynomialBestFit.php @@ -42,6 +42,7 @@ class PolynomialBestFit extends BestFit { $retVal = $this->getIntersect(); $slope = $this->getSlope(); + // @phpstan-ignore-next-line foreach ($slope as $key => $value) { if ($value != 0.0) { $retVal += $value * $xValue ** ($key + 1); @@ -76,6 +77,7 @@ class PolynomialBestFit extends BestFit $intersect = $this->getIntersect($dp); $equation = 'Y = ' . $intersect; + // @phpstan-ignore-next-line foreach ($slope as $key => $value) { if ($value != 0.0) { $equation .= ' + ' . $value . ' * X'; @@ -93,7 +95,7 @@ class PolynomialBestFit extends BestFit * * @param int $dp Number of places of decimal precision to display * - * @return string + * @return float */ public function getSlope($dp = 0) { @@ -103,6 +105,7 @@ class PolynomialBestFit extends BestFit $coefficients[] = round($coefficient, $dp); } + // @phpstan-ignore-next-line return $coefficients; } diff --git a/src/PhpSpreadsheet/Shared/Xls.php b/src/PhpSpreadsheet/Shared/Xls.php index b3cdbd7d..26035ec6 100644 --- a/src/PhpSpreadsheet/Shared/Xls.php +++ b/src/PhpSpreadsheet/Shared/Xls.php @@ -205,7 +205,7 @@ class Xls * @param int $width Width in pixels * @param int $height Height in pixels * - * @return array + * @return null|array */ public static function oneAnchor2twoAnchor($sheet, $coordinates, $offsetX, $offsetY, $width, $height) { @@ -245,16 +245,16 @@ class Xls // Bitmap isn't allowed to start or finish in a hidden cell, i.e. a cell // with zero height or width. if (self::sizeCol($sheet, Coordinate::stringFromColumnIndex($col_start)) == 0) { - return; + return null; } if (self::sizeCol($sheet, Coordinate::stringFromColumnIndex($col_end)) == 0) { - return; + return null; } if (self::sizeRow($sheet, $row_start + 1) == 0) { - return; + return null; } if (self::sizeRow($sheet, $row_end + 1) == 0) { - return; + return null; } // Convert the pixel values to the percentage value expected by Excel diff --git a/src/PhpSpreadsheet/Spreadsheet.php b/src/PhpSpreadsheet/Spreadsheet.php index 59304804..fb945399 100644 --- a/src/PhpSpreadsheet/Spreadsheet.php +++ b/src/PhpSpreadsheet/Spreadsheet.php @@ -69,7 +69,7 @@ class Spreadsheet /** * Named ranges. * - * @var NamedRange[] + * @var DefinedName[] */ private $definedNames = []; @@ -104,21 +104,21 @@ class Spreadsheet /** * macrosCode : all macros code as binary data (the vbaProject.bin file, this include form, code, etc.), null if no macro. * - * @var string + * @var null|string */ private $macrosCode; /** * macrosCertificate : if macros are signed, contains binary data vbaProjectSignature.bin file, null if not signed. * - * @var string + * @var null|string */ private $macrosCertificate; /** * ribbonXMLData : null if workbook is'nt Excel 2007 or not contain a customized UI. * - * @var null|string + * @var null|array{target: string, data: string} */ private $ribbonXMLData; @@ -298,11 +298,9 @@ class Spreadsheet /** * retrieve ribbon XML Data. * - * return string|null|array - * * @param string $what * - * @return string + * @return null|array|string */ public function getRibbonXMLData($what = 'all') //we need some constants here... { @@ -455,7 +453,7 @@ class Spreadsheet * * @param string $pName Sheet name * - * @return Worksheet + * @return null|Worksheet */ public function getSheetByCodeName($pName) { @@ -515,12 +513,10 @@ class Spreadsheet */ public function disconnectWorksheets(): void { - $worksheet = null; - foreach ($this->workSheetCollection as $k => &$worksheet) { + foreach ($this->workSheetCollection as $worksheet) { $worksheet->disconnectCells(); - $this->workSheetCollection[$k] = null; + unset($worksheet); } - unset($worksheet); $this->workSheetCollection = []; } @@ -876,7 +872,7 @@ class Spreadsheet /** * Get an array of all Named Ranges. * - * @return NamedRange[] + * @return DefinedName[] */ public function getNamedRanges(): array { @@ -891,7 +887,7 @@ class Spreadsheet /** * Get an array of all Named Formulae. * - * @return NamedFormula[] + * @return DefinedName[] */ public function getNamedFormulae(): array { @@ -1124,6 +1120,7 @@ class Spreadsheet */ public function __clone() { + // @phpstan-ignore-next-line foreach ($this as $key => $val) { if (is_object($val) || (is_array($val))) { $this->{$key} = unserialize(serialize($val)); diff --git a/src/PhpSpreadsheet/Style/Alignment.php b/src/PhpSpreadsheet/Style/Alignment.php index 226a5427..e072c524 100644 --- a/src/PhpSpreadsheet/Style/Alignment.php +++ b/src/PhpSpreadsheet/Style/Alignment.php @@ -35,21 +35,21 @@ class Alignment extends Supervisor /** * Horizontal alignment. * - * @var string + * @var null|string */ protected $horizontal = self::HORIZONTAL_GENERAL; /** * Vertical alignment. * - * @var string + * @var null|string */ protected $vertical = self::VERTICAL_BOTTOM; /** * Text rotation. * - * @var int + * @var null|int */ protected $textRotation = 0; @@ -179,7 +179,7 @@ class Alignment extends Supervisor /** * Get Horizontal. * - * @return string + * @return null|string */ public function getHorizontal() { @@ -216,7 +216,7 @@ class Alignment extends Supervisor /** * Get Vertical. * - * @return string + * @return null|string */ public function getVertical() { @@ -253,7 +253,7 @@ class Alignment extends Supervisor /** * Get TextRotation. * - * @return int + * @return null|int */ public function getTextRotation() { diff --git a/src/PhpSpreadsheet/Style/Border.php b/src/PhpSpreadsheet/Style/Border.php index dee1ad4c..a8af9d94 100644 --- a/src/PhpSpreadsheet/Style/Border.php +++ b/src/PhpSpreadsheet/Style/Border.php @@ -37,7 +37,7 @@ class Border extends Supervisor protected $color; /** - * @var int + * @var null|int */ public $colorIndex; diff --git a/src/PhpSpreadsheet/Style/Fill.php b/src/PhpSpreadsheet/Style/Fill.php index 3891bc47..e793f1e7 100644 --- a/src/PhpSpreadsheet/Style/Fill.php +++ b/src/PhpSpreadsheet/Style/Fill.php @@ -28,19 +28,19 @@ class Fill extends Supervisor const FILL_PATTERN_MEDIUMGRAY = 'mediumGray'; /** - * @var int + * @var null|int */ public $startcolorIndex; /** - * @var int + * @var null|int */ public $endcolorIndex; /** * Fill type. * - * @var string + * @var null|string */ protected $fillType = self::FILL_NONE; @@ -168,7 +168,7 @@ class Fill extends Supervisor /** * Get Fill Type. * - * @return string + * @return null|string */ public function getFillType() { diff --git a/src/PhpSpreadsheet/Style/Font.php b/src/PhpSpreadsheet/Style/Font.php index ad405708..473fe1dc 100644 --- a/src/PhpSpreadsheet/Style/Font.php +++ b/src/PhpSpreadsheet/Style/Font.php @@ -14,56 +14,56 @@ class Font extends Supervisor /** * Font Name. * - * @var string + * @var null|string */ protected $name = 'Calibri'; /** * Font Size. * - * @var float + * @var null|float */ protected $size = 11; /** * Bold. * - * @var bool + * @var null|bool */ protected $bold = false; /** * Italic. * - * @var bool + * @var null|bool */ protected $italic = false; /** * Superscript. * - * @var bool + * @var null|bool */ protected $superscript = false; /** * Subscript. * - * @var bool + * @var null|bool */ protected $subscript = false; /** * Underline. * - * @var string + * @var null|string */ protected $underline = self::UNDERLINE_NONE; /** * Strikethrough. * - * @var bool + * @var null|bool */ protected $strikethrough = false; @@ -75,7 +75,7 @@ class Font extends Supervisor protected $color; /** - * @var int + * @var null|int */ public $colorIndex; @@ -199,7 +199,7 @@ class Font extends Supervisor /** * Get Name. * - * @return string + * @return null|string */ public function getName() { @@ -235,7 +235,7 @@ class Font extends Supervisor /** * Get Size. * - * @return float + * @return null|float */ public function getSize() { @@ -271,7 +271,7 @@ class Font extends Supervisor /** * Get Bold. * - * @return bool + * @return null|bool */ public function getBold() { @@ -307,7 +307,7 @@ class Font extends Supervisor /** * Get Italic. * - * @return bool + * @return null|bool */ public function getItalic() { @@ -343,7 +343,7 @@ class Font extends Supervisor /** * Get Superscript. * - * @return bool + * @return null|bool */ public function getSuperscript() { @@ -377,7 +377,7 @@ class Font extends Supervisor /** * Get Subscript. * - * @return bool + * @return null|bool */ public function getSubscript() { @@ -411,7 +411,7 @@ class Font extends Supervisor /** * Get Underline. * - * @return string + * @return null|string */ public function getUnderline() { @@ -451,7 +451,7 @@ class Font extends Supervisor /** * Get Strikethrough. * - * @return bool + * @return null|bool */ public function getStrikethrough() { diff --git a/src/PhpSpreadsheet/Style/NumberFormat.php b/src/PhpSpreadsheet/Style/NumberFormat.php index b5cc05f4..6235d864 100644 --- a/src/PhpSpreadsheet/Style/NumberFormat.php +++ b/src/PhpSpreadsheet/Style/NumberFormat.php @@ -64,14 +64,14 @@ class NumberFormat extends Supervisor /** * Format Code. * - * @var string + * @var null|string */ protected $formatCode = self::FORMAT_GENERAL; /** * Built-in format Code. * - * @var string + * @var false|int */ protected $builtInFormatCode = 0; @@ -150,7 +150,7 @@ class NumberFormat extends Supervisor /** * Get Format Code. * - * @return string + * @return null|string */ public function getFormatCode() { @@ -190,7 +190,7 @@ class NumberFormat extends Supervisor /** * Get Built-In Format Code. * - * @return int + * @return false|int */ public function getBuiltInFormatCode() { diff --git a/src/PhpSpreadsheet/Worksheet/AutoFilter.php b/src/PhpSpreadsheet/Worksheet/AutoFilter.php index d8912b21..1a710e40 100644 --- a/src/PhpSpreadsheet/Worksheet/AutoFilter.php +++ b/src/PhpSpreadsheet/Worksheet/AutoFilter.php @@ -14,7 +14,7 @@ class AutoFilter /** * Autofilter Worksheet. * - * @var Worksheet + * @var null|Worksheet */ private $workSheet; @@ -47,7 +47,7 @@ class AutoFilter /** * Get AutoFilter Parent Worksheet. * - * @return Worksheet + * @return null|Worksheet */ public function getParent() { @@ -791,10 +791,10 @@ class AutoFilter if ($ruleOperator === AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_PERCENT) { $ruleValue = floor($ruleValue * ($dataRowCount / 100)); } - if ($ruleValue < 1) { + if (!is_array($ruleValue) && $ruleValue < 1) { $ruleValue = 1; } - if ($ruleValue > 500) { + if (!is_array($ruleValue) && $ruleValue > 500) { $ruleValue = 500; } diff --git a/src/PhpSpreadsheet/Worksheet/AutoFilter/Column.php b/src/PhpSpreadsheet/Worksheet/AutoFilter/Column.php index 09584a7a..8ec0ca3b 100644 --- a/src/PhpSpreadsheet/Worksheet/AutoFilter/Column.php +++ b/src/PhpSpreadsheet/Worksheet/AutoFilter/Column.php @@ -49,7 +49,7 @@ class Column /** * Autofilter. * - * @var AutoFilter + * @var null|AutoFilter */ private $parent; @@ -77,14 +77,14 @@ class Column /** * Autofilter Column Rules. * - * @var array of Column\Rule + * @var Column\Rule[] */ private $ruleset = []; /** * Autofilter Column Dynamic Attributes. * - * @var array of mixed + * @var mixed[] */ private $attributes = []; @@ -133,7 +133,7 @@ class Column /** * Get this Column's AutoFilter Parent. * - * @return AutoFilter + * @return null|AutoFilter */ public function getParent() { @@ -256,7 +256,7 @@ class Column * * @param string $pName Attribute Name * - * @return string + * @return null|string */ public function getAttribute($pName) { diff --git a/src/PhpSpreadsheet/Worksheet/AutoFilter/Column/Rule.php b/src/PhpSpreadsheet/Worksheet/AutoFilter/Column/Rule.php index 1aacb0cb..330a1641 100644 --- a/src/PhpSpreadsheet/Worksheet/AutoFilter/Column/Rule.php +++ b/src/PhpSpreadsheet/Worksheet/AutoFilter/Column/Rule.php @@ -217,7 +217,7 @@ class Rule /** * Autofilter Rule Value. * - * @var string + * @var string|string[] */ private $value = ''; @@ -276,7 +276,7 @@ class Rule /** * Get AutoFilter Rule Value. * - * @return string + * @return string|string[] */ public function getValue() { diff --git a/src/PhpSpreadsheet/Worksheet/BaseDrawing.php b/src/PhpSpreadsheet/Worksheet/BaseDrawing.php index be2f23df..5829671b 100644 --- a/src/PhpSpreadsheet/Worksheet/BaseDrawing.php +++ b/src/PhpSpreadsheet/Worksheet/BaseDrawing.php @@ -39,7 +39,7 @@ class BaseDrawing implements IComparable /** * Worksheet. * - * @var Worksheet + * @var null|Worksheet */ protected $worksheet; @@ -190,7 +190,7 @@ class BaseDrawing implements IComparable /** * Get Worksheet. * - * @return Worksheet + * @return null|Worksheet */ public function getWorksheet() { @@ -330,7 +330,7 @@ class BaseDrawing implements IComparable // Resize proportional? if ($this->resizeProportional && $pValue != 0) { $ratio = $this->height / ($this->width != 0 ? $this->width : 1); - $this->height = round($ratio * $pValue); + $this->height = (int) round($ratio * $pValue); } // Set width @@ -361,7 +361,7 @@ class BaseDrawing implements IComparable // Resize proportional? if ($this->resizeProportional && $pValue != 0) { $ratio = $this->width / ($this->height != 0 ? $this->height : 1); - $this->width = round($ratio * $pValue); + $this->width = (int) round($ratio * $pValue); } // Set height @@ -392,10 +392,10 @@ class BaseDrawing implements IComparable $yratio = $height / ($this->height != 0 ? $this->height : 1); if ($this->resizeProportional && !($width == 0 || $height == 0)) { if (($xratio * $this->height) < $height) { - $this->height = ceil($xratio * $this->height); + $this->height = (int) ceil($xratio * $this->height); $this->width = $width; } else { - $this->width = ceil($yratio * $this->width); + $this->width = (int) ceil($yratio * $this->width); $this->height = $height; } } else { diff --git a/src/PhpSpreadsheet/Worksheet/CellIterator.php b/src/PhpSpreadsheet/Worksheet/CellIterator.php index e0f35b64..31f6ae65 100644 --- a/src/PhpSpreadsheet/Worksheet/CellIterator.php +++ b/src/PhpSpreadsheet/Worksheet/CellIterator.php @@ -25,6 +25,7 @@ abstract class CellIterator implements Iterator */ public function __destruct() { + // @phpstan-ignore-next-line $this->worksheet = null; } diff --git a/src/PhpSpreadsheet/Worksheet/Column.php b/src/PhpSpreadsheet/Worksheet/Column.php index 763806a0..8abbabe5 100644 --- a/src/PhpSpreadsheet/Worksheet/Column.php +++ b/src/PhpSpreadsheet/Worksheet/Column.php @@ -36,6 +36,7 @@ class Column */ public function __destruct() { + // @phpstan-ignore-next-line $this->parent = null; } diff --git a/src/PhpSpreadsheet/Worksheet/ColumnCellIterator.php b/src/PhpSpreadsheet/Worksheet/ColumnCellIterator.php index 1390214e..65772114 100644 --- a/src/PhpSpreadsheet/Worksheet/ColumnCellIterator.php +++ b/src/PhpSpreadsheet/Worksheet/ColumnCellIterator.php @@ -18,7 +18,7 @@ class ColumnCellIterator extends CellIterator /** * Column index. * - * @var string + * @var int */ private $columnIndex; diff --git a/src/PhpSpreadsheet/Worksheet/ColumnIterator.php b/src/PhpSpreadsheet/Worksheet/ColumnIterator.php index a7466881..0651a7a4 100644 --- a/src/PhpSpreadsheet/Worksheet/ColumnIterator.php +++ b/src/PhpSpreadsheet/Worksheet/ColumnIterator.php @@ -57,6 +57,7 @@ class ColumnIterator implements Iterator */ public function __destruct() { + // @phpstan-ignore-next-line $this->worksheet = null; } diff --git a/src/PhpSpreadsheet/Worksheet/Drawing/Shadow.php b/src/PhpSpreadsheet/Worksheet/Drawing/Shadow.php index 01ffed94..0557c83c 100644 --- a/src/PhpSpreadsheet/Worksheet/Drawing/Shadow.php +++ b/src/PhpSpreadsheet/Worksheet/Drawing/Shadow.php @@ -52,7 +52,7 @@ class Shadow implements IComparable /** * Shadow alignment. * - * @var int + * @var string */ private $alignment; @@ -184,7 +184,7 @@ class Shadow implements IComparable /** * Get Shadow alignment. * - * @return int + * @return string */ public function getAlignment() { @@ -194,7 +194,7 @@ class Shadow implements IComparable /** * Set Shadow alignment. * - * @param int $pValue + * @param string $pValue * * @return $this */ diff --git a/src/PhpSpreadsheet/Worksheet/Iterator.php b/src/PhpSpreadsheet/Worksheet/Iterator.php index 93b0bb04..134b619a 100644 --- a/src/PhpSpreadsheet/Worksheet/Iterator.php +++ b/src/PhpSpreadsheet/Worksheet/Iterator.php @@ -29,14 +29,6 @@ class Iterator implements \Iterator $this->subject = $subject; } - /** - * Destructor. - */ - public function __destruct() - { - $this->subject = null; - } - /** * Rewind iterator. */ diff --git a/src/PhpSpreadsheet/Worksheet/MemoryDrawing.php b/src/PhpSpreadsheet/Worksheet/MemoryDrawing.php index fb002114..cde23c96 100644 --- a/src/PhpSpreadsheet/Worksheet/MemoryDrawing.php +++ b/src/PhpSpreadsheet/Worksheet/MemoryDrawing.php @@ -52,7 +52,6 @@ class MemoryDrawing extends BaseDrawing public function __construct() { // Initialise values - $this->imageResource = null; $this->renderingFunction = self::RENDERING_DEFAULT; $this->mimeType = self::MIMETYPE_DEFAULT; $this->uniqueName = md5(mt_rand(0, 9999) . time() . mt_rand(0, 9999)); diff --git a/src/PhpSpreadsheet/Worksheet/PageSetup.php b/src/PhpSpreadsheet/Worksheet/PageSetup.php index d1a22a7b..7f3f71dc 100644 --- a/src/PhpSpreadsheet/Worksheet/PageSetup.php +++ b/src/PhpSpreadsheet/Worksheet/PageSetup.php @@ -238,7 +238,7 @@ class PageSetup /** * Print area. * - * @var string + * @var null|string */ private $printArea; diff --git a/src/PhpSpreadsheet/Worksheet/Row.php b/src/PhpSpreadsheet/Worksheet/Row.php index cf935743..01053c39 100644 --- a/src/PhpSpreadsheet/Worksheet/Row.php +++ b/src/PhpSpreadsheet/Worksheet/Row.php @@ -36,6 +36,7 @@ class Row */ public function __destruct() { + // @phpstan-ignore-next-line $this->worksheet = null; } diff --git a/src/PhpSpreadsheet/Worksheet/RowIterator.php b/src/PhpSpreadsheet/Worksheet/RowIterator.php index 469c284c..7d49f1ac 100644 --- a/src/PhpSpreadsheet/Worksheet/RowIterator.php +++ b/src/PhpSpreadsheet/Worksheet/RowIterator.php @@ -50,14 +50,6 @@ class RowIterator implements Iterator $this->resetStart($startRow); } - /** - * Destructor. - */ - public function __destruct() - { - $this->subject = null; - } - /** * (Re)Set the start row and the current row pointer. * diff --git a/src/PhpSpreadsheet/Worksheet/Worksheet.php b/src/PhpSpreadsheet/Worksheet/Worksheet.php index f8b6a743..02d7692b 100644 --- a/src/PhpSpreadsheet/Worksheet/Worksheet.php +++ b/src/PhpSpreadsheet/Worksheet/Worksheet.php @@ -105,7 +105,7 @@ class Worksheet implements IComparable * * @var ArrayObject */ - private $chartCollection = []; + private $chartCollection; /** * Worksheet title. @@ -278,9 +278,9 @@ class Worksheet implements IComparable /** * Cached highest column. * - * @var string + * @var int */ - private $cachedHighestColumn = 'A'; + private $cachedHighestColumn = 1; /** * Cached highest row. @@ -313,7 +313,7 @@ class Worksheet implements IComparable /** * Tab color. * - * @var Color + * @var null|Color */ private $tabColor; @@ -383,9 +383,11 @@ class Worksheet implements IComparable { if ($this->cellCollection !== null) { $this->cellCollection->unsetWorksheetCells(); + // @phpstan-ignore-next-line $this->cellCollection = null; } // detach ourself from the workbook, so that it can then delete this worksheet successfully + // @phpstan-ignore-next-line $this->parent = null; } @@ -1039,7 +1041,7 @@ class Worksheet implements IComparable public function getHighestColumn($row = null) { if ($row == null) { - return $this->cachedHighestColumn; + return Coordinate::stringFromColumnIndex($this->cachedHighestColumn); } return $this->getHighestDataColumn($row); @@ -1252,11 +1254,12 @@ class Worksheet implements IComparable // Coordinates $aCoordinates = Coordinate::coordinateFromString($pCoordinate); - if (Coordinate::columnIndexFromString($this->cachedHighestColumn) < Coordinate::columnIndexFromString($aCoordinates[0])) { - $this->cachedHighestColumn = $aCoordinates[0]; + $aIndexes = Coordinate::indexesFromString($pCoordinate); + if ($this->cachedHighestColumn < $aIndexes[0]) { + $this->cachedHighestColumn = $aIndexes[0]; } - if ($aCoordinates[1] > $this->cachedHighestRow) { - $this->cachedHighestRow = $aCoordinates[1]; + if ($aIndexes[1] > $this->cachedHighestRow) { + $this->cachedHighestRow = $aIndexes[1]; } // Cell needs appropriate xfIndex from dimensions records @@ -1377,8 +1380,9 @@ class Worksheet implements IComparable } $this->columnDimensions[$pColumn] = new ColumnDimension($pColumn); - if (Coordinate::columnIndexFromString($this->cachedHighestColumn) < Coordinate::columnIndexFromString($pColumn)) { - $this->cachedHighestColumn = $pColumn; + $columnIndex = Coordinate::columnIndexFromString($pColumn); + if ($this->cachedHighestColumn < $columnIndex) { + $this->cachedHighestColumn = $columnIndex; } } @@ -1987,7 +1991,7 @@ class Worksheet implements IComparable /** * Get the default position of the right bottom pane. * - * @return int + * @return null|string */ public function getTopLeftCell() { @@ -2677,9 +2681,9 @@ class Worksheet implements IComparable // Cache values if ($highestColumn < 1) { - $this->cachedHighestColumn = 'A'; + $this->cachedHighestColumn = 1; } else { - $this->cachedHighestColumn = Coordinate::stringFromColumnIndex($highestColumn); + $this->cachedHighestColumn = $highestColumn; } $this->cachedHighestRow = $highestRow; @@ -2905,7 +2909,6 @@ class Worksheet implements IComparable public function resetTabColor() { $this->tabColor = null; - $this->tabColor = null; return $this; } @@ -2935,6 +2938,7 @@ class Worksheet implements IComparable */ public function __clone() { + // @phpstan-ignore-next-line foreach ($this as $key => $val) { if ($key == 'parent') { continue; diff --git a/src/PhpSpreadsheet/Writer/Html.php b/src/PhpSpreadsheet/Writer/Html.php index 60612737..4ee94114 100644 --- a/src/PhpSpreadsheet/Writer/Html.php +++ b/src/PhpSpreadsheet/Writer/Html.php @@ -37,7 +37,7 @@ class Html extends BaseWriter /** * Sheet index to write. * - * @var int + * @var null|int */ private $sheetIndex = 0; @@ -735,7 +735,7 @@ class Html extends BaseWriter if ($chartCoordinates['cell'] == $coordinates) { $chartFileName = File::sysGetTempDir() . '/' . uniqid('', true) . '.png'; if (!$chart->render($chartFileName)) { - return; + return ''; } $html .= PHP_EOL; diff --git a/src/PhpSpreadsheet/Writer/Pdf.php b/src/PhpSpreadsheet/Writer/Pdf.php index 87220458..36f3966d 100644 --- a/src/PhpSpreadsheet/Writer/Pdf.php +++ b/src/PhpSpreadsheet/Writer/Pdf.php @@ -165,7 +165,7 @@ abstract class Pdf extends Html /** * Set Paper Size. * - * @param string $pValue Paper size see PageSetup::PAPERSIZE_* + * @param int $pValue Paper size see PageSetup::PAPERSIZE_* * * @return self */ diff --git a/src/PhpSpreadsheet/Writer/Xls.php b/src/PhpSpreadsheet/Writer/Xls.php index 1ee52bdf..a1b477bf 100644 --- a/src/PhpSpreadsheet/Writer/Xls.php +++ b/src/PhpSpreadsheet/Writer/Xls.php @@ -81,14 +81,14 @@ class Xls extends BaseWriter /** * Basic OLE object summary information. * - * @var array + * @var string */ private $summaryInformation; /** * Extended OLE object document summary information. * - * @var array + * @var string */ private $documentSummaryInformation; @@ -727,6 +727,7 @@ class Xls extends BaseWriter } elseif ($dataProp['type']['data'] == 0x1E) { // null-terminated string prepended by dword string length // Null-terminated string $dataProp['data']['data'] .= chr(0); + // @phpstan-ignore-next-line ++$dataProp['data']['length']; // Complete the string with null string for being a %4 $dataProp['data']['length'] = $dataProp['data']['length'] + ((4 - $dataProp['data']['length'] % 4) == 4 ? 0 : (4 - $dataProp['data']['length'] % 4)); @@ -744,6 +745,7 @@ class Xls extends BaseWriter } else { $dataSection_Content .= $dataProp['data']['data']; + // @phpstan-ignore-next-line $dataSection_Content_Offset += 4 + $dataProp['data']['length']; } } diff --git a/src/PhpSpreadsheet/Writer/Xls/BIFFwriter.php b/src/PhpSpreadsheet/Writer/Xls/BIFFwriter.php index 84e27d0d..4a7e0656 100644 --- a/src/PhpSpreadsheet/Writer/Xls/BIFFwriter.php +++ b/src/PhpSpreadsheet/Writer/Xls/BIFFwriter.php @@ -49,7 +49,7 @@ class BIFFwriter /** * The string containing the data of the BIFF stream. * - * @var string + * @var null|string */ public $_data; diff --git a/src/PhpSpreadsheet/Writer/Xls/Font.php b/src/PhpSpreadsheet/Writer/Xls/Font.php index 9cb31ead..1266cf24 100644 --- a/src/PhpSpreadsheet/Writer/Xls/Font.php +++ b/src/PhpSpreadsheet/Writer/Xls/Font.php @@ -119,7 +119,7 @@ class Font /** * Map of BIFF2-BIFF8 codes for underline styles. * - * @var array of int + * @var int[] */ private static $mapUnderline = [ \PhpOffice\PhpSpreadsheet\Style\Font::UNDERLINE_NONE => 0x00, diff --git a/src/PhpSpreadsheet/Writer/Xls/Worksheet.php b/src/PhpSpreadsheet/Writer/Xls/Worksheet.php index fdc05b85..7051ab2d 100644 --- a/src/PhpSpreadsheet/Writer/Xls/Worksheet.php +++ b/src/PhpSpreadsheet/Writer/Xls/Worksheet.php @@ -95,7 +95,7 @@ class Worksheet extends BIFFwriter /** * Whether to use outline. * - * @var int + * @var bool */ private $outlineOn; @@ -244,10 +244,10 @@ class Worksheet extends BIFFwriter $this->printHeaders = 0; - $this->outlineStyle = 0; - $this->outlineBelow = 1; - $this->outlineRight = 1; - $this->outlineOn = 1; + $this->outlineStyle = false; + $this->outlineBelow = true; + $this->outlineRight = true; + $this->outlineOn = true; $this->fontHashIndex = []; @@ -594,15 +594,13 @@ class Worksheet extends BIFFwriter } /** - * Retrieves data from memory in one chunk, or from disk in $buffer + * Retrieves data from memory in one chunk, or from disk * sized chunks. * * @return string The data */ public function getData() { - $buffer = 4096; - // Return data stored in memory if (isset($this->_data)) { $tmp = $this->_data; @@ -612,7 +610,7 @@ class Worksheet extends BIFFwriter } // No data to return - return false; + return ''; } /** @@ -640,11 +638,6 @@ class Worksheet extends BIFFwriter $this->outlineBelow = $symbols_below; $this->outlineRight = $symbols_right; $this->outlineStyle = $auto_style; - - // Ensure this is a boolean vale for Window2 - if ($this->outlineOn) { - $this->outlineOn = 1; - } } /** @@ -926,20 +919,14 @@ class Worksheet extends BIFFwriter * The hyperlink can be to a http, ftp, mail, internal sheet (not yet), or external * directory url. * - * Returns 0 : normal termination - * -2 : row or column out of range - * -3 : long string truncated to 255 chars - * * @param int $row Row * @param int $col Column * @param string $url URL string - * - * @return int */ - private function writeUrl($row, $col, $url) + private function writeUrl($row, $col, $url): void { // Add start row and col to arg list - return $this->writeUrlRange($row, $col, $row, $col, $url); + $this->writeUrlRange($row, $col, $row, $col, $url); } /** @@ -954,21 +941,19 @@ class Worksheet extends BIFFwriter * @param int $col2 End column * @param string $url URL string * - * @return int - * * @see writeUrl() */ - public function writeUrlRange($row1, $col1, $row2, $col2, $url) + private function writeUrlRange($row1, $col1, $row2, $col2, $url): void { // Check for internal/external sheet links or default to web link if (preg_match('[^internal:]', $url)) { - return $this->writeUrlInternal($row1, $col1, $row2, $col2, $url); + $this->writeUrlInternal($row1, $col1, $row2, $col2, $url); } if (preg_match('[^external:]', $url)) { - return $this->writeUrlExternal($row1, $col1, $row2, $col2, $url); + $this->writeUrlExternal($row1, $col1, $row2, $col2, $url); } - return $this->writeUrlWeb($row1, $col1, $row2, $col2, $url); + $this->writeUrlWeb($row1, $col1, $row2, $col2, $url); } /** @@ -982,14 +967,11 @@ class Worksheet extends BIFFwriter * @param int $col2 End column * @param string $url URL string * - * @return int - * * @see writeUrl() */ - public function writeUrlWeb($row1, $col1, $row2, $col2, $url) + public function writeUrlWeb($row1, $col1, $row2, $col2, $url): void { $record = 0x01B8; // Record identifier - $length = 0x00000; // Bytes to follow // Pack the undocumented parts of the hyperlink stream $unknown1 = pack('H*', 'D0C9EA79F9BACE118C8200AA004BA90B02000000'); @@ -1014,8 +996,6 @@ class Worksheet extends BIFFwriter // Write the packed data $this->append($header . $data . $unknown1 . $options . $unknown2 . $url_len . $url); - - return 0; } /** @@ -1027,14 +1007,11 @@ class Worksheet extends BIFFwriter * @param int $col2 End column * @param string $url URL string * - * @return int - * * @see writeUrl() */ - public function writeUrlInternal($row1, $col1, $row2, $col2, $url) + private function writeUrlInternal($row1, $col1, $row2, $col2, $url): void { $record = 0x01B8; // Record identifier - $length = 0x00000; // Bytes to follow // Strip URL type $url = preg_replace('/^internal:/', '', $url); @@ -1063,8 +1040,6 @@ class Worksheet extends BIFFwriter // Write the packed data $this->append($header . $data . $unknown1 . $options . $url_len . $url); - - return 0; } /** @@ -1080,16 +1055,14 @@ class Worksheet extends BIFFwriter * @param int $col2 End column * @param string $url URL string * - * @return int - * * @see writeUrl() */ - public function writeUrlExternal($row1, $col1, $row2, $col2, $url) + private function writeUrlExternal($row1, $col1, $row2, $col2, $url): void { // Network drives are different. We will handle them separately // MS/Novell network drives and shares start with \\ if (preg_match('[^external:\\\\]', $url)) { - return; //($this->writeUrlExternal_net($row1, $col1, $row2, $col2, $url, $str, $format)); + return; } $record = 0x01B8; // Record identifier @@ -1165,8 +1138,6 @@ class Worksheet extends BIFFwriter // Write the packed data $this->append($header . $data); - - return 0; } /** diff --git a/src/PhpSpreadsheet/Writer/Xls/Xf.php b/src/PhpSpreadsheet/Writer/Xls/Xf.php index eca3d8e0..6f1d1cb2 100644 --- a/src/PhpSpreadsheet/Writer/Xls/Xf.php +++ b/src/PhpSpreadsheet/Writer/Xls/Xf.php @@ -362,7 +362,7 @@ class Xf /** * Map of BIFF2-BIFF8 codes for border styles. * - * @var array of int + * @var int[] */ private static $mapBorderStyles = [ Border::BORDER_NONE => 0x00, @@ -396,7 +396,7 @@ class Xf /** * Map of BIFF2-BIFF8 codes for fill types. * - * @var array of int + * @var int[] */ private static $mapFillTypes = [ Fill::FILL_NONE => 0x00, @@ -437,7 +437,7 @@ class Xf /** * Map of BIFF2-BIFF8 codes for horizontal alignment. * - * @var array of int + * @var int[] */ private static $mapHAlignments = [ Alignment::HORIZONTAL_GENERAL => 0, @@ -464,7 +464,7 @@ class Xf /** * Map of BIFF2-BIFF8 codes for vertical alignment. * - * @var array of int + * @var int[] */ private static $mapVAlignments = [ Alignment::VERTICAL_TOP => 0, diff --git a/src/PhpSpreadsheet/Writer/Xlsx.php b/src/PhpSpreadsheet/Writer/Xlsx.php index 61351ed8..27ceb559 100644 --- a/src/PhpSpreadsheet/Writer/Xlsx.php +++ b/src/PhpSpreadsheet/Writer/Xlsx.php @@ -200,12 +200,19 @@ class Xlsx extends BaseWriter $this->writerPartWorksheet = new Worksheet($this); // Set HashTable variables + // @phpstan-ignore-next-line $this->bordersHashTable = new HashTable(); + // @phpstan-ignore-next-line $this->drawingHashTable = new HashTable(); + // @phpstan-ignore-next-line $this->fillHashTable = new HashTable(); + // @phpstan-ignore-next-line $this->fontHashTable = new HashTable(); + // @phpstan-ignore-next-line $this->numFmtHashTable = new HashTable(); + // @phpstan-ignore-next-line $this->styleHashTable = new HashTable(); + // @phpstan-ignore-next-line $this->stylesConditionalHashTable = new HashTable(); } diff --git a/src/PhpSpreadsheet/Writer/Xlsx/DocProps.php b/src/PhpSpreadsheet/Writer/Xlsx/DocProps.php index bcbc2379..6332a34d 100644 --- a/src/PhpSpreadsheet/Writer/Xlsx/DocProps.php +++ b/src/PhpSpreadsheet/Writer/Xlsx/DocProps.php @@ -170,13 +170,13 @@ class DocProps extends WriterPart /** * Write docProps/custom.xml to XML format. * - * @return string XML Output + * @return null|string XML Output */ public function writeDocPropsCustom(Spreadsheet $spreadsheet) { $customPropertyList = $spreadsheet->getProperties()->getCustomProperties(); if (empty($customPropertyList)) { - return; + return null; } // Create XML writer diff --git a/src/PhpSpreadsheet/Writer/Xlsx/Theme.php b/src/PhpSpreadsheet/Writer/Xlsx/Theme.php index dfde302c..99177292 100644 --- a/src/PhpSpreadsheet/Writer/Xlsx/Theme.php +++ b/src/PhpSpreadsheet/Writer/Xlsx/Theme.php @@ -10,7 +10,7 @@ class Theme extends WriterPart /** * Map of Major fonts to write. * - * @var array of string + * @var string[] */ private static $majorFonts = [ 'Jpan' => 'MS Pゴシック', @@ -48,7 +48,7 @@ class Theme extends WriterPart /** * Map of Minor fonts to write. * - * @var array of string + * @var string[] */ private static $minorFonts = [ 'Jpan' => 'MS Pゴシック', @@ -86,7 +86,7 @@ class Theme extends WriterPart /** * Map of core colours. * - * @var array of string + * @var string[] */ private static $colourScheme = [ 'dk2' => '1F497D', diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImConjugateTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImConjugateTest.php index bc3a3918..af96c18e 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImConjugateTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImConjugateTest.php @@ -22,11 +22,6 @@ class ImConjugateTest extends TestCase $this->complexAssert = new ComplexAssert(); } - protected function tearDown(): void - { - $this->complexAssert = null; - } - /** * @dataProvider providerIMCONJUGATE * diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImCosTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImCosTest.php index 693f0bab..c00bafda 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImCosTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImCosTest.php @@ -22,11 +22,6 @@ class ImCosTest extends TestCase $this->complexAssert = new ComplexAssert(); } - protected function tearDown(): void - { - $this->complexAssert = null; - } - /** * @dataProvider providerIMCOS * diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImCoshTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImCoshTest.php index ae035fef..6f84217a 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImCoshTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImCoshTest.php @@ -22,11 +22,6 @@ class ImCoshTest extends TestCase $this->complexAssert = new ComplexAssert(); } - protected function tearDown(): void - { - $this->complexAssert = null; - } - /** * @dataProvider providerIMCOSH * diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImCotTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImCotTest.php index 8b888b3f..cbadfd8a 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImCotTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImCotTest.php @@ -22,11 +22,6 @@ class ImCotTest extends TestCase $this->complexAssert = new ComplexAssert(); } - protected function tearDown(): void - { - $this->complexAssert = null; - } - /** * @dataProvider providerIMCOT * diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImCscTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImCscTest.php index 5a08c0b6..65782e32 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImCscTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImCscTest.php @@ -22,11 +22,6 @@ class ImCscTest extends TestCase $this->complexAssert = new ComplexAssert(); } - protected function tearDown(): void - { - $this->complexAssert = null; - } - /** * @dataProvider providerIMCSC * diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImCschTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImCschTest.php index a95a4eaf..ef1c06ea 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImCschTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImCschTest.php @@ -22,11 +22,6 @@ class ImCschTest extends TestCase $this->complexAssert = new ComplexAssert(); } - protected function tearDown(): void - { - $this->complexAssert = null; - } - /** * @dataProvider providerIMCSCH * diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImDivTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImDivTest.php index 2bc91619..0943f408 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImDivTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImDivTest.php @@ -22,11 +22,6 @@ class ImDivTest extends TestCase $this->complexAssert = new ComplexAssert(); } - protected function tearDown(): void - { - $this->complexAssert = null; - } - /** * @dataProvider providerIMDIV * diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImExpTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImExpTest.php index 7debbc9c..5f5edfd3 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImExpTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImExpTest.php @@ -22,11 +22,6 @@ class ImExpTest extends TestCase $this->complexAssert = new ComplexAssert(); } - protected function tearDown(): void - { - $this->complexAssert = null; - } - /** * @dataProvider providerIMEXP * diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImLnTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImLnTest.php index 3e270975..36ca116a 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImLnTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImLnTest.php @@ -22,11 +22,6 @@ class ImLnTest extends TestCase $this->complexAssert = new ComplexAssert(); } - protected function tearDown(): void - { - $this->complexAssert = null; - } - /** * @dataProvider providerIMLN * diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImLog10Test.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImLog10Test.php index 2a4db7fb..9a37d85c 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImLog10Test.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImLog10Test.php @@ -22,11 +22,6 @@ class ImLog10Test extends TestCase $this->complexAssert = new ComplexAssert(); } - protected function tearDown(): void - { - $this->complexAssert = null; - } - /** * @dataProvider providerIMLOG10 * diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImLog2Test.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImLog2Test.php index 53b302dd..f0d853ba 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImLog2Test.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImLog2Test.php @@ -22,11 +22,6 @@ class ImLog2Test extends TestCase $this->complexAssert = new ComplexAssert(); } - protected function tearDown(): void - { - $this->complexAssert = null; - } - /** * @dataProvider providerIMLOG2 * diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImPowerTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImPowerTest.php index 41e52878..4493515c 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImPowerTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImPowerTest.php @@ -22,11 +22,6 @@ class ImPowerTest extends TestCase $this->complexAssert = new ComplexAssert(); } - protected function tearDown(): void - { - $this->complexAssert = null; - } - /** * @dataProvider providerIMPOWER * diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImProductTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImProductTest.php index 43495739..395153ed 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImProductTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImProductTest.php @@ -22,11 +22,6 @@ class ImProductTest extends TestCase $this->complexAssert = new ComplexAssert(); } - protected function tearDown(): void - { - $this->complexAssert = null; - } - /** * @dataProvider providerIMPRODUCT * diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImSecTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImSecTest.php index e785d3ac..bd9c6df0 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImSecTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImSecTest.php @@ -22,11 +22,6 @@ class ImSecTest extends TestCase $this->complexAssert = new ComplexAssert(); } - protected function tearDown(): void - { - $this->complexAssert = null; - } - /** * @dataProvider providerIMSEC * diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImSechTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImSechTest.php index 22cb6fae..b81e0305 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImSechTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImSechTest.php @@ -22,11 +22,6 @@ class ImSechTest extends TestCase $this->complexAssert = new ComplexAssert(); } - protected function tearDown(): void - { - $this->complexAssert = null; - } - /** * @dataProvider providerIMSECH * diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImSinTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImSinTest.php index dd797a35..d83980e0 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImSinTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImSinTest.php @@ -22,11 +22,6 @@ class ImSinTest extends TestCase $this->complexAssert = new ComplexAssert(); } - protected function tearDown(): void - { - $this->complexAssert = null; - } - /** * @dataProvider providerIMSIN * diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImSinhTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImSinhTest.php index 4174d1c0..107c0949 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImSinhTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImSinhTest.php @@ -22,11 +22,6 @@ class ImSinhTest extends TestCase $this->complexAssert = new ComplexAssert(); } - protected function tearDown(): void - { - $this->complexAssert = null; - } - /** * @dataProvider providerIMSINH * diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImSqrtTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImSqrtTest.php index 091b11c5..c8c83e10 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImSqrtTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImSqrtTest.php @@ -22,11 +22,6 @@ class ImSqrtTest extends TestCase $this->complexAssert = new ComplexAssert(); } - protected function tearDown(): void - { - $this->complexAssert = null; - } - /** * @dataProvider providerIMSQRT * diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImSubTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImSubTest.php index 79286120..b2b8394e 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImSubTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImSubTest.php @@ -22,11 +22,6 @@ class ImSubTest extends TestCase $this->complexAssert = new ComplexAssert(); } - protected function tearDown(): void - { - $this->complexAssert = null; - } - /** * @dataProvider providerIMSUB * diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImSumTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImSumTest.php index 8abc3638..872c73c8 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImSumTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImSumTest.php @@ -22,11 +22,6 @@ class ImSumTest extends TestCase $this->complexAssert = new ComplexAssert(); } - protected function tearDown(): void - { - $this->complexAssert = null; - } - /** * @dataProvider providerIMSUM * diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImTanTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImTanTest.php index 57b23815..9bf6b66c 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImTanTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImTanTest.php @@ -22,11 +22,6 @@ class ImTanTest extends TestCase $this->complexAssert = new ComplexAssert(); } - protected function tearDown(): void - { - $this->complexAssert = null; - } - /** * @dataProvider providerIMTAN * diff --git a/tests/PhpSpreadsheetTests/SettingsTest.php b/tests/PhpSpreadsheetTests/SettingsTest.php index 92f3bb1f..7641f3da 100644 --- a/tests/PhpSpreadsheetTests/SettingsTest.php +++ b/tests/PhpSpreadsheetTests/SettingsTest.php @@ -8,7 +8,7 @@ use PHPUnit\Framework\TestCase; class SettingsTest extends TestCase { /** - * @var string + * @var bool */ protected $prevValue;