From c853f16558e4fcf1497ea6013d137d99aa2ccc85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristoffer=20H=C3=B6gberg?= Date: Mon, 16 Dec 2024 10:47:39 +0100 Subject: [PATCH] Fix deprecation warning for PHP 8.4 implicit nullable Since PHP 8.4 Implicitly marking parameters as nullable is deprecated, the explicit nullable type must be used instead. For example change `Style $style = null` => `?Style $style = null` --- src/SimpleExcelReader.php | 2 +- src/SimpleExcelWriter.php | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/SimpleExcelReader.php b/src/SimpleExcelReader.php index 545ff83..38c123e 100644 --- a/src/SimpleExcelReader.php +++ b/src/SimpleExcelReader.php @@ -138,7 +138,7 @@ public function preserveEmptyRows(): self return $this; } - public function trimHeaderRow(string $characters = null): self + public function trimHeaderRow(?string $characters = null): self { $this->trimHeader = true; $this->trimHeaderCharacters = $characters; diff --git a/src/SimpleExcelWriter.php b/src/SimpleExcelWriter.php index 3a4815d..3d0045e 100644 --- a/src/SimpleExcelWriter.php +++ b/src/SimpleExcelWriter.php @@ -25,7 +25,7 @@ class SimpleExcelWriter public static function create( string $file, string $type = '', - callable $configureWriter = null, + ?callable $configureWriter = null, ?string $delimiter = null, ?bool $shouldAddBom = null, ): static { @@ -59,7 +59,7 @@ public static function createWithoutBom(string $file, string $type = ''): static public static function streamDownload( string $downloadName, string $type = '', - callable $writerCallback = null, + ?callable $writerCallback = null, ?string $delimiter = null, ?bool $shouldAddBom = null, ): static { @@ -148,7 +148,7 @@ public function setHeaderStyle(Style $style): static return $this; } - public function addRow(Row|array $row, Style $style = null): static + public function addRow(Row|array $row, ?Style $style = null): static { if (is_array($row)) { if ($this->processHeader && $this->processingFirstRow) { @@ -166,7 +166,7 @@ public function addRow(Row|array $row, Style $style = null): static return $this; } - public function addRows(iterable $rows, Style $style = null): static + public function addRows(iterable $rows, ?Style $style = null): static { foreach ($rows as $row) { $this->addRow($row, $style);