comments.test 823 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. Comment changes
  2. -----
  3. <?php
  4. // Test
  5. foo();
  6. -----
  7. $stmts[0]->setAttribute('comments', []);
  8. -----
  9. <?php
  10. foo();
  11. -----
  12. <?php
  13. $foo;
  14. /* bar */
  15. $baz;
  16. -----
  17. $comments = $stmts[1]->getComments();
  18. $comments[] = new Comment("// foo");
  19. $stmts[1]->setAttribute('comments', $comments);
  20. -----
  21. <?php
  22. $foo;
  23. /* bar */
  24. // foo
  25. $baz;
  26. -----
  27. <?php
  28. class Test {
  29. /**
  30. * @expectedException \FooException
  31. */
  32. public function test() {
  33. // some code
  34. }
  35. }
  36. -----
  37. $method = $stmts[0]->stmts[0];
  38. $method->setAttribute('comments', [new Comment\Doc("/**\n *\n */")]);
  39. -----
  40. <?php
  41. class Test {
  42. /**
  43. *
  44. */
  45. public function test() {
  46. // some code
  47. }
  48. }
  49. -----
  50. <?php
  51. class Example {
  52. }
  53. -----
  54. $stmts[0]->setDocComment(new Comment\Doc("/** foo */"));
  55. -----
  56. <?php
  57. /** foo */
  58. class Example {
  59. }