PHP7_2.test 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. --TEST--
  2. PHP 7.2 test.
  3. --RULESET--
  4. {
  5. "@Symfony": true,
  6. "single_import_per_statement": true
  7. }
  8. --REQUIREMENTS--
  9. {"php": 70200}
  10. --EXPECT--
  11. <?php
  12. namespace Foo;
  13. class C
  14. {
  15. public function A($a, object $b): object
  16. {
  17. unset($a);
  18. return $b;
  19. }
  20. }
  21. // Allow abstract function override
  22. abstract class XA
  23. {
  24. abstract public function bar(stdClass $x);
  25. }
  26. abstract class XB extends XA
  27. {
  28. abstract public function bar($x): stdClass;
  29. }
  30. class XC extends XB
  31. {
  32. public function bar($x): stdClass
  33. {
  34. }
  35. }
  36. // Parameter Type Widening
  37. class ArrayClass
  38. {
  39. public function foo(array $foo)
  40. { /* ... */
  41. }
  42. }
  43. class EverythingClass extends ArrayClass
  44. {
  45. public function foo($foo)
  46. { /* ... */
  47. }
  48. }
  49. --INPUT--
  50. <?php
  51. namespace Foo;
  52. use Bar\{
  53. A,
  54. B,
  55. };
  56. class C
  57. {
  58. public function A($a, object $b): object {
  59. unset($a);
  60. return $b;
  61. }
  62. }
  63. // Allow abstract function override
  64. abstract class XA { abstract function bar(stdClass $x); }
  65. abstract class XB extends XA { abstract function bar($x): stdClass; }
  66. class XC extends XB { function bar($x): stdClass{} }
  67. // Parameter Type Widening
  68. class ArrayClass {
  69. public function foo(array $foo) { /* ... */ }
  70. }
  71. class EverythingClass extends ArrayClass {
  72. public function foo($foo) { /* ... */ }
  73. }