PHP7_1.test 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. --TEST--
  2. PHP 7.1 test.
  3. --RULESET--
  4. {
  5. "@Symfony": true
  6. }
  7. --EXPECT--
  8. <?php
  9. function iterable_foo(iterable $foo): void
  10. {
  11. try {
  12. $str = 'abcdef';
  13. echo $str[-2];
  14. } catch (ExceptionType1|ExceptionType2 $e) {
  15. // Code to handle the exception
  16. } catch (\Exception $e) {
  17. // ...
  18. }
  19. }
  20. class A
  21. {
  22. public const b = 1;
  23. }
  24. interface Contract
  25. {
  26. public function method(?Foo $foo): ?bool;
  27. }
  28. class Implementation implements Contract
  29. {
  30. public function method(Foo $foo = null): ?bool
  31. {
  32. return is_null($foo);
  33. }
  34. }
  35. list(list('x' => $x1, 'y' => $y1), list('x' => $x2, 'y' => $y2)) = $points;
  36. list('first' => list($x1, $y1), 'second' => list($x2, $y2)) = $points;
  37. [$a, $b, $c] = [1, 2, 3];
  38. --INPUT--
  39. <?php
  40. function iterable_foo(iterable$foo) : void {try{$str='abcdef'; echo $str[ -2 ]; } catch (ExceptionType1 | ExceptionType2 $e) {
  41. // Code to handle the exception
  42. } catch (\Exception $e) {
  43. // ...
  44. }}
  45. class A
  46. {
  47. PUBLIC CONST b = 1;
  48. }
  49. interface Contract {
  50. public function method(?Foo $foo): ?bool;
  51. }
  52. class Implementation implements Contract {
  53. public function method(?Foo $foo = null): ?bool
  54. {
  55. return is_null($foo);
  56. }
  57. }
  58. list(list("x" => $x1, "y" => $y1), list("x" => $x2, "y" => $y2)) = $points;
  59. list("first" => list($x1, $y1), "second" => list($x2, $y2)) = $points;
  60. [$a, $b, $c] = [1, 2, 3];