-
Notifications
You must be signed in to change notification settings - Fork 131
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
Implemented missing functions in ReflectionFunction #357
Conversation
*/ | ||
public function invokeArgs(array $args = []) | ||
{ | ||
$this->assertIsNoClosure(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why can't you call it on a function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that the only possible solution for invokeArgs
working for closures is to build PHP code from AST and use eval
. And it will fail anyway for code like this:
<?php
class Foo
{
private $foo = 'foo';
public function boo()
{
return (function () {
return $this->foo;
})();
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, got it. Didn't consider that the closure wasn't loaded yet.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🚢
Thanks @kukulich! |
No description provided.