Add first-class callables

Support acquiring a Closure to a callable using the syntax
func(...), $obj->method(...), etc. This is essentially a
shortcut for Closure::fromCallable().

RFC: https://wiki.php.net/rfc/first_class_callable_syntax

Closes GH-7019.

Co-Authored-By: Nikita Popov <nikita.ppv@gmail.com>
This commit is contained in:
Joe Watkins 2021-05-20 08:14:56 +02:00 committed by Nikita Popov
parent 42cb5b5fa8
commit d0b09a7be4
40 changed files with 1078 additions and 515 deletions

View file

@ -853,6 +853,7 @@ return_type:
argument_list:
'(' ')' { $$ = zend_ast_create_list(0, ZEND_AST_ARG_LIST); }
| '(' non_empty_argument_list possible_comma ')' { $$ = $2; }
| '(' T_ELLIPSIS ')' { $$ = zend_ast_create(ZEND_AST_CALLABLE_CONVERT); }
;
non_empty_argument_list: