PHP7_4.test 1.8 KB

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