php-parser/test/code/prettyPrinter/expr/arrow_function.test
Nikita Popov e03d63cffb Fix precedence of arrow functions
Arrow functions should have lowest precedence.

Fixes #769.
2021-04-25 22:19:49 +02:00

22 lines
366 B
Plaintext

Arrow function
-----
<?php
fn($a) => $a;
fn($x = 42) => $x;
fn(&$x) => $x;
fn&($x) => $x;
static fn($x, ...$rest) => $rest;
fn(): int => $x;
fn($a, $b) => $a and $b;
fn($a, $b) => $a && $b;
-----
!!php7
fn($a) => $a;
fn($x = 42) => $x;
fn(&$x) => $x;
fn&($x) => $x;
static fn($x, ...$rest) => $rest;
fn(): int => $x;
fn($a, $b) => $a and $b;
fn($a, $b) => $a && $b;