Skip to content

Commit 0b40c32

Browse files
committed
Fix pipe error output.
1 parent 69a6feb commit 0b40c32

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

Zend/tests/pipe_operator/ast.phpt

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,16 @@ function _test(int $a): int {
1010
try {
1111
assert((5 |> '_test') == 99);
1212
} catch (AssertionError $e) {
13-
print $e->getMessage();
13+
print $e->getMessage() . PHP_EOL;
14+
}
15+
16+
try {
17+
assert((5 |> _test(...)) == 99);
18+
} catch (AssertionError $e) {
19+
print $e->getMessage() . PHP_EOL;
1420
}
1521

1622
?>
1723
--EXPECTF--
18-
assert(5 |> \_test == 99)
24+
assert(5 |> '_test' == 99)
25+
assert(5 |> _test(...) == 99)

Zend/zend_ast.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2506,6 +2506,11 @@ static ZEND_COLD void zend_ast_export_ex(smart_str *str, zend_ast *ast, int prio
25062506
zend_ast_export_name(str, ast->child[1], 0, indent);
25072507
}
25082508
break;
2509+
case ZEND_AST_PIPE:
2510+
zend_ast_export_ex(str, ast->child[0], 0, indent);
2511+
smart_str_appends(str, " |> ");
2512+
zend_ast_export_ex(str, ast->child[1], 0, indent);
2513+
break;
25092514
case ZEND_AST_NAMED_ARG:
25102515
smart_str_append(str, zend_ast_get_str(ast->child[0]));
25112516
smart_str_appends(str, ": ");

0 commit comments

Comments
 (0)