ReflectionFunction::fromClosure does not work for first-class callables (throw NoClosureOnLine exception)
MartinMystikJonas opened this issue · 5 comments
MartinMystikJonas commented
This code throws NoClosureOnLine
exception
$closure = (new Something())->foo(...);
ReflectionFunction::createFromClosure($closure);
it seems ReflectionFunction::createFromClosure
does not support first class callables. Is there any other way to get reflection of given closure created by first-class callable?
Ocramius commented
I think the code needs to be expanded to include that scenario: when this code was written, first class callables didn't really exist
ondrejmirtes commented
FYI the fix is no longer needed for this use case. They solved it differently.
Ocramius commented
@ondrejmirtes so ReflectionFunction::createFromClosure(foo(...))
works now? :P
MartinMystikJonas commented
@Ocramius In our use case we simply used native reflection
Ocramius commented
That's fine then, but it means this library is still affected 😁