bug75079.phpt 513 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. --TEST--
  2. Bug #75079: self keyword leads to incorrectly generated TypeError when in closure in trait
  3. --FILE--
  4. <?php
  5. trait Foo
  6. {
  7. public function selfDo(self ...$Selfs)
  8. {
  9. array_map(
  10. function (self $Self) : self
  11. {
  12. return $Self;
  13. },
  14. $Selfs
  15. );
  16. }
  17. }
  18. class Bar
  19. {
  20. use Foo;
  21. }
  22. class Baz
  23. {
  24. use Foo;
  25. }
  26. $Bar = new Bar;
  27. $Baz = new Baz;
  28. $Bar->selfDo($Bar, $Bar);
  29. $Baz->selfDo($Baz, $Baz);
  30. ?>
  31. ===DONE===
  32. --EXPECT--
  33. ===DONE===