Skip to content

Commit d1115a8

Browse files
committed
Optimize static method calls in pipes.
1 parent 38f1309 commit d1115a8

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Zend/zend_compile.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6438,6 +6438,11 @@ static void zend_compile_pipe(znode *result, zend_ast *ast)
64386438
&& callable_ast->child[1]->kind == ZEND_AST_CALLABLE_CONVERT) {
64396439
fcall_ast = zend_ast_create(ZEND_AST_CALL,
64406440
callable_ast->child[0], arg_list_ast);
6441+
/* Turn $foo |> bar::>baz(...) into bar::baz($foo). */
6442+
} else if (callable_ast->kind == ZEND_AST_STATIC_CALL
6443+
&& callable_ast->child[2]->kind == ZEND_AST_CALLABLE_CONVERT) {
6444+
fcall_ast = zend_ast_create(ZEND_AST_STATIC_CALL,
6445+
callable_ast->child[0], callable_ast->child[1], arg_list_ast);
64416446
/* Turn $foo |> $bar->baz(...) into $bar->baz($foo). */
64426447
} else if (callable_ast->kind == ZEND_AST_METHOD_CALL
64436448
&& callable_ast->child[2]->kind == ZEND_AST_CALLABLE_CONVERT) {

0 commit comments

Comments
 (0)