diff --git a/src/PhpSpreadsheet/Calculation/Engine/BranchPruner.php b/src/PhpSpreadsheet/Calculation/Engine/BranchPruner.php index 29bf85280..09a1a251d 100644 --- a/src/PhpSpreadsheet/Calculation/Engine/BranchPruner.php +++ b/src/PhpSpreadsheet/Calculation/Engine/BranchPruner.php @@ -47,20 +47,11 @@ class BranchPruner */ protected $braceDepthMap = []; - /** - * @var null|string - */ - protected $currentCondition; + protected ?string $currentCondition = null; - /** - * @var null|string - */ - protected $currentOnlyIf; + protected ?string $currentOnlyIf = null; - /** - * @var null|string - */ - protected $currentOnlyIfNot; + protected ?string $currentOnlyIfNot = null; /** * @var null|string diff --git a/src/PhpSpreadsheet/Calculation/Financial/CashFlow/Constant/Periodic/InterestAndPrincipal.php b/src/PhpSpreadsheet/Calculation/Financial/CashFlow/Constant/Periodic/InterestAndPrincipal.php index f21eb55a3..ea9abb982 100644 --- a/src/PhpSpreadsheet/Calculation/Financial/CashFlow/Constant/Periodic/InterestAndPrincipal.php +++ b/src/PhpSpreadsheet/Calculation/Financial/CashFlow/Constant/Periodic/InterestAndPrincipal.php @@ -6,8 +6,7 @@ use PhpOffice\PhpSpreadsheet\Calculation\Financial\Constants as FinancialConstan class InterestAndPrincipal { - /** @var float */ - protected $interest; + protected float $interest; protected float $principal; diff --git a/src/PhpSpreadsheet/Cell/CellAddress.php b/src/PhpSpreadsheet/Cell/CellAddress.php index 7ec25724e..fb8ca9fbb 100644 --- a/src/PhpSpreadsheet/Cell/CellAddress.php +++ b/src/PhpSpreadsheet/Cell/CellAddress.php @@ -9,25 +9,13 @@ class CellAddress { protected ?\PhpOffice\PhpSpreadsheet\Worksheet\Worksheet $worksheet; - /** - * @var string - */ - protected $cellAddress; + protected string $cellAddress; - /** - * @var string - */ - protected $columnName; + protected string $columnName = ''; - /** - * @var int - */ - protected $columnId; + protected int $columnId; - /** - * @var int - */ - protected $rowId; + protected int $rowId; public function __construct(string $cellAddress, ?Worksheet $worksheet = null) { diff --git a/src/PhpSpreadsheet/Cell/ColumnRange.php b/src/PhpSpreadsheet/Cell/ColumnRange.php index 7461e6736..9c0a000e5 100644 --- a/src/PhpSpreadsheet/Cell/ColumnRange.php +++ b/src/PhpSpreadsheet/Cell/ColumnRange.php @@ -8,15 +8,9 @@ class ColumnRange implements AddressRange { protected ?\PhpOffice\PhpSpreadsheet\Worksheet\Worksheet $worksheet; - /** - * @var int - */ - protected $from; + protected int $from; - /** - * @var int - */ - protected $to; + protected int $to; public function __construct(string $from, ?string $to = null, ?Worksheet $worksheet = null) { diff --git a/src/PhpSpreadsheet/Cell/DataValidation.php b/src/PhpSpreadsheet/Cell/DataValidation.php index 969c65be0..21d41c8dc 100644 --- a/src/PhpSpreadsheet/Cell/DataValidation.php +++ b/src/PhpSpreadsheet/Cell/DataValidation.php @@ -480,8 +480,7 @@ class DataValidation } } - /** @var ?string */ - private $sqref; + private ?string $sqref = null; public function getSqref(): ?string { diff --git a/src/PhpSpreadsheet/Cell/RowRange.php b/src/PhpSpreadsheet/Cell/RowRange.php index 8aa642551..0ba10ca6b 100644 --- a/src/PhpSpreadsheet/Cell/RowRange.php +++ b/src/PhpSpreadsheet/Cell/RowRange.php @@ -8,15 +8,9 @@ class RowRange implements AddressRange { protected ?\PhpOffice\PhpSpreadsheet\Worksheet\Worksheet $worksheet; - /** - * @var int - */ - protected $from; + protected int $from; - /** - * @var int - */ - protected $to; + protected int $to; public function __construct(int $from, ?int $to = null, ?Worksheet $worksheet = null) { diff --git a/src/PhpSpreadsheet/CellReferenceHelper.php b/src/PhpSpreadsheet/CellReferenceHelper.php index a89329bf9..2bb0c8a2d 100644 --- a/src/PhpSpreadsheet/CellReferenceHelper.php +++ b/src/PhpSpreadsheet/CellReferenceHelper.php @@ -7,10 +7,7 @@ use PhpOffice\PhpSpreadsheet\Cell\Coordinate; class CellReferenceHelper { - /** - * @var string - */ - protected $beforeCellAddress; + protected string $beforeCellAddress; protected int $beforeColumn; diff --git a/src/PhpSpreadsheet/Chart/Axis.php b/src/PhpSpreadsheet/Chart/Axis.php index 866014022..b9c7475af 100644 --- a/src/PhpSpreadsheet/Chart/Axis.php +++ b/src/PhpSpreadsheet/Chart/Axis.php @@ -26,17 +26,13 @@ class Axis extends Properties /** * Chart Major Gridlines as. - * - * @var ?GridLines */ - private $majorGridlines; + private ?\PhpOffice\PhpSpreadsheet\Chart\GridLines $majorGridlines = null; /** * Chart Minor Gridlines as. - * - * @var ?GridLines */ - private $minorGridlines; + private ?\PhpOffice\PhpSpreadsheet\Chart\GridLines $minorGridlines = null; /** * Axis Number. @@ -49,11 +45,9 @@ class Axis extends Properties 'numeric' => null, ]; - /** @var string */ - private $axisType = ''; + private string $axisType = ''; - /** @var ?AxisText */ - private $axisText; + private ?\PhpOffice\PhpSpreadsheet\Chart\AxisText $axisText = null; /** * Axis Options. @@ -265,8 +259,7 @@ class Axis extends Properties return $this->getLineColorProperty($propertyName); } - /** @var string */ - private $crossBetween = ''; // 'between' or 'midCat' might be better + private string $crossBetween = ''; // 'between' or 'midCat' might be better public function setCrossBetween(string $crossBetween): self { diff --git a/src/PhpSpreadsheet/Chart/AxisText.php b/src/PhpSpreadsheet/Chart/AxisText.php index 796be04a4..c3b2d3b24 100644 --- a/src/PhpSpreadsheet/Chart/AxisText.php +++ b/src/PhpSpreadsheet/Chart/AxisText.php @@ -6,8 +6,7 @@ use PhpOffice\PhpSpreadsheet\Style\Font; class AxisText extends Properties { - /** @var ?int */ - private $rotation; + private ?int $rotation = null; private \PhpOffice\PhpSpreadsheet\Style\Font $font; diff --git a/src/PhpSpreadsheet/Chart/Chart.php b/src/PhpSpreadsheet/Chart/Chart.php index b390e5ab9..9f78962a4 100644 --- a/src/PhpSpreadsheet/Chart/Chart.php +++ b/src/PhpSpreadsheet/Chart/Chart.php @@ -16,10 +16,8 @@ class Chart /** * Worksheet. - * - * @var ?Worksheet */ - private $worksheet; + private ?\PhpOffice\PhpSpreadsheet\Worksheet\Worksheet $worksheet = null; /** * Chart Title. @@ -93,10 +91,8 @@ class Chart /** * Bottom-Right Cell Position. - * - * @var string */ - private $bottomRightCellRef = ''; + private string $bottomRightCellRef = ''; /** * Bottom-Right X-Offset. @@ -112,17 +108,13 @@ class Chart */ private $bottomRightYOffset = 10; - /** @var ?int */ - private $rotX; + private ?int $rotX = null; - /** @var ?int */ - private $rotY; + private ?int $rotY = null; - /** @var ?int */ - private $rAngAx; + private ?int $rAngAx = null; - /** @var ?int */ - private $perspective; + private ?int $perspective = null; /** @var bool */ private $oneCellAnchor = false; diff --git a/src/PhpSpreadsheet/Chart/ChartColor.php b/src/PhpSpreadsheet/Chart/ChartColor.php index 87f310200..df08adb5d 100644 --- a/src/PhpSpreadsheet/Chart/ChartColor.php +++ b/src/PhpSpreadsheet/Chart/ChartColor.php @@ -15,17 +15,13 @@ class ChartColor self::EXCEL_COLOR_TYPE_STANDARD, ]; - /** @var string */ - private $value = ''; + private string $value = ''; - /** @var string */ - private $type = ''; + private string $type = ''; - /** @var ?int */ - private $alpha; + private ?int $alpha = null; - /** @var ?int */ - private $brightness; + private ?int $brightness = null; /** * @param string|string[] $value diff --git a/src/PhpSpreadsheet/Chart/DataSeriesValues.php b/src/PhpSpreadsheet/Chart/DataSeriesValues.php index b8c9f45a3..31a49d949 100644 --- a/src/PhpSpreadsheet/Chart/DataSeriesValues.php +++ b/src/PhpSpreadsheet/Chart/DataSeriesValues.php @@ -83,8 +83,7 @@ class DataSeriesValues extends Properties /** @var bool */ private $bubble3D = false; - /** @var ?Layout */ - private $labelLayout; + private ?\PhpOffice\PhpSpreadsheet\Chart\Layout $labelLayout = null; /** @var TrendLine[] */ private $trendLines = []; diff --git a/src/PhpSpreadsheet/Chart/Legend.php b/src/PhpSpreadsheet/Chart/Legend.php index 6e31a5eaa..9d21ee51a 100644 --- a/src/PhpSpreadsheet/Chart/Legend.php +++ b/src/PhpSpreadsheet/Chart/Legend.php @@ -50,8 +50,7 @@ class Legend private \PhpOffice\PhpSpreadsheet\Chart\ChartColor $fillColor; - /** @var ?AxisText */ - private $legendText; + private ?\PhpOffice\PhpSpreadsheet\Chart\AxisText $legendText = null; /** * Create a new Legend. diff --git a/src/PhpSpreadsheet/Chart/PlotArea.php b/src/PhpSpreadsheet/Chart/PlotArea.php index e6c816308..168de8b13 100644 --- a/src/PhpSpreadsheet/Chart/PlotArea.php +++ b/src/PhpSpreadsheet/Chart/PlotArea.php @@ -25,10 +25,8 @@ class PlotArea /** * PlotArea Gradient Angle. - * - * @var ?float */ - private $gradientFillAngle; + private ?float $gradientFillAngle = null; /** * PlotArea Layout. @@ -162,8 +160,7 @@ class PlotArea return $this->gradientFillStops; } - /** @var ?int */ - private $gapWidth; + private ?int $gapWidth = null; /** @var bool */ private $useUpBars = false; diff --git a/src/PhpSpreadsheet/Chart/Properties.php b/src/PhpSpreadsheet/Chart/Properties.php index a97b803bd..f6c953122 100644 --- a/src/PhpSpreadsheet/Chart/Properties.php +++ b/src/PhpSpreadsheet/Chart/Properties.php @@ -125,8 +125,7 @@ abstract class Properties /** @var ?float */ protected $glowSize; - /** @var ChartColor */ - protected $glowColor; + protected \PhpOffice\PhpSpreadsheet\Chart\ChartColor $glowColor; /** @var array */ protected $softEdges = [ @@ -731,8 +730,7 @@ abstract class Properties return $array; } - /** @var ChartColor */ - protected $lineColor; + protected \PhpOffice\PhpSpreadsheet\Chart\ChartColor $lineColor; /** @var array */ protected $lineStyleProperties = [ diff --git a/src/PhpSpreadsheet/Chart/TrendLine.php b/src/PhpSpreadsheet/Chart/TrendLine.php index 75a5896c9..7ea2bde81 100644 --- a/src/PhpSpreadsheet/Chart/TrendLine.php +++ b/src/PhpSpreadsheet/Chart/TrendLine.php @@ -19,8 +19,7 @@ class TrendLine extends Properties self::TRENDLINE_MOVING_AVG, ]; - /** @var string */ - private $trendLineType = 'linear'; // TRENDLINE_LINEAR + private string $trendLineType = 'linear'; // TRENDLINE_LINEAR /** @var int */ private $order = 2; @@ -34,8 +33,7 @@ class TrendLine extends Properties /** @var bool */ private $dispEq = false; - /** @var string */ - private $name = ''; + private string $name = ''; /** @var float */ private $backward = 0.0; diff --git a/src/PhpSpreadsheet/Comment.php b/src/PhpSpreadsheet/Comment.php index 201f4348b..4759fcbe6 100644 --- a/src/PhpSpreadsheet/Comment.php +++ b/src/PhpSpreadsheet/Comment.php @@ -24,24 +24,18 @@ class Comment implements IComparable /** * Comment width (CSS style, i.e. XXpx or YYpt). - * - * @var string */ - private $width = '96pt'; + private string $width = '96pt'; /** * Left margin (CSS style, i.e. XXpx or YYpt). - * - * @var string */ - private $marginLeft = '59.25pt'; + private string $marginLeft = '59.25pt'; /** * Top margin (CSS style, i.e. XXpx or YYpt). - * - * @var string */ - private $marginTop = '1.5pt'; + private string $marginTop = '1.5pt'; /** * Visible. @@ -52,10 +46,8 @@ class Comment implements IComparable /** * Comment height (CSS style, i.e. XXpx or YYpt). - * - * @var string */ - private $height = '55.5pt'; + private string $height = '55.5pt'; /** * Comment fill color. diff --git a/src/PhpSpreadsheet/Document/Properties.php b/src/PhpSpreadsheet/Document/Properties.php index 5049c956f..a1c29fedb 100644 --- a/src/PhpSpreadsheet/Document/Properties.php +++ b/src/PhpSpreadsheet/Document/Properties.php @@ -25,17 +25,13 @@ class Properties /** * Creator. - * - * @var string */ - private $creator = 'Unknown Creator'; + private string $creator = 'Unknown Creator'; /** * LastModifiedBy. - * - * @var string */ - private $lastModifiedBy; + private string $lastModifiedBy; /** * Created. @@ -49,52 +45,38 @@ class Properties /** * Title. - * - * @var string */ - private $title = 'Untitled Spreadsheet'; + private string $title = 'Untitled Spreadsheet'; /** * Description. - * - * @var string */ - private $description = ''; + private string $description = ''; /** * Subject. - * - * @var string */ - private $subject = ''; + private string $subject = ''; /** * Keywords. - * - * @var string */ - private $keywords = ''; + private string $keywords = ''; /** * Category. - * - * @var string */ - private $category = ''; + private string $category = ''; /** * Manager. - * - * @var string */ - private $manager = ''; + private string $manager = ''; /** * Company. - * - * @var string */ - private $company = ''; + private string $company = ''; /** * Custom Properties. diff --git a/src/PhpSpreadsheet/Document/Security.php b/src/PhpSpreadsheet/Document/Security.php index 1f5625689..a97017b68 100644 --- a/src/PhpSpreadsheet/Document/Security.php +++ b/src/PhpSpreadsheet/Document/Security.php @@ -29,17 +29,13 @@ class Security /** * RevisionsPassword. - * - * @var string */ - private $revisionsPassword = ''; + private string $revisionsPassword = ''; /** * WorkbookPassword. - * - * @var string */ - private $workbookPassword = ''; + private string $workbookPassword = ''; /** * Create a new Document Security instance. diff --git a/src/PhpSpreadsheet/Reader/BaseReader.php b/src/PhpSpreadsheet/Reader/BaseReader.php index aa380aa95..da79c3a47 100644 --- a/src/PhpSpreadsheet/Reader/BaseReader.php +++ b/src/PhpSpreadsheet/Reader/BaseReader.php @@ -54,10 +54,7 @@ abstract class BaseReader implements IReader /** @var resource */ protected $fileHandle; - /** - * @var ?XmlScanner - */ - protected $securityScanner; + protected ?\PhpOffice\PhpSpreadsheet\Reader\Security\XmlScanner $securityScanner = null; public function __construct() { diff --git a/src/PhpSpreadsheet/Reader/Csv.php b/src/PhpSpreadsheet/Reader/Csv.php index be9a2a32c..02134abfd 100644 --- a/src/PhpSpreadsheet/Reader/Csv.php +++ b/src/PhpSpreadsheet/Reader/Csv.php @@ -32,10 +32,8 @@ class Csv extends BaseReader /** * Input encoding. - * - * @var string */ - private $inputEncoding = 'UTF-8'; + private string $inputEncoding = 'UTF-8'; /** * Fallback encoding if guess strikes out. @@ -46,17 +44,13 @@ class Csv extends BaseReader /** * Delimiter. - * - * @var ?string */ - private $delimiter; + private ?string $delimiter = null; /** * Enclosure. - * - * @var string */ - private $enclosure = '"'; + private string $enclosure = '"'; /** * Sheet index to read. @@ -74,10 +68,8 @@ class Csv extends BaseReader /** * The character that can escape the enclosure. - * - * @var string */ - private $escapeCharacter = '\\'; + private string $escapeCharacter = '\\'; /** * Callback for setting defaults in construction. diff --git a/src/PhpSpreadsheet/Reader/Xls.php b/src/PhpSpreadsheet/Reader/Xls.php index 938280850..4eb96b4c2 100644 --- a/src/PhpSpreadsheet/Reader/Xls.php +++ b/src/PhpSpreadsheet/Reader/Xls.php @@ -219,10 +219,8 @@ class Xls extends BaseReader /** * Codepage set in the Excel file being read. Only important for BIFF5 (Excel 5.0 - Excel 95) * For BIFF8 (Excel 97 - Excel 2003) this will always have the value 'UTF-16LE'. - * - * @var string */ - private $codepage = ''; + private string $codepage = ''; /** * Shared formats. diff --git a/src/PhpSpreadsheet/Shared/Escher/DgContainer.php b/src/PhpSpreadsheet/Shared/Escher/DgContainer.php index 51c6860cb..73496cb4e 100644 --- a/src/PhpSpreadsheet/Shared/Escher/DgContainer.php +++ b/src/PhpSpreadsheet/Shared/Escher/DgContainer.php @@ -8,20 +8,15 @@ class DgContainer { /** * Drawing index, 1-based. - * - * @var ?int */ - private $dgId; + private ?int $dgId = null; /** * Last shape index in this drawing. - * - * @var ?int */ - private $lastSpId; + private ?int $lastSpId = null; - /** @var ?DgContainer\SpgrContainer */ - private $spgrContainer; + private ?\PhpOffice\PhpSpreadsheet\Shared\Escher\DgContainer\SpgrContainer $spgrContainer = null; public function getDgId(): ?int { diff --git a/src/PhpSpreadsheet/Style/ConditionalFormatting/ConditionalDataBar.php b/src/PhpSpreadsheet/Style/ConditionalFormatting/ConditionalDataBar.php index c5c36aeb3..e0a511f16 100644 --- a/src/PhpSpreadsheet/Style/ConditionalFormatting/ConditionalDataBar.php +++ b/src/PhpSpreadsheet/Style/ConditionalFormatting/ConditionalDataBar.php @@ -9,21 +9,13 @@ class ConditionalDataBar /** @var null|bool */ private $showValue; - /** children */ + private ?\PhpOffice\PhpSpreadsheet\Style\ConditionalFormatting\ConditionalFormatValueObject $minimumConditionalFormatValueObject = null; - /** @var ?ConditionalFormatValueObject */ - private $minimumConditionalFormatValueObject; + private ?\PhpOffice\PhpSpreadsheet\Style\ConditionalFormatting\ConditionalFormatValueObject $maximumConditionalFormatValueObject = null; - /** @var ?ConditionalFormatValueObject */ - private $maximumConditionalFormatValueObject; + private string $color = ''; - /** @var string */ - private $color; - - /** */ - - /** @var ?ConditionalFormattingRuleExtension */ - private $conditionalFormattingRuleExt; + private ?\PhpOffice\PhpSpreadsheet\Style\ConditionalFormatting\ConditionalFormattingRuleExtension $conditionalFormattingRuleExt = null; /** * @return null|bool diff --git a/src/PhpSpreadsheet/Style/ConditionalFormatting/ConditionalFormattingRuleExtension.php b/src/PhpSpreadsheet/Style/ConditionalFormatting/ConditionalFormattingRuleExtension.php index a2a57e3e8..a35426a1c 100644 --- a/src/PhpSpreadsheet/Style/ConditionalFormatting/ConditionalFormattingRuleExtension.php +++ b/src/PhpSpreadsheet/Style/ConditionalFormatting/ConditionalFormattingRuleExtension.php @@ -14,13 +14,10 @@ class ConditionalFormattingRuleExtension /** @var string Conditional Formatting Rule */ private string $cfRule; - /** children */ - - /** @var ConditionalDataBarExtension */ - private $dataBar; + private \PhpOffice\PhpSpreadsheet\Style\ConditionalFormatting\ConditionalDataBarExtension $dataBar; /** @var string Sequence of References */ - private $sqref; + private string $sqref = ''; /** * ConditionalFormattingRuleExtension constructor. diff --git a/src/PhpSpreadsheet/Style/ConditionalFormatting/Wizard/WizardAbstract.php b/src/PhpSpreadsheet/Style/ConditionalFormatting/Wizard/WizardAbstract.php index 1af0504a6..e747cef4c 100644 --- a/src/PhpSpreadsheet/Style/ConditionalFormatting/Wizard/WizardAbstract.php +++ b/src/PhpSpreadsheet/Style/ConditionalFormatting/Wizard/WizardAbstract.php @@ -19,10 +19,7 @@ abstract class WizardAbstract */ protected $expression; - /** - * @var string - */ - protected $cellRange; + protected string $cellRange; /** * @var string diff --git a/src/PhpSpreadsheet/Theme.php b/src/PhpSpreadsheet/Theme.php index ab101f01e..ac4dbe560 100644 --- a/src/PhpSpreadsheet/Theme.php +++ b/src/PhpSpreadsheet/Theme.php @@ -4,11 +4,9 @@ namespace PhpOffice\PhpSpreadsheet; class Theme { - /** @var string */ - private $themeColorName = 'Office'; + private string $themeColorName = 'Office'; - /** @var string */ - private $themeFontName = 'Office'; + private string $themeFontName = 'Office'; public const COLOR_SCHEME_2013_PLUS_NAME = 'Office 2013+'; public const COLOR_SCHEME_2013_PLUS = [ @@ -45,23 +43,17 @@ class Theme /** @var string[] */ private $themeColors = self::COLOR_SCHEME_2007_2010; - /** @var string */ - private $majorFontLatin = 'Cambria'; + private string $majorFontLatin = 'Cambria'; - /** @var string */ - private $majorFontEastAsian = ''; + private string $majorFontEastAsian = ''; - /** @var string */ - private $majorFontComplexScript = ''; + private string $majorFontComplexScript = ''; - /** @var string */ - private $minorFontLatin = 'Calibri'; + private string $minorFontLatin = 'Calibri'; - /** @var string */ - private $minorFontEastAsian = ''; + private string $minorFontEastAsian = ''; - /** @var string */ - private $minorFontComplexScript = ''; + private string $minorFontComplexScript = ''; /** * Map of Major (header) fonts to write. diff --git a/src/PhpSpreadsheet/Worksheet/BaseDrawing.php b/src/PhpSpreadsheet/Worksheet/BaseDrawing.php index 06c4511fe..962c45a20 100644 --- a/src/PhpSpreadsheet/Worksheet/BaseDrawing.php +++ b/src/PhpSpreadsheet/Worksheet/BaseDrawing.php @@ -20,10 +20,8 @@ class BaseDrawing implements IComparable /** * The editAs attribute, used only with two cell anchor. - * - * @var string */ - protected $editAs = ''; + protected string $editAs = ''; /** * Image counter. @@ -39,31 +37,23 @@ class BaseDrawing implements IComparable /** * Name. - * - * @var string */ - protected $name = ''; + protected string $name = ''; /** * Description. - * - * @var string */ - protected $description = ''; + protected string $description = ''; /** * Worksheet. - * - * @var null|Worksheet */ - protected $worksheet; + protected ?\PhpOffice\PhpSpreadsheet\Worksheet\Worksheet $worksheet = null; /** * Coordinates. - * - * @var string */ - protected $coordinates = 'A1'; + protected string $coordinates = 'A1'; /** * Offset X. @@ -81,10 +71,8 @@ class BaseDrawing implements IComparable /** * Coordinates2. - * - * @var string */ - protected $coordinates2 = ''; + protected string $coordinates2 = ''; /** * Offset X2. @@ -144,10 +132,8 @@ class BaseDrawing implements IComparable /** * Shadow. - * - * @var Drawing\Shadow */ - protected $shadow; + protected \PhpOffice\PhpSpreadsheet\Worksheet\Drawing\Shadow $shadow; /** * Image hyperlink. diff --git a/src/PhpSpreadsheet/Worksheet/Column.php b/src/PhpSpreadsheet/Worksheet/Column.php index 077ba5da9..d2bbffb3a 100644 --- a/src/PhpSpreadsheet/Worksheet/Column.php +++ b/src/PhpSpreadsheet/Worksheet/Column.php @@ -4,19 +4,12 @@ namespace PhpOffice\PhpSpreadsheet\Worksheet; class Column { - /** - * \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet. - * - * @var Worksheet - */ - private $worksheet; + private ?Worksheet $worksheet; /** * Column index. - * - * @var string */ - private $columnIndex; + private string $columnIndex; /** * Create a new column. @@ -35,7 +28,6 @@ class Column */ public function __destruct() { - // @phpstan-ignore-next-line $this->worksheet = null; } @@ -55,7 +47,7 @@ class Column */ public function getCellIterator($startRow = 1, $endRow = null): ColumnCellIterator { - return new ColumnCellIterator($this->worksheet, $this->columnIndex, $startRow, $endRow); + return new ColumnCellIterator($this->getWorksheet(), $this->columnIndex, $startRow, $endRow); } /** @@ -116,6 +108,7 @@ class Column */ public function getWorksheet(): Worksheet { + // @phpstan-ignore-next-line return $this->worksheet; } } diff --git a/src/PhpSpreadsheet/Worksheet/ColumnCellIterator.php b/src/PhpSpreadsheet/Worksheet/ColumnCellIterator.php index b75d7a036..ba9312b49 100644 --- a/src/PhpSpreadsheet/Worksheet/ColumnCellIterator.php +++ b/src/PhpSpreadsheet/Worksheet/ColumnCellIterator.php @@ -13,10 +13,8 @@ class ColumnCellIterator extends CellIterator { /** * Current iterator position. - * - * @var int */ - private $currentRow; + private int $currentRow; /** * Column index. diff --git a/src/PhpSpreadsheet/Worksheet/ColumnDimension.php b/src/PhpSpreadsheet/Worksheet/ColumnDimension.php index 3c0ee2e4e..07f741342 100644 --- a/src/PhpSpreadsheet/Worksheet/ColumnDimension.php +++ b/src/PhpSpreadsheet/Worksheet/ColumnDimension.php @@ -9,10 +9,8 @@ class ColumnDimension extends Dimension { /** * Column index. - * - * @var ?string */ - private $columnIndex; + private ?string $columnIndex; /** * Column width. diff --git a/src/PhpSpreadsheet/Worksheet/Dimension.php b/src/PhpSpreadsheet/Worksheet/Dimension.php index 7f144063b..8549b1695 100644 --- a/src/PhpSpreadsheet/Worksheet/Dimension.php +++ b/src/PhpSpreadsheet/Worksheet/Dimension.php @@ -29,10 +29,8 @@ abstract class Dimension /** * Index to cellXf. Null value means row has no explicit cellXf format. - * - * @var null|int */ - private $xfIndex; + private ?int $xfIndex; /** * Create a new Dimension. diff --git a/src/PhpSpreadsheet/Worksheet/PageBreak.php b/src/PhpSpreadsheet/Worksheet/PageBreak.php index 2a0da4020..5099d8be0 100644 --- a/src/PhpSpreadsheet/Worksheet/PageBreak.php +++ b/src/PhpSpreadsheet/Worksheet/PageBreak.php @@ -10,8 +10,7 @@ class PageBreak { private int $breakType; - /** @var string */ - private $coordinate; + private string $coordinate; private int $maxColOrRow; diff --git a/src/PhpSpreadsheet/Worksheet/Protection.php b/src/PhpSpreadsheet/Worksheet/Protection.php index 57d79addf..958a18dc6 100644 --- a/src/PhpSpreadsheet/Worksheet/Protection.php +++ b/src/PhpSpreadsheet/Worksheet/Protection.php @@ -19,115 +19,83 @@ class Protection /** * Autofilters are locked when sheet is protected, default true. - * - * @var ?bool */ - private $autoFilter; + private ?bool $autoFilter = null; /** * Deleting columns is locked when sheet is protected, default true. - * - * @var ?bool */ - private $deleteColumns; + private ?bool $deleteColumns = null; /** * Deleting rows is locked when sheet is protected, default true. - * - * @var ?bool */ - private $deleteRows; + private ?bool $deleteRows = null; /** * Formatting cells is locked when sheet is protected, default true. - * - * @var ?bool */ - private $formatCells; + private ?bool $formatCells = null; /** * Formatting columns is locked when sheet is protected, default true. - * - * @var ?bool */ - private $formatColumns; + private ?bool $formatColumns = null; /** * Formatting rows is locked when sheet is protected, default true. - * - * @var ?bool */ - private $formatRows; + private ?bool $formatRows = null; /** * Inserting columns is locked when sheet is protected, default true. - * - * @var ?bool */ - private $insertColumns; + private ?bool $insertColumns = null; /** * Inserting hyperlinks is locked when sheet is protected, default true. - * - * @var ?bool */ - private $insertHyperlinks; + private ?bool $insertHyperlinks = null; /** * Inserting rows is locked when sheet is protected, default true. - * - * @var ?bool */ - private $insertRows; + private ?bool $insertRows = null; /** * Objects are locked when sheet is protected, default false. - * - * @var ?bool */ - private $objects; + private ?bool $objects = null; /** * Pivot tables are locked when the sheet is protected, default true. - * - * @var ?bool */ - private $pivotTables; + private ?bool $pivotTables = null; /** * Scenarios are locked when sheet is protected, default false. - * - * @var ?bool */ - private $scenarios; + private ?bool $scenarios = null; /** * Selection of locked cells is locked when sheet is protected, default false. - * - * @var ?bool */ - private $selectLockedCells; + private ?bool $selectLockedCells = null; /** * Selection of unlocked cells is locked when sheet is protected, default false. - * - * @var ?bool */ - private $selectUnlockedCells; + private ?bool $selectUnlockedCells = null; /** * Sheet is locked when sheet is protected, default false. - * - * @var ?bool */ - private $sheet; + private ?bool $sheet = null; /** * Sorting is locked when sheet is protected, default true. - * - * @var ?bool */ - private $sort; + private ?bool $sort = null; /** * Hashed password. @@ -138,17 +106,13 @@ class Protection /** * Algorithm name. - * - * @var string */ - private $algorithm = ''; + private string $algorithm = ''; /** * Salt value. - * - * @var string */ - private $salt = ''; + private string $salt = ''; /** * Spin count. diff --git a/src/PhpSpreadsheet/Worksheet/Row.php b/src/PhpSpreadsheet/Worksheet/Row.php index b5f08816b..4d8ad57e3 100644 --- a/src/PhpSpreadsheet/Worksheet/Row.php +++ b/src/PhpSpreadsheet/Worksheet/Row.php @@ -4,12 +4,7 @@ namespace PhpOffice\PhpSpreadsheet\Worksheet; class Row { - /** - * \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet. - * - * @var Worksheet - */ - private $worksheet; + private ?Worksheet $worksheet; /** * Row index. @@ -35,7 +30,7 @@ class Row */ public function __destruct() { - $this->worksheet = null; // @phpstan-ignore-line + $this->worksheet = null; } /** @@ -54,7 +49,7 @@ class Row */ public function getCellIterator($startColumn = 'A', $endColumn = null): RowCellIterator { - return new RowCellIterator($this->worksheet, $this->rowIndex, $startColumn, $endColumn); + return new RowCellIterator($this->getWorksheet(), $this->rowIndex, $startColumn, $endColumn); } /** @@ -115,6 +110,7 @@ class Row */ public function getWorksheet(): Worksheet { + // @phpstan-ignore-next-line return $this->worksheet; } } diff --git a/src/PhpSpreadsheet/Worksheet/RowCellIterator.php b/src/PhpSpreadsheet/Worksheet/RowCellIterator.php index e1563c33c..4174fd223 100644 --- a/src/PhpSpreadsheet/Worksheet/RowCellIterator.php +++ b/src/PhpSpreadsheet/Worksheet/RowCellIterator.php @@ -13,10 +13,8 @@ class RowCellIterator extends CellIterator { /** * Current iterator position. - * - * @var int */ - private $currentColumnIndex; + private int $currentColumnIndex; /** * Row index. diff --git a/src/PhpSpreadsheet/Worksheet/RowDimension.php b/src/PhpSpreadsheet/Worksheet/RowDimension.php index da839483b..b3c213a96 100644 --- a/src/PhpSpreadsheet/Worksheet/RowDimension.php +++ b/src/PhpSpreadsheet/Worksheet/RowDimension.php @@ -8,10 +8,8 @@ class RowDimension extends Dimension { /** * Row index. - * - * @var ?int */ - private $rowIndex; + private ?int $rowIndex; /** * Row height (in pt). diff --git a/src/PhpSpreadsheet/Worksheet/Table.php b/src/PhpSpreadsheet/Worksheet/Table.php index 7de64d953..433081056 100644 --- a/src/PhpSpreadsheet/Worksheet/Table.php +++ b/src/PhpSpreadsheet/Worksheet/Table.php @@ -14,10 +14,8 @@ class Table { /** * Table Name. - * - * @var string */ - private $name; + private string $name; /** * Show Header Row. @@ -35,17 +33,13 @@ class Table /** * Table Range. - * - * @var string */ - private $range = ''; + private string $range = ''; /** * Table Worksheet. - * - * @var null|Worksheet */ - private $workSheet; + private ?\PhpOffice\PhpSpreadsheet\Worksheet\Worksheet $workSheet = null; /** * Table allow filter. @@ -166,7 +160,7 @@ class Table private function updateStructuredReferences(string $name): void { - if ($this->workSheet === null || $this->name === null || $this->name === '') { + if (!$this->workSheet || !$this->name) { return; } diff --git a/src/PhpSpreadsheet/Worksheet/Table/Column.php b/src/PhpSpreadsheet/Worksheet/Table/Column.php index 62b6765ab..c448a7434 100644 --- a/src/PhpSpreadsheet/Worksheet/Table/Column.php +++ b/src/PhpSpreadsheet/Worksheet/Table/Column.php @@ -12,10 +12,8 @@ class Column { /** * Table Column Index. - * - * @var string */ - private $columnIndex = ''; + private string $columnIndex = ''; /** * Show Filter Button. @@ -26,31 +24,23 @@ class Column /** * Total Row Label. - * - * @var string */ - private $totalsRowLabel; + private ?string $totalsRowLabel = null; /** * Total Row Function. - * - * @var string */ - private $totalsRowFunction; + private ?string $totalsRowFunction = null; /** * Total Row Formula. - * - * @var string */ - private $totalsRowFormula; + private ?string $totalsRowFormula = null; /** * Column Formula. - * - * @var string */ - private $columnFormula; + private ?string $columnFormula = null; /** * Table. diff --git a/src/PhpSpreadsheet/Worksheet/Table/TableStyle.php b/src/PhpSpreadsheet/Worksheet/Table/TableStyle.php index 54c378509..3587e82a2 100644 --- a/src/PhpSpreadsheet/Worksheet/Table/TableStyle.php +++ b/src/PhpSpreadsheet/Worksheet/Table/TableStyle.php @@ -103,10 +103,8 @@ class TableStyle /** * Table. - * - * @var null|Table */ - private $table; + private ?\PhpOffice\PhpSpreadsheet\Worksheet\Table $table = null; /** * Create a new Table Style. diff --git a/src/PhpSpreadsheet/Writer/Csv.php b/src/PhpSpreadsheet/Writer/Csv.php index 823f8495e..5b332d4ae 100644 --- a/src/PhpSpreadsheet/Writer/Csv.php +++ b/src/PhpSpreadsheet/Writer/Csv.php @@ -14,17 +14,13 @@ class Csv extends BaseWriter /** * Delimiter. - * - * @var string */ - private $delimiter = ','; + private string $delimiter = ','; /** * Enclosure. - * - * @var string */ - private $enclosure = '"'; + private string $enclosure = '"'; /** * Line ending. @@ -64,10 +60,8 @@ class Csv extends BaseWriter /** * Output encoding. - * - * @var string */ - private $outputEncoding = ''; + private string $outputEncoding = ''; /** * Create a new CSV. diff --git a/src/PhpSpreadsheet/Writer/Pdf.php b/src/PhpSpreadsheet/Writer/Pdf.php index e2cce9ed9..e74bb8f38 100644 --- a/src/PhpSpreadsheet/Writer/Pdf.php +++ b/src/PhpSpreadsheet/Writer/Pdf.php @@ -23,10 +23,8 @@ abstract class Pdf extends Html /** * Orientation (Over-ride). - * - * @var ?string */ - protected $orientation; + protected ?string $orientation = null; /** * Paper size (Over-ride). diff --git a/src/PhpSpreadsheet/Writer/Xls/ConditionalHelper.php b/src/PhpSpreadsheet/Writer/Xls/ConditionalHelper.php index a80c325b1..a64e2fa74 100644 --- a/src/PhpSpreadsheet/Writer/Xls/ConditionalHelper.php +++ b/src/PhpSpreadsheet/Writer/Xls/ConditionalHelper.php @@ -22,15 +22,9 @@ class ConditionalHelper */ protected $cellRange; - /** - * @var null|string - */ - protected $tokens; + protected ?string $tokens = null; - /** - * @var int - */ - protected $size; + protected int $size; public function __construct(Parser $parser) { diff --git a/tests/PhpSpreadsheetTests/Custom/ComplexAssert.php b/tests/PhpSpreadsheetTests/Custom/ComplexAssert.php index e7df5a667..73c98afe2 100644 --- a/tests/PhpSpreadsheetTests/Custom/ComplexAssert.php +++ b/tests/PhpSpreadsheetTests/Custom/ComplexAssert.php @@ -9,10 +9,7 @@ use PHPUnit\Framework\TestCase; class ComplexAssert extends TestCase { - /** - * @var string - */ - private $errorMessage = ''; + private string $errorMessage = ''; /** @var float */ private $delta = 0.0;