php-parser/test/code/prettyPrinter/expr/arrow_function.test

22 lines
366 B
Plaintext
Raw Normal View History

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;