* [misc] Fix the deprecated implicitly nullable parameter types.

This commit is contained in:
liugang
2025-12-02 16:43:20 +08:00
committed by sunhao
parent 5488517ae0
commit 68d067c1c5
66 changed files with 128 additions and 128 deletions
+1 -1
View File
@@ -68,7 +68,7 @@ class Cell
* @param mixed|null $value
* @param Style|null $style
*/
public function __construct($value, Style $style = null)
public function __construct($value, ?Style $style = null)
{
$this->setValue($value);
$this->setStyle($style);
@@ -18,7 +18,7 @@ class InvalidValueException extends ReaderException
* @param int $code
* @param Throwable|null $previous
*/
public function __construct($invalidValue, $message = '', $code = 0, Throwable $previous = null)
public function __construct($invalidValue, $message = '', $code = 0, ?Throwable $previous = null)
{
$this->invalidValue = $invalidValue;
parent::__construct($message, $code, $previous);
@@ -86,7 +86,7 @@ class WriterEntityFactory
* @param Style|null $rowStyle
* @return Row
*/
public static function createRow(array $cells = [], Style $rowStyle = null)
public static function createRow(array $cells = [], ?Style $rowStyle = null)
{
return new Row($cells, $rowStyle);
}
@@ -96,7 +96,7 @@ class WriterEntityFactory
* @param Style|null $rowStyle
* @return Row
*/
public static function createRowFromArray(array $cellValues = [], Style $rowStyle = null)
public static function createRowFromArray(array $cellValues = [], ?Style $rowStyle = null)
{
$cells = \array_map(function ($cellValue) {
return new Cell($cellValue);
@@ -110,7 +110,7 @@ class WriterEntityFactory
* @param Style|null $cellStyle
* @return Cell
*/
public static function createCell($cellValue, Style $cellStyle = null)
public static function createCell($cellValue, ?Style $cellStyle = null)
{
return new Cell($cellValue, $cellStyle);
}
@@ -67,7 +67,7 @@ class CronExpression
*
* @return CronExpression
*/
public static function factory($expression, FieldFactory $fieldFactory = null)
public static function factory($expression, ?FieldFactory $fieldFactory = null)
{
$mappings = array(
'@yearly' => '0 0 1 1 *',
@@ -110,7 +110,7 @@ class CronExpression
* @param string $expression CRON expression (e.g. '8 * * * *')
* @param FieldFactory|null $fieldFactory Factory to create cron fields
*/
public function __construct($expression, FieldFactory $fieldFactory = null)
public function __construct($expression, ?FieldFactory $fieldFactory = null)
{
$this->fieldFactory = $fieldFactory;
$this->setExpression($expression);
+2 -2
View File
@@ -713,7 +713,7 @@ class Parsedown
#
# Setext
protected function blockSetextHeader($Line, array $Block = null)
protected function blockSetextHeader($Line, ?array $Block = null)
{
if ( ! isset($Block) or isset($Block['type']) or isset($Block['interrupted']))
{
@@ -851,7 +851,7 @@ class Parsedown
#
# Table
protected function blockTable($Line, array $Block = null)
protected function blockTable($Line, ?array $Block = null)
{
if ( ! isset($Block) or isset($Block['type']) or isset($Block['interrupted']))
{
+1 -1
View File
@@ -886,7 +886,7 @@ class Mobile_Detect
* from the $headers array instead.
*/
public function __construct(
array $headers = null,
?array $headers = null,
$userAgent = null
) {
$this->setHttpHeaders($headers);
@@ -2200,7 +2200,7 @@ class Calculation
],
];
public function __construct(Spreadsheet $spreadsheet = null)
public function __construct(?Spreadsheet $spreadsheet = null)
{
$this->delta = 1 * pow(10, 0 - ini_get('precision'));
@@ -2228,7 +2228,7 @@ class Calculation
*
* @return Calculation
*/
public static function getInstance(Spreadsheet $spreadsheet = null)
public static function getInstance(?Spreadsheet $spreadsheet = null)
{
if ($spreadsheet !== null) {
$instance = $spreadsheet->getCalculationEngine();
@@ -2693,7 +2693,7 @@ class Calculation
*
* @return mixed
*/
public function calculate(Cell $pCell = null)
public function calculate(?Cell $pCell = null)
{
try {
return $this->calculateCellValue($pCell);
@@ -2712,7 +2712,7 @@ class Calculation
*
* @return mixed
*/
public function calculateCellValue(Cell $pCell = null, $resetLog = true)
public function calculateCellValue(?Cell $pCell = null, $resetLog = true)
{
if ($pCell === null) {
return null;
@@ -2816,7 +2816,7 @@ class Calculation
*
* @return mixed
*/
public function calculateFormula($formula, $cellID = null, Cell $pCell = null)
public function calculateFormula($formula, $cellID = null, ?Cell $pCell = null)
{
// Initialise the logging settings
$this->formulaError = null;
@@ -2892,7 +2892,7 @@ class Calculation
*
* @return mixed
*/
public function _calculateFormulaValue($formula, $cellID = null, Cell $pCell = null)
public function _calculateFormulaValue($formula, $cellID = null, ?Cell $pCell = null)
{
$cellValue = null;
@@ -3294,7 +3294,7 @@ class Calculation
*
* @return bool
*/
private function _parseFormula($formula, Cell $pCell = null)
private function _parseFormula($formula, ?Cell $pCell = null)
{
if (($formula = $this->convertMatrixReferences(trim($formula))) === false) {
return false;
@@ -3628,7 +3628,7 @@ class Calculation
*
* @return bool
*/
private function processTokenStack($tokens, $cellID = null, Cell $pCell = null)
private function processTokenStack($tokens, $cellID = null, ?Cell $pCell = null)
{
if ($tokens == false) {
return false;
@@ -4304,7 +4304,7 @@ class Calculation
*
* @return mixed Array of values in range if range contains more than one element. Otherwise, a single value is returned.
*/
public function extractCellRange(&$pRange = 'A1', Worksheet $pSheet = null, $resetLog = true)
public function extractCellRange(&$pRange = 'A1', ?Worksheet $pSheet = null, $resetLog = true)
{
// Return value
$returnValue = [];
@@ -4357,7 +4357,7 @@ class Calculation
*
* @return mixed Array of values in range if range contains more than one element. Otherwise, a single value is returned.
*/
public function extractNamedRange(&$pRange = 'A1', Worksheet $pSheet = null, $resetLog = true)
public function extractNamedRange(&$pRange = 'A1', ?Worksheet $pSheet = null, $resetLog = true)
{
// Return value
$returnValue = [];
@@ -4464,7 +4464,7 @@ class Calculation
*
* @return array
*/
private function addCellReference(array $args, $passCellReference, $functionCall, Cell $pCell = null)
private function addCellReference(array $args, $passCellReference, $functionCall, ?Cell $pCell = null)
{
if ($passCellReference) {
if (is_array($functionCall)) {
@@ -653,7 +653,7 @@ class Functions
*
* @return bool|string
*/
public static function isFormula($cellReference = '', Cell $pCell = null)
public static function isFormula($cellReference = '', ?Cell $pCell = null)
{
if ($pCell === null) {
return self::REF();
@@ -238,7 +238,7 @@ class LookupRef
*
* @return mixed The value of $displayName (or $linkURL if $displayName was blank)
*/
public static function HYPERLINK($linkURL = '', $displayName = null, Cell $pCell = null)
public static function HYPERLINK($linkURL = '', $displayName = null, ?Cell $pCell = null)
{
$linkURL = ($linkURL === null) ? '' : Functions::flattenSingleValue($linkURL);
$displayName = ($displayName === null) ? '' : Functions::flattenSingleValue($displayName);
@@ -275,7 +275,7 @@ class LookupRef
*
* @todo Support for the optional a1 parameter introduced in Excel 2010
*/
public static function INDIRECT($cellAddress = null, Cell $pCell = null)
public static function INDIRECT($cellAddress = null, ?Cell $pCell = null)
{
$cellAddress = Functions::flattenSingleValue($cellAddress);
if ($cellAddress === null || $cellAddress === '') {
@@ -343,7 +343,7 @@ class LookupRef
*
* @return string A reference to a cell or range of cells
*/
public static function OFFSET($cellAddress = null, $rows = 0, $columns = 0, $height = null, $width = null, Cell $pCell = null)
public static function OFFSET($cellAddress = null, $rows = 0, $columns = 0, $height = null, $width = null, ?Cell $pCell = null)
{
$rows = Functions::flattenSingleValue($rows);
$columns = Functions::flattenSingleValue($columns);
@@ -903,7 +903,7 @@ class LookupRef
*
* @return string
*/
public static function FORMULATEXT($cellReference = '', Cell $pCell = null)
public static function FORMULATEXT($cellReference = '', ?Cell $pCell = null)
{
if ($pCell === null) {
return Functions::REF();
@@ -397,7 +397,7 @@ class Cell
*
* @return Cell
*/
public function setDataValidation(DataValidation $pDataValidation = null)
public function setDataValidation(?DataValidation $pDataValidation = null)
{
if (!isset($this->parent)) {
throw new Exception('Cannot set data validation for cell that is not bound to a worksheet');
@@ -461,7 +461,7 @@ class Cell
*
* @return Cell
*/
public function setHyperlink(Hyperlink $pHyperlink = null)
public function setHyperlink(?Hyperlink $pHyperlink = null)
{
if (!isset($this->parent)) {
throw new Exception('Cannot set hyperlink for cell that is not bound to a worksheet');
@@ -156,7 +156,7 @@ class Chart
* @param null|GridLines $majorGridlines
* @param null|GridLines $minorGridlines
*/
public function __construct($name, Title $title = null, Legend $legend = null, PlotArea $plotArea = null, $plotVisibleOnly = true, $displayBlanksAs = '0', Title $xAxisLabel = null, Title $yAxisLabel = null, Axis $xAxis = null, Axis $yAxis = null, GridLines $majorGridlines = null, GridLines $minorGridlines = null)
public function __construct($name, ?Title $title = null, ?Legend $legend = null, ?PlotArea $plotArea = null, $plotVisibleOnly = true, $displayBlanksAs = '0', ?Title $xAxisLabel = null, ?Title $yAxisLabel = null, ?Axis $xAxis = null, ?Axis $yAxis = null, ?GridLines $majorGridlines = null, ?GridLines $minorGridlines = null)
{
$this->name = $name;
$this->title = $title;
@@ -199,7 +199,7 @@ class Chart
*
* @return Chart
*/
public function setWorksheet(Worksheet $pValue = null)
public function setWorksheet(?Worksheet $pValue = null)
{
$this->worksheet = $pValue;
@@ -55,7 +55,7 @@ class Legend
* @param null|Layout $layout
* @param bool $overlay
*/
public function __construct($position = self::POSITION_RIGHT, Layout $layout = null, $overlay = false)
public function __construct($position = self::POSITION_RIGHT, ?Layout $layout = null, $overlay = false)
{
$this->setPosition($position);
$this->layout = $layout;
@@ -26,7 +26,7 @@ class PlotArea
* @param null|Layout $layout
* @param DataSeries[] $plotSeries
*/
public function __construct(Layout $layout = null, array $plotSeries = [])
public function __construct(?Layout $layout = null, array $plotSeries = [])
{
$this->layout = $layout;
$this->plotSeries = $plotSeries;
@@ -24,7 +24,7 @@ class Title
* @param null|mixed $caption
* @param null|Layout $layout
*/
public function __construct($caption = null, Layout $layout = null)
public function __construct($caption = null, ?Layout $layout = null)
{
$this->caption = $caption;
$this->layout = $layout;
@@ -40,7 +40,7 @@ class HashTable
*
* @throws Exception
*/
public function addFromSource(array $pSource = null)
public function addFromSource(?array $pSource = null)
{
// Check if an array was passed
if ($pSource == null) {
@@ -125,7 +125,7 @@ class NamedRange
*
* @return NamedRange
*/
public function setWorksheet(Worksheet $value = null)
public function setWorksheet(?Worksheet $value = null)
{
if ($value !== null) {
$this->worksheet = $value;
@@ -202,7 +202,7 @@ class NamedRange
*
* @return NamedRange
*/
public function setScope(Worksheet $value = null)
public function setScope(?Worksheet $value = null)
{
$this->scope = $value;
$this->localOnly = $value != null;
@@ -12,7 +12,7 @@ class ColumnAndRowAttributes extends BaseParserClass
private $worksheetXml;
public function __construct(Worksheet $workSheet, \SimpleXMLElement $worksheetXml = null)
public function __construct(Worksheet $workSheet, ?\SimpleXMLElement $worksheetXml = null)
{
$this->worksheet = $workSheet;
$this->worksheetXml = $worksheetXml;
@@ -74,7 +74,7 @@ class ColumnAndRowAttributes extends BaseParserClass
* @param IReadFilter $readFilter
* @param bool $readDataOnly
*/
public function load(IReadFilter $readFilter = null, $readDataOnly = false)
public function load(?IReadFilter $readFilter = null, $readDataOnly = false)
{
if ($this->worksheetXml === null) {
return;
@@ -11,7 +11,7 @@ class PageSetup extends BaseParserClass
private $worksheetXml;
public function __construct(Worksheet $workSheet, \SimpleXMLElement $worksheetXml = null)
public function __construct(Worksheet $workSheet, ?\SimpleXMLElement $worksheetXml = null)
{
$this->worksheet = $workSheet;
$this->worksheetXml = $worksheetXml;
@@ -10,7 +10,7 @@ class SheetViewOptions extends BaseParserClass
private $worksheetXml;
public function __construct(Worksheet $workSheet, \SimpleXMLElement $worksheetXml = null)
public function __construct(Worksheet $workSheet, ?\SimpleXMLElement $worksheetXml = null)
{
$this->worksheet = $workSheet;
$this->worksheetXml = $worksheetXml;
@@ -31,7 +31,7 @@ class Styles extends BaseParserClass
$this->styleXml = $styleXml;
}
public function setStyleBaseData(Theme $theme = null, $styles = [], $cellStyles = [])
public function setStyleBaseData(?Theme $theme = null, $styles = [], $cellStyles = [])
{
self::$theme = $theme;
$this->styles = $styles;
@@ -23,7 +23,7 @@ class RichText implements IComparable
*
* @throws Exception
*/
public function __construct(Cell $pCell = null)
public function __construct(?Cell $pCell = null)
{
// Initialise variables
$this->richTextElements = [];
@@ -42,7 +42,7 @@ class Run extends TextElement implements ITextElement
*
* @return ITextElement
*/
public function setFont(Font $pFont = null)
public function setFont(?Font $pFont = null)
{
$this->font = $pFont;
@@ -223,7 +223,7 @@ class Font
*
* @return int Column width
*/
public static function calculateColumnWidth(\PhpOffice\PhpSpreadsheet\Style\Font $font, $cellText = '', $rotation = 0, \PhpOffice\PhpSpreadsheet\Style\Font $defaultFont = null)
public static function calculateColumnWidth(\PhpOffice\PhpSpreadsheet\Style\Font $font, $cellText = '', $rotation = 0, ?\PhpOffice\PhpSpreadsheet\Style\Font $defaultFont = null)
{
// If it is rich text, use plain text
if ($cellText instanceof RichText) {
@@ -930,7 +930,7 @@ class Spreadsheet
*
* @return null|NamedRange
*/
public function getNamedRange($namedRange, Worksheet $pSheet = null)
public function getNamedRange($namedRange, ?Worksheet $pSheet = null)
{
$returnValue = null;
@@ -957,7 +957,7 @@ class Spreadsheet
*
* @return Spreadsheet
*/
public function removeNamedRange($namedRange, Worksheet $pSheet = null)
public function removeNamedRange($namedRange, ?Worksheet $pSheet = null)
{
if ($pSheet === null) {
if (isset($this->namedRanges[$namedRange])) {
@@ -232,7 +232,7 @@ class Conditional implements IComparable
*
* @return Conditional
*/
public function setStyle(Style $pValue = null)
public function setStyle(?Style $pValue = null)
{
$this->style = $pValue;
@@ -38,7 +38,7 @@ class AutoFilter
* @param string $pRange Cell range (i.e. A1:E10)
* @param Worksheet $pSheet
*/
public function __construct($pRange = '', Worksheet $pSheet = null)
public function __construct($pRange = '', ?Worksheet $pSheet = null)
{
$this->range = $pRange;
$this->workSheet = $pSheet;
@@ -61,7 +61,7 @@ class AutoFilter
*
* @return AutoFilter
*/
public function setParent(Worksheet $pSheet = null)
public function setParent(?Worksheet $pSheet = null)
{
$this->workSheet = $pSheet;
@@ -94,7 +94,7 @@ class Column
* @param string $pColumn Column (e.g. A)
* @param AutoFilter $pParent Autofilter for this column
*/
public function __construct($pColumn, AutoFilter $pParent = null)
public function __construct($pColumn, ?AutoFilter $pParent = null)
{
$this->columnIndex = $pColumn;
$this->parent = $pParent;
@@ -149,7 +149,7 @@ class Column
*
* @return Column
*/
public function setParent(AutoFilter $pParent = null)
public function setParent(?AutoFilter $pParent = null)
{
$this->parent = $pParent;
@@ -240,7 +240,7 @@ class Rule
*
* @param Column $pParent
*/
public function __construct(Column $pParent = null)
public function __construct(?Column $pParent = null)
{
$this->parent = $pParent;
}
@@ -426,7 +426,7 @@ class Rule
*
* @return Rule
*/
public function setParent(Column $pParent = null)
public function setParent(?Column $pParent = null)
{
$this->parent = $pParent;
@@ -207,7 +207,7 @@ class BaseDrawing implements IComparable
*
* @return BaseDrawing
*/
public function setWorksheet(Worksheet $pValue = null, $pOverrideOld = false)
public function setWorksheet(?Worksheet $pValue = null, $pOverrideOld = false)
{
if ($this->worksheet === null) {
// Add drawing to \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet
@@ -473,7 +473,7 @@ class BaseDrawing implements IComparable
*
* @return BaseDrawing
*/
public function setShadow(Drawing\Shadow $pValue = null)
public function setShadow(?Drawing\Shadow $pValue = null)
{
$this->shadow = $pValue;
@@ -522,7 +522,7 @@ class BaseDrawing implements IComparable
/**
* @param null|Hyperlink $pHyperlink
*/
public function setHyperlink(Hyperlink $pHyperlink = null)
public function setHyperlink(?Hyperlink $pHyperlink = null)
{
$this->hyperlink = $pHyperlink;
}
@@ -24,7 +24,7 @@ class Column
* @param Worksheet $parent
* @param string $columnIndex
*/
public function __construct(Worksheet $parent = null, $columnIndex = 'A')
public function __construct(?Worksheet $parent = null, $columnIndex = 'A')
{
// Set parent and column index
$this->parent = $parent;
@@ -43,7 +43,7 @@ class ColumnCellIterator extends CellIterator
* @param int $startRow The row number at which to start iterating
* @param int $endRow Optionally, the row number at which to stop iterating
*/
public function __construct(Worksheet $subject = null, $columnIndex = 'A', $startRow = 1, $endRow = null)
public function __construct(?Worksheet $subject = null, $columnIndex = 'A', $startRow = 1, $endRow = null)
{
// Set subject
$this->worksheet = $subject;
@@ -222,7 +222,7 @@ class Shadow implements IComparable
*
* @return Shadow
*/
public function setColor(Color $pValue = null)
public function setColor(?Color $pValue = null)
{
$this->color = $pValue;
@@ -24,7 +24,7 @@ class Row
* @param Worksheet $worksheet
* @param int $rowIndex
*/
public function __construct(Worksheet $worksheet = null, $rowIndex = 1)
public function __construct(?Worksheet $worksheet = null, $rowIndex = 1)
{
// Set parent and row index
$this->worksheet = $worksheet;
@@ -43,7 +43,7 @@ class RowCellIterator extends CellIterator
* @param string $startColumn The column address at which to start iterating
* @param string $endColumn Optionally, the column address at which to stop iterating
*/
public function __construct(Worksheet $worksheet = null, $rowIndex = 1, $startColumn = 'A', $endColumn = null)
public function __construct(?Worksheet $worksheet = null, $rowIndex = 1, $startColumn = 'A', $endColumn = null)
{
// Set subject and row index
$this->worksheet = $worksheet;
@@ -344,7 +344,7 @@ class Worksheet implements IComparable
* @param Spreadsheet $parent
* @param string $pTitle
*/
public function __construct(Spreadsheet $parent = null, $pTitle = 'Worksheet')
public function __construct(?Spreadsheet $parent = null, $pTitle = 'Worksheet')
{
// Set parent and title
$this->parent = $parent;
@@ -2770,7 +2770,7 @@ class Worksheet implements IComparable
*
* @return Worksheet
*/
public function setHyperlink($pCellCoordinate, Hyperlink $pHyperlink = null)
public function setHyperlink($pCellCoordinate, ?Hyperlink $pHyperlink = null)
{
if ($pHyperlink === null) {
unset($this->hyperlinkCollection[$pCellCoordinate]);
@@ -2831,7 +2831,7 @@ class Worksheet implements IComparable
*
* @return Worksheet
*/
public function setDataValidation($pCellCoordinate, DataValidation $pDataValidation = null)
public function setDataValidation($pCellCoordinate, ?DataValidation $pDataValidation = null)
{
if ($pDataValidation === null) {
unset($this->dataValidationCollection[$pCellCoordinate]);
@@ -16,7 +16,7 @@ class Meta extends WriterPart
*
* @return string XML Output
*/
public function write(Spreadsheet $spreadsheet = null)
public function write(?Spreadsheet $spreadsheet = null)
{
if (!$spreadsheet) {
$spreadsheet = $this->getParentWriter()->getSpreadsheet();
@@ -13,7 +13,7 @@ class Mimetype extends WriterPart
*
* @return string XML Output
*/
public function write(Spreadsheet $spreadsheet = null)
public function write(?Spreadsheet $spreadsheet = null)
{
return 'application/vnd.oasis.opendocument.spreadsheet';
}
@@ -16,7 +16,7 @@ class Settings extends WriterPart
*
* @return string XML Output
*/
public function write(Spreadsheet $spreadsheet = null)
public function write(?Spreadsheet $spreadsheet = null)
{
$objWriter = null;
if ($this->getParentWriter()->getUseDiskCaching()) {
@@ -16,7 +16,7 @@ class Styles extends WriterPart
*
* @return string XML Output
*/
public function write(Spreadsheet $spreadsheet = null)
public function write(?Spreadsheet $spreadsheet = null)
{
$objWriter = null;
if ($this->getParentWriter()->getUseDiskCaching()) {
@@ -13,7 +13,7 @@ class Thumbnails extends WriterPart
*
* @return string XML Output
*/
public function writeThumbnail(Spreadsheet $spreadsheet = null)
public function writeThumbnail(?Spreadsheet $spreadsheet = null)
{
return '';
}
@@ -1143,7 +1143,7 @@ class Workbook extends BIFFwriter
*
* @param \PhpOffice\PhpSpreadsheet\Shared\Escher $pValue
*/
public function setEscher(\PhpOffice\PhpSpreadsheet\Shared\Escher $pValue = null)
public function setEscher(?\PhpOffice\PhpSpreadsheet\Shared\Escher $pValue = null)
{
$this->escher = $pValue;
}
@@ -2566,7 +2566,7 @@ class Worksheet extends BIFFwriter
*
* @param \PhpOffice\PhpSpreadsheet\Shared\Escher $pValue
*/
public function setEscher(\PhpOffice\PhpSpreadsheet\Shared\Escher $pValue = null)
public function setEscher(?\PhpOffice\PhpSpreadsheet\Shared\Escher $pValue = null)
{
$this->escher = $pValue;
}
@@ -112,7 +112,7 @@ class Chart extends WriterPart
*
* @throws WriterException
*/
private function writeTitle(XMLWriter $objWriter, Title $title = null)
private function writeTitle(XMLWriter $objWriter, ?Title $title = null)
{
if ($title === null) {
return;
@@ -157,7 +157,7 @@ class Chart extends WriterPart
*
* @throws WriterException
*/
private function writeLegend(XMLWriter $objWriter, Legend $legend = null)
private function writeLegend(XMLWriter $objWriter, ?Legend $legend = null)
{
if ($legend === null) {
return;
@@ -215,7 +215,7 @@ class Chart extends WriterPart
*
* @throws WriterException
*/
private function writePlotArea(XMLWriter $objWriter, \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet $pSheet, PlotArea $plotArea, Title $xAxisLabel = null, Title $yAxisLabel = null, Axis $xAxis = null, Axis $yAxis = null, GridLines $majorGridlines = null, GridLines $minorGridlines = null)
private function writePlotArea(XMLWriter $objWriter, \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet $pSheet, PlotArea $plotArea, ?Title $xAxisLabel = null, ?Title $yAxisLabel = null, ?Axis $xAxis = null, ?Axis $yAxis = null, ?GridLines $majorGridlines = null, ?GridLines $minorGridlines = null)
{
if ($plotArea === null) {
return;
@@ -344,7 +344,7 @@ class Chart extends WriterPart
* @param XMLWriter $objWriter XML Writer
* @param \PhpOffice\PhpSpreadsheet\Chart\Layout $chartLayout Chart layout
*/
private function writeDataLabels(XMLWriter $objWriter, Layout $chartLayout = null)
private function writeDataLabels(XMLWriter $objWriter, ?Layout $chartLayout = null)
{
$objWriter->startElement('c:dLbls');
@@ -1421,7 +1421,7 @@ class Chart extends WriterPart
* @param XMLWriter $objWriter XML Writer
* @param Layout $layout
*/
private function writeLayout(XMLWriter $objWriter, Layout $layout = null)
private function writeLayout(XMLWriter $objWriter, ?Layout $layout = null)
{
$objWriter->startElement('c:layout');
@@ -20,32 +20,32 @@ namespace PhpOffice\PhpWord\Element;
/**
* Container abstract class
*
* @method Text addText(string $text, mixed $fStyle = null, mixed $pStyle = null)
* @method Text addText(string $text, ?mixed $fStyle = null, ?mixed $pStyle = null)
* @method TextRun addTextRun(mixed $pStyle = null)
* @method Bookmark addBookmark(string $name)
* @method Link addLink(string $target, string $text = null, mixed $fStyle = null, mixed $pStyle = null, boolean $internal = false)
* @method PreserveText addPreserveText(string $text, mixed $fStyle = null, mixed $pStyle = null)
* @method void addTextBreak(int $count = 1, mixed $fStyle = null, mixed $pStyle = null)
* @method ListItem addListItem(string $txt, int $depth = 0, mixed $font = null, mixed $list = null, mixed $para = null)
* @method ListItemRun addListItemRun(int $depth = 0, mixed $listStyle = null, mixed $pStyle = null)
* @method Link addLink(string $target, ?string $text = null, ?mixed $fStyle = null, ?mixed $pStyle = null, boolean $internal = false)
* @method PreserveText addPreserveText(string $text, ?mixed $fStyle = null, ?mixed $pStyle = null)
* @method void addTextBreak(int $count = 1, ?mixed $fStyle = null, ?mixed $pStyle = null)
* @method ListItem addListItem(string $txt, int $depth = 0, ?mixed $font = null, ?mixed $list = null, ?mixed $para = null)
* @method ListItemRun addListItemRun(int $depth = 0, ?mixed $listStyle = null, ?mixed $pStyle = null)
* @method Footnote addFootnote(mixed $pStyle = null)
* @method Endnote addEndnote(mixed $pStyle = null)
* @method CheckBox addCheckBox(string $name, $text, mixed $fStyle = null, mixed $pStyle = null)
* @method CheckBox addCheckBox(string $name, $text, ?mixed $fStyle = null, ?mixed $pStyle = null)
* @method Title addTitle(mixed $text, int $depth = 1)
* @method TOC addTOC(mixed $fontStyle = null, mixed $tocStyle = null, int $minDepth = 1, int $maxDepth = 9)
* @method TOC addTOC(mixed $fontStyle = null, ?mixed $tocStyle = null, int $minDepth = 1, int $maxDepth = 9)
* @method PageBreak addPageBreak()
* @method Table addTable(mixed $style = null)
* @method Image addImage(string $source, mixed $style = null, bool $isWatermark = false, $name = null)
* @method OLEObject addOLEObject(string $source, mixed $style = null)
* @method Image addImage(string $source, ?mixed $style = null, bool $isWatermark = false, $name = null)
* @method OLEObject addOLEObject(string $source, ?mixed $style = null)
* @method TextBox addTextBox(mixed $style = null)
* @method Field addField(string $type = null, array $properties = array(), array $options = array(), mixed $text = null)
* @method Field addField(string $type = null, array $properties = array(), array $options = array(), ?mixed $text = null)
* @method Line addLine(mixed $lineStyle = null)
* @method Shape addShape(string $type, mixed $style = null)
* @method Chart addChart(string $type, array $categories, array $values, array $style = null, $seriesName = null)
* @method FormField addFormField(string $type, mixed $fStyle = null, mixed $pStyle = null)
* @method Shape addShape(string $type, ?mixed $style = null)
* @method Chart addChart(string $type, array $categories, array $values, ?array $style = null, $seriesName = null)
* @method FormField addFormField(string $type, ?mixed $fStyle = null, ?mixed $pStyle = null)
* @method SDT addSDT(string $type)
*
* @method \PhpOffice\PhpWord\Element\OLEObject addObject(string $source, mixed $style = null) deprecated, use addOLEObject instead
* @method \PhpOffice\PhpWord\Element\OLEObject addObject(string $source, ?mixed $style = null) deprecated, use addOLEObject instead
*
* @since 0.10.0
*/
@@ -157,7 +157,7 @@ abstract class AbstractElement
*
* @param \PhpOffice\PhpWord\PhpWord $phpWord
*/
public function setPhpWord(PhpWord $phpWord = null)
public function setPhpWord(?PhpWord $phpWord = null)
{
$this->phpWord = $phpWord;
}
@@ -170,7 +170,7 @@ class Section extends AbstractContainer
*
* @param FootnoteProperties $footnoteProperties
*/
public function setFootnoteProperties(FootnoteProperties $footnoteProperties = null)
public function setFootnoteProperties(?FootnoteProperties $footnoteProperties = null)
{
$this->footnoteProperties = $footnoteProperties;
}
@@ -28,7 +28,7 @@ final class CopyFileException extends Exception
* @param int $code The user defined exception code
* @param \Exception $previous The previous exception used for the exception chaining
*/
final public function __construct($source, $destination, $code = 0, \Exception $previous = null)
final public function __construct($source, $destination, $code = 0, ?\Exception $previous = null)
{
parent::__construct(
sprintf('Could not copy \'%s\' file to \'%s\'.', $source, $destination),
@@ -26,7 +26,7 @@ final class CreateTemporaryFileException extends Exception
* @param int $code The user defined exception code
* @param \Exception $previous The previous exception used for the exception chaining
*/
final public function __construct($code = 0, \Exception $previous = null)
final public function __construct($code = 0, ?\Exception $previous = null)
{
parent::__construct(
'Could not create a temporary file with unique name in the specified directory.',
+4 -4
View File
@@ -47,7 +47,7 @@ class Media
*
* @return int
*/
public static function addElement($container, $mediaType, $source, Image $image = null)
public static function addElement($container, $mediaType, $source, ?Image $image = null)
{
// Assign unique media Id and initiate media container if none exists
$mediaId = md5($container . $source);
@@ -214,7 +214,7 @@ class Media
*
* @codeCoverageIgnore
*/
public static function addSectionMediaElement($src, $type, Image $image = null)
public static function addSectionMediaElement($src, $type, ?Image $image = null)
{
return self::addElement('section', $type, $src, $image);
}
@@ -280,7 +280,7 @@ class Media
*
* @codeCoverageIgnore
*/
public static function addHeaderMediaElement($headerCount, $src, Image $image = null)
public static function addHeaderMediaElement($headerCount, $src, ?Image $image = null)
{
return self::addElement("header{$headerCount}", 'image', $src, $image);
}
@@ -328,7 +328,7 @@ class Media
*
* @codeCoverageIgnore
*/
public static function addFooterMediaElement($footerCount, $src, Image $image = null)
public static function addFooterMediaElement($footerCount, $src, ?Image $image = null)
{
return self::addElement("footer{$footerCount}", 'image', $src, $image);
}
@@ -267,7 +267,7 @@ class Settings
*
* @param TrackChangesView $trackChangesView
*/
public function setRevisionView(TrackChangesView $trackChangesView = null)
public function setRevisionView(?TrackChangesView $trackChangesView = null)
{
$this->revisionView = $trackChangesView;
}
+3 -3
View File
@@ -36,10 +36,10 @@ use PhpOffice\PhpWord\Exception\Exception;
* @method int addComment(Element\Comment $comment)
*
* @method Style\Paragraph addParagraphStyle(string $styleName, mixed $styles)
* @method Style\Font addFontStyle(string $styleName, mixed $fontStyle, mixed $paragraphStyle = null)
* @method Style\Font addFontStyle(string $styleName, mixed $fontStyle, ?mixed $paragraphStyle = null)
* @method Style\Font addLinkStyle(string $styleName, mixed $styles)
* @method Style\Font addTitleStyle(mixed $depth, mixed $fontStyle, mixed $paragraphStyle = null)
* @method Style\Table addTableStyle(string $styleName, mixed $styleTable, mixed $styleFirstRow = null)
* @method Style\Font addTitleStyle(mixed $depth, mixed $fontStyle, ?mixed $paragraphStyle = null)
* @method Style\Table addTableStyle(string $styleName, mixed $styleTable, ?mixed $styleFirstRow = null)
* @method Style\Numbering addNumberingStyle(string $styleName, mixed $styles)
*/
class PhpWord
@@ -182,7 +182,7 @@ abstract class AbstractPart
* @param array $paragraphStyle
* @return number|null
*/
private function getHeadingDepth(array $paragraphStyle = null)
private function getHeadingDepth(?array $paragraphStyle = null)
{
if (is_array($paragraphStyle) && isset($paragraphStyle['styleName'])) {
if ('Title' === $paragraphStyle['styleName']) {
@@ -590,7 +590,7 @@ abstract class AbstractPart
* @param string|array|null $elements
* @return string|null
*/
private function findPossibleElement(XMLReader $xmlReader, \DOMElement $parentNode = null, $elements = null)
private function findPossibleElement(XMLReader $xmlReader, ?\DOMElement $parentNode = null, $elements = null)
{
if (is_array($elements)) {
//if element is an array, we take the first element that exists in the XML
@@ -639,7 +639,7 @@ abstract class AbstractPart
* @ignoreScrutinizerPatch
* @return array
*/
protected function readStyleDefs(XMLReader $xmlReader, \DOMElement $parentNode = null, $styleDefs = array())
protected function readStyleDefs(XMLReader $xmlReader, ?\DOMElement $parentNode = null, $styleDefs = array())
{
$styles = array();
@@ -91,7 +91,7 @@ class XMLReader
* @param \DOMElement $contextNode
* @return \DOMNodeList
*/
public function getElements($path, \DOMElement $contextNode = null)
public function getElements($path, ?\DOMElement $contextNode = null)
{
if ($this->dom === null) {
return array();
@@ -134,7 +134,7 @@ class XMLReader
* @param \DOMElement $contextNode
* @return \DOMElement|null
*/
public function getElement($path, \DOMElement $contextNode = null)
public function getElement($path, ?\DOMElement $contextNode = null)
{
$elements = $this->getElements($path, $contextNode);
if ($elements->length > 0) {
@@ -152,7 +152,7 @@ class XMLReader
* @param string $path
* @return string|null
*/
public function getAttribute($attribute, \DOMElement $contextNode = null, $path = null)
public function getAttribute($attribute, ?\DOMElement $contextNode = null, $path = null)
{
$return = null;
if ($path !== null) {
@@ -178,7 +178,7 @@ class XMLReader
* @param \DOMElement $contextNode
* @return string|null
*/
public function getValue($path, \DOMElement $contextNode = null)
public function getValue($path, ?\DOMElement $contextNode = null)
{
$elements = $this->getElements($path, $contextNode);
if ($elements->length > 0) {
@@ -195,7 +195,7 @@ class XMLReader
* @param \DOMElement $contextNode
* @return int
*/
public function countElements($path, \DOMElement $contextNode = null)
public function countElements($path, ?\DOMElement $contextNode = null)
{
$elements = $this->getElements($path, $contextNode);
@@ -209,7 +209,7 @@ class XMLReader
* @param \DOMElement $contextNode
* @return bool
*/
public function elementExists($path, \DOMElement $contextNode = null)
public function elementExists($path, ?\DOMElement $contextNode = null)
{
return $this->getElements($path, $contextNode)->length > 0;
}
@@ -25,12 +25,12 @@ namespace PhpOffice\PhpWord\Shared;
* @method bool openMemory()
* @method string outputMemory(bool $flush = null)
* @method bool setIndent(bool $indent)
* @method bool startDocument(string $version = 1.0, string $encoding = null, string $standalone = null)
* @method bool startDocument(string $version = 1.0, ?string $encoding = null, ?string $standalone = null)
* @method bool startElement(string $name)
* @method bool text(string $content)
* @method bool writeCData(string $content)
* @method bool writeComment(string $content)
* @method bool writeElement(string $name, string $content = null)
* @method bool writeElement(string $name, ?string $content = null)
* @method bool writeRaw(string $content)
*/
class XMLWriter extends \XMLWriter
@@ -27,7 +27,7 @@ use PhpOffice\PhpWord\Settings;
* properties and methods are bypassed and used as the model for the PCLZip
* emulation. Only needed PHP ZipArchive features are implemented.
*
* @method bool addFile(string $filename, string $localname = null)
* @method bool addFile(string $filename, ?string $localname = null)
* @method bool addFromString(string $localname, string $contents)
* @method string getNameIndex(int $index)
* @method int locateName(string $name)
+1 -1
View File
@@ -779,7 +779,7 @@ class Table extends Border
*
* @param int[] $value
*/
public function setColumnWidths(array $value = null)
public function setColumnWidths(?array $value = null)
{
$this->columnWidths = $value;
}
@@ -113,7 +113,7 @@ abstract class AbstractWriter implements WriterInterface
* @param \PhpOffice\PhpWord\PhpWord
* @return self
*/
public function setPhpWord(PhpWord $phpWord = null)
public function setPhpWord(?PhpWord $phpWord = null)
{
$this->phpWord = $phpWord;
+1 -1
View File
@@ -44,7 +44,7 @@ class HTML extends AbstractWriter implements WriterInterface
/**
* Create new instance
*/
public function __construct(PhpWord $phpWord = null)
public function __construct(?PhpWord $phpWord = null)
{
$this->setPhpWord($phpWord);
@@ -49,7 +49,7 @@ abstract class AbstractPart
/**
* @param \PhpOffice\PhpWord\Writer\AbstractWriter $writer
*/
public function setParentWriter(AbstractWriter $writer = null)
public function setParentWriter(?AbstractWriter $writer = null)
{
$this->parentWriter = $writer;
}
+1 -1
View File
@@ -32,7 +32,7 @@ class ODText extends AbstractWriter implements WriterInterface
*
* @param \PhpOffice\PhpWord\PhpWord $phpWord
*/
public function __construct(PhpWord $phpWord = null)
public function __construct(?PhpWord $phpWord = null)
{
// Assign PhpWord
$this->setPhpWord($phpWord);
@@ -124,7 +124,7 @@ class Text extends AbstractElement
}
}
private function writeChangeInsertion($start = true, TrackChange $trackChange = null)
private function writeChangeInsertion($start = true, ?TrackChange $trackChange = null)
{
if ($trackChange == null || $trackChange->getChangeType() != TrackChange::INSERTED) {
return;
+1 -1
View File
@@ -38,7 +38,7 @@ class RTF extends AbstractWriter implements WriterInterface
*
* @param \PhpOffice\PhpWord\PhpWord $phpWord
*/
public function __construct(PhpWord $phpWord = null)
public function __construct(?PhpWord $phpWord = null)
{
$this->setPhpWord($phpWord);
@@ -49,7 +49,7 @@ abstract class AbstractPart
/**
* @param \PhpOffice\PhpWord\Writer\AbstractWriter $writer
*/
public function setParentWriter(AbstractWriter $writer = null)
public function setParentWriter(?AbstractWriter $writer = null)
{
$this->parentWriter = $writer;
}
@@ -46,7 +46,7 @@ class Word2007 extends AbstractWriter implements WriterInterface
*
* @param \PhpOffice\PhpWord\PhpWord
*/
public function __construct(PhpWord $phpWord = null)
public function __construct(?PhpWord $phpWord = null)
{
// Assign PhpWord
$this->setPhpWord($phpWord);
@@ -51,7 +51,7 @@ abstract class AbstractPart
*
* @param \PhpOffice\PhpWord\Writer\AbstractWriter $writer
*/
public function setParentWriter(AbstractWriter $writer = null)
public function setParentWriter(?AbstractWriter $writer = null)
{
$this->parentWriter = $writer;
}
@@ -220,7 +220,7 @@ class Settings extends AbstractPart
*
* @param ProofState $proofState
*/
private function setProofState(ProofState $proofState = null)
private function setProofState(?ProofState $proofState = null)
{
if ($proofState != null && $proofState->getGrammar() !== null && $proofState->getSpelling() !== null) {
$this->settings['w:proofState'] = array(
@@ -237,7 +237,7 @@ class Settings extends AbstractPart
*
* @param TrackChangesView $trackChangesView
*/
private function setRevisionView(TrackChangesView $trackChangesView = null)
private function setRevisionView(?TrackChangesView $trackChangesView = null)
{
if ($trackChangesView != null) {
$revisionView = array();
@@ -256,7 +256,7 @@ class Settings extends AbstractPart
*
* @param Language $language
*/
private function setThemeFontLang(Language $language = null)
private function setThemeFontLang(?Language $language = null)
{
$latinLanguage = ($language == null || $language->getLatin() === null) ? 'en-US' : $language->getLatin();
$lang = array();