anonClasses.test 365 B

12345678910111213141516171819202122232425262728
  1. Anonymous classes
  2. -----
  3. <?php
  4. new class
  5. ($x)
  6. extends X
  7. { };
  8. -----
  9. $new = $stmts[0]->expr;
  10. $new->class->extends = null;
  11. $new->args[] = new Expr\Variable('y');
  12. -----
  13. <?php
  14. new class
  15. ($x, $y)
  16. { };
  17. -----
  18. <?php
  19. new class
  20. {};
  21. -----
  22. // Ignore name assigned to anon class
  23. $new = $stmts[0]->expr;
  24. $new->class->name = new Node\Identifier('Anon1');
  25. -----
  26. <?php
  27. new class
  28. {};