/
PHP7_4.test
82 lines (80 loc) · 1.74 KB
/
PHP7_4.test
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
--TEST--
PHP 7.4 test.
--RULESET--
{
"@Symfony": true,
"array_syntax": false,
"braces": false,
"class_definition": false,
"no_null_property_initialization": true,
"no_unset_on_property": true,
"pow_to_exponentiation": true,
"trailing_comma_in_multiline": {"after_heredoc": true},
"visibility_required": false
}
--REQUIREMENTS--
{"php": 70400}
--EXPECT--
<?php
// https://wiki.php.net/rfc/numeric_literal_separator
echo 10_0 ** 2;
if (1_000 === $b);
// https://wiki.php.net/rfc/null_coalesce_equal_operator
$a ??= 1;
$a ??= $b;
// https://wiki.php.net/rfc/spread_operator_for_array
$x = array(...$foo);
$x = [...$foo];
$x = array(...$foo, ...$bar);
$x = [...$foo, ...$bar];
$x = array(
...$foo,
...$bar,
);
$x = [
...$foo,
...$bar,
];
$x = array(...$foo, ...$bar);
$x = [...$foo, ...$bar];
// https://wiki.php.net/rfc/typed_properties_v2
class Foo {
private ?int $foo;
protected string $bar;
public iterable $baz;
var ?Foo\Bar $qux;
}
// https://wiki.php.net/rfc/arrow_functions_v2
$foo = fn ($v) => (string) $v;
--INPUT--
<?php
// https://wiki.php.net/rfc/numeric_literal_separator
echo pow(10_0, 2);
if ($b === 1_000);
// https://wiki.php.net/rfc/null_coalesce_equal_operator
$a??=1;
$a ??= $b;
// https://wiki.php.net/rfc/spread_operator_for_array
$x = array(...$foo, );
$x = [...$foo, ];
$x = array(...$foo , ...$bar);
$x = [...$foo , ...$bar];
$x = array(
...$foo,
...$bar
);
$x = [
...$foo,
...$bar
];
$x = array(...$foo,...$bar);
$x = [...$foo,...$bar];
// https://wiki.php.net/rfc/typed_properties_v2
class Foo {
private ?int $foo;
protected string $bar;
public iterable $baz;
var ? Foo\Bar $qux;
}
// https://wiki.php.net/rfc/arrow_functions_v2
$foo = fn ($v)=> (string)$v;