diff --git a/src/Exportable.php b/src/Exportable.php index 7aada0f..538e0a0 100644 --- a/src/Exportable.php +++ b/src/Exportable.php @@ -56,7 +56,7 @@ public function setColumnStyles($styles): static * * @return string */ - public function export($path, callable $callback = null) + public function export($path, ?callable $callback = null) { self::exportOrDownload($path, 'openToFile', $callback); @@ -74,7 +74,7 @@ public function export($path, callable $callback = null) * * @return \Symfony\Component\HttpFoundation\StreamedResponse|string */ - public function download($path, callable $callback = null) + public function download($path, ?callable $callback = null) { if (method_exists(response(), 'streamDownload')) { return response()->streamDownload(function () use ($path, $callback) { @@ -97,7 +97,7 @@ public function download($path, callable $callback = null) * @throws \OpenSpout\Writer\Exception\WriterNotOpenedException * @throws \OpenSpout\Common\Exception\SpoutException */ - private function exportOrDownload($path, $function, callable $callback = null) + private function exportOrDownload($path, $function, ?callable $callback = null) { if (Str::endsWith($path, 'csv')) { $options = new \OpenSpout\Writer\CSV\Options(); diff --git a/src/FastExcel.php b/src/FastExcel.php index d350ebb..e798b06 100644 --- a/src/FastExcel.php +++ b/src/FastExcel.php @@ -61,7 +61,7 @@ class FastExcel * * @param array|Generator|Collection|null $data */ - public function __construct(array|Generator|Collection $data = null) + public function __construct(array|Generator|Collection|null $data = null) { $this->data = $data; } diff --git a/src/Importable.php b/src/Importable.php index ae5612d..ad81467 100644 --- a/src/Importable.php +++ b/src/Importable.php @@ -39,7 +39,7 @@ abstract protected function setOptions(&$options); * * @return Collection */ - public function import($path, callable $callback = null) + public function import($path, ?callable $callback = null) { $reader = $this->reader($path); @@ -64,7 +64,7 @@ public function import($path, callable $callback = null) * * @return Collection */ - public function importSheets($path, callable $callback = null) + public function importSheets($path, ?callable $callback = null) { $reader = $this->reader($path); @@ -142,7 +142,7 @@ private function transposeCollection(array $array) * * @return array */ - private function importSheet(SheetInterface $sheet, callable $callback = null) + private function importSheet(SheetInterface $sheet, ?callable $callback = null) { $headers = []; $collection = [];