Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix PHP 8.4 deprecations #363

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/Exportable.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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) {
Expand All @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion src/FastExcel.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
6 changes: 3 additions & 3 deletions src/Importable.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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);

Expand Down Expand Up @@ -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 = [];
Expand Down