-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
adds support for invoking closures #4501
base: 3.x
Are you sure you want to change the base?
Conversation
@fabpot errors are unrelated |
Last comment and I think we're good: can you add an item in the CHANGELOG file? |
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
I'd suggest opening an issue on php-src also, get_class_methods() should return __invoke to me (and other non static methods BTW).
- fixes twigphp#3848 - adds changelog entry
Done |
Done php/php-src#17126 |
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.
Thank you for the PR @faizanakram99
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.
For PHP 8.0, we need to check that line 1742, we not calling isset($object->$item)
for Closure as it does not work.
@@ -394,6 +394,9 @@ public static function getGetAttributeTests() | |||
[true, ['foo' => 'bar'], $arrayAccess, 'vars', [], $anyType], | |||
]); | |||
|
|||
// test for Closure::__invoke() | |||
$tests[] = [true, 'closure called', fn (): string => 'closure called', '__invoke', [], $anyType]; |
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.
Let's add another test:
$tests[] = [true, 'closure called', fn (): string => 'closure called', '__invoke', [], $methodType];
Closure::__invoke
#3848