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

VarDumper::exportClosure() not support arrow functions #18952

Open
WinterSilence opened this issue Oct 15, 2021 · 5 comments
Open

VarDumper::exportClosure() not support arrow functions #18952

WinterSilence opened this issue Oct 15, 2021 · 5 comments
Labels
status:ready for adoption Feel free to implement this issue. type:bug Bug

Comments

@WinterSilence
Copy link
Contributor

VarDumper::exportClosure() not support arrow functions:

$f = fn($x) => $x + 10;
VarDumper::export($f);

Additional info

Q A
Yii version 2.0.43
PHP version 7.4
Operating system any
@samdark samdark added type:bug Bug status:ready for adoption Feel free to implement this issue. labels Oct 18, 2021
@samdark
Copy link
Member

samdark commented Oct 18, 2021

https://github.com/yiisoft/var-dumper/blob/master/src/ClosureExporter.php from Yii 3 could be useful for ideas on how to fix that. It supports short closures.

@WinterSilence
Copy link
Contributor Author

@samdark bad idea - "php": "^7.4|^8.0"

@samdark
Copy link
Member

samdark commented Oct 18, 2021

I haven't said that the library should be used. I've said there are interesting ideas there.

@WinterSilence
Copy link
Contributor Author

WinterSilence commented Oct 18, 2021

@samdark
Copy link
Member

samdark commented Oct 18, 2021

  1. SuperClosure is not maintained anymore.
  2. We've initially used Opis for Yii 3 but then found that it doesn't work for a few edge cases we had and that the 4.x version will require FFI.
  3. It is another dependency. We'd like to avoid it (especially considering that it's already implemented for Yii 3 and could be partially back-ported).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:ready for adoption Feel free to implement this issue. type:bug Bug
Projects
None yet
Development

No branches or pull requests

2 participants