PHP8_1.test 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. --TEST--
  2. PHP 8.1 test.
  3. --RULESET--
  4. {
  5. "@PhpCsFixer": true,
  6. "@PHP81Migration": true
  7. }
  8. --REQUIREMENTS--
  9. {"php": 80100}
  10. --EXPECT--
  11. <?php
  12. // https://wiki.php.net/rfc/readonly_properties_v2
  13. final class Foo
  14. {
  15. public readonly string $c;
  16. public readonly string $prop;
  17. public readonly string $b;
  18. }
  19. // https://wiki.php.net/rfc/noreturn_type
  20. function endProgram(): never
  21. {
  22. exit;
  23. }
  24. // https://wiki.php.net/rfc/fsync_function
  25. fsync($fp);
  26. $a = fdatasync($fp);
  27. // https://wiki.php.net/rfc/explicit_octal_notation
  28. $a = 0o16 === 14;
  29. $b = 0o744;
  30. // https://wiki.php.net/rfc/is_list
  31. $a = array_is_list($z);
  32. // https://wiki.php.net/rfc/final_class_const
  33. interface I
  34. {
  35. final public const Y = 'i';
  36. }
  37. // https://wiki.php.net/rfc/fsync_function
  38. fsync($fp);
  39. // https://wiki.php.net/rfc/explicit_octal_notation
  40. 0o16 === 14;
  41. // https://wiki.php.net/rfc/new_in_initializers
  42. class TestNewWithInitialiers
  43. {
  44. public function __construct(
  45. private Logger $logger = new NullLogger(),
  46. ) {}
  47. }
  48. --INPUT--
  49. <?php
  50. // https://wiki.php.net/rfc/readonly_properties_v2
  51. final class Foo
  52. {
  53. public READONLY string $c;
  54. READONLY string $prop, $b;
  55. }
  56. // https://wiki.php.net/rfc/noreturn_type
  57. function endProgram(): NEVER
  58. {
  59. die();
  60. }
  61. // https://wiki.php.net/rfc/fsync_function
  62. FSYNC($fp);
  63. $a = Fdatasync($fp);
  64. // https://wiki.php.net/rfc/explicit_octal_notation
  65. $a = 0O16 === 14;
  66. $b = 0744;
  67. // https://wiki.php.net/rfc/is_list
  68. $a = Array_Is_List($z);
  69. // https://wiki.php.net/rfc/final_class_const
  70. interface I
  71. {
  72. FINAL PUBLIC CONST Y = "i";
  73. }
  74. // https://wiki.php.net/rfc/fsync_function
  75. FSYNC($fp);
  76. // https://wiki.php.net/rfc/explicit_octal_notation
  77. 0O16 === 14;
  78. // https://wiki.php.net/rfc/new_in_initializers
  79. class TestNewWithInitialiers
  80. {
  81. public function __construct(
  82. private Logger $logger = new NullLogger,
  83. ) {
  84. }
  85. }