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

[Bug]: Incompatible method signature in DefaultValueBinder::bindValue when using PHP 8.0+ #4239

Closed
1 task done
omer-hanaraey opened this issue Nov 10, 2024 · 2 comments
Closed
1 task done
Labels

Comments

@omer-hanaraey
Copy link

Is the bug applicable and reproducable to the latest version of the package and hasn't it been reported before?

  • Yes, it's still reproducable

What version of Laravel Excel are you using?

3.1

What version of Laravel are you using?

11.0

What version of PHP are you using?

8.2.3

Describe your issue

I am encountering a compatibility issue with DefaultValueBinder::bindValue in Laravel Excel when exporting to an .xlsx file. The error message I receive is:

Declaration of Maatwebsite\Excel\DefaultValueBinder::bindValue(PhpOffice\PhpSpreadsheet\Cell\Cell $cell, $value) must be compatible with PhpOffice\PhpSpreadsheet\Cell\DefaultValueBinder::bindValue(PhpOffice\PhpSpreadsheet\Cell\Cell $cell, mixed $value): bool

Possible Solution
It seems that the method signature in Maatwebsite\Excel\DefaultValueBinder::bindValue should be updated to match the PhpOffice\PhpSpreadsheet\Cell\DefaultValueBinder::bindValue method, with the mixed type hint for $value and a bool return type, as follows:

public function bindValue(PhpOffice\PhpSpreadsheet\Cell\Cell $cell, mixed $value): bool

How can the issue be reproduced?

  1. Install Laravel Excel with the latest version of PHPSpreadsheet and PHP 8.0+.
  2. Attempt to export a file to an .xlsx format.
  3. The above error is thrown due to the bindValue method signature mismatch.

What should be the expected behaviour?

The export should proceed without any compatibility issues.
However, the export fails with a Declaration compatibility error, as Maatwebsite\Excel\DefaultValueBinder::bindValue does not match the updated signature in PHPSpreadsheet’s DefaultValueBinder.

@Elshaden
Copy link

Same here

@krsriq
Copy link

krsriq commented Nov 10, 2024

See #4234

@patrickbrouwers patrickbrouwers closed this as not planned Won't fix, can't repro, duplicate, stale Nov 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants