Roave/BetterReflection

ReflectionFunction::fromClosure does not work for first-class callables (throw NoClosureOnLine exception)

MartinMystikJonas opened this issue · 5 comments

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?

I think the code needs to be expanded to include that scenario: when this code was written, first class callables didn't really exist

FYI the fix is no longer needed for this use case. They solved it differently.

@ondrejmirtes so ReflectionFunction::createFromClosure(foo(...)) works now? :P

@Ocramius In our use case we simply used native reflection

That's fine then, but it means this library is still affected 😁