classMethodNop.test 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. Adding statement to Class Method containing Nop
  2. -----
  3. <?php
  4. class Foo {
  5. public function __construct()
  6. {
  7. // I'm just a comment
  8. }
  9. }
  10. -----
  11. $stmts[0]->stmts[0]->stmts[] = new Stmt\Expression(new Node\Expr\Variable('foo'));
  12. -----
  13. <?php
  14. class Foo {
  15. public function __construct()
  16. {
  17. // I'm just a comment
  18. $foo;
  19. }
  20. }
  21. -----
  22. <?php
  23. class Foo {
  24. public function __construct()
  25. {
  26. /* I'm just a comment */
  27. }
  28. }
  29. -----
  30. $stmts[0]->stmts[0]->stmts[] = new Stmt\Expression(new Node\Expr\Variable('foo'));
  31. -----
  32. <?php
  33. class Foo {
  34. public function __construct()
  35. {
  36. /* I'm just a comment */
  37. $foo;
  38. }
  39. }
  40. -----
  41. <?php
  42. class Foo {
  43. public function __construct()
  44. {
  45. /* I'm just a comment */
  46. }
  47. }
  48. -----
  49. $stmts[0]->stmts[0]->stmts[0]->setAttribute('comments', [new Comment("/* I'm a new comment */")]);
  50. -----
  51. <?php
  52. class Foo {
  53. public function __construct()
  54. {
  55. /* I'm a new comment */
  56. }
  57. }
  58. -----
  59. <?php
  60. class Foo {
  61. public function __construct()
  62. {
  63. // I'm just a comment
  64. }
  65. }
  66. -----
  67. $stmts[0]->stmts[0]->stmts[0]->setAttribute('comments', [new Comment("// I'm a new comment\n")]);
  68. -----
  69. <?php
  70. class Foo {
  71. public function __construct()
  72. {
  73. // I'm a new comment
  74. }
  75. }