anonclass.php 788 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. declare(strict_types = 1);
  3. namespace Dummy\Test;
  4. use Dummy\Common\TestCase;
  5. class AnonClassHolder extends TestCase
  6. {
  7. protected function getTest(): ClassAvailability
  8. {
  9. return new class extends ClassAvailability
  10. {
  11. };
  12. }
  13. protected function getTest2(): ClassAvailability
  14. {
  15. return new class(2) extends ClassAvailability
  16. {
  17. };
  18. }
  19. protected function getTest3(): ClassAvailability
  20. {
  21. return new class(2, 3) extends ClassAvailability
  22. {
  23. };
  24. }
  25. protected function getTest4(): ClassAvailability
  26. {
  27. return new class(2, 3) {
  28. };
  29. }
  30. protected function getTest5(): ClassAvailability
  31. {
  32. return new class implements FooInterface {
  33. };
  34. }
  35. }