objectAccess.test 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. Object access
  2. -----
  3. <?php
  4. // property fetch variations
  5. $a->b;
  6. $a->b['c'];
  7. $a->b{'c'};
  8. // method call variations
  9. $a->b();
  10. $a->{'b'}();
  11. $a->$b();
  12. $a->$b['c']();
  13. // array dereferencing
  14. $a->b()['c'];
  15. $a->b(){'c'}; // invalid PHP: drop Support?
  16. -----
  17. array(
  18. 0: Expr_PropertyFetch(
  19. var: Expr_Variable(
  20. name: a
  21. )
  22. name: b
  23. )
  24. 1: Expr_ArrayDimFetch(
  25. var: Expr_PropertyFetch(
  26. var: Expr_Variable(
  27. name: a
  28. )
  29. name: b
  30. )
  31. dim: Scalar_String(
  32. value: c
  33. )
  34. )
  35. 2: Expr_ArrayDimFetch(
  36. var: Expr_PropertyFetch(
  37. var: Expr_Variable(
  38. name: a
  39. )
  40. name: b
  41. )
  42. dim: Scalar_String(
  43. value: c
  44. )
  45. )
  46. 3: Expr_MethodCall(
  47. var: Expr_Variable(
  48. name: a
  49. )
  50. name: b
  51. args: array(
  52. )
  53. )
  54. 4: Expr_MethodCall(
  55. var: Expr_Variable(
  56. name: a
  57. )
  58. name: Scalar_String(
  59. value: b
  60. )
  61. args: array(
  62. )
  63. )
  64. 5: Expr_MethodCall(
  65. var: Expr_Variable(
  66. name: a
  67. )
  68. name: Expr_Variable(
  69. name: b
  70. )
  71. args: array(
  72. )
  73. )
  74. 6: Expr_MethodCall(
  75. var: Expr_Variable(
  76. name: a
  77. )
  78. name: Expr_ArrayDimFetch(
  79. var: Expr_Variable(
  80. name: b
  81. )
  82. dim: Scalar_String(
  83. value: c
  84. )
  85. )
  86. args: array(
  87. )
  88. )
  89. 7: Expr_ArrayDimFetch(
  90. var: Expr_MethodCall(
  91. var: Expr_Variable(
  92. name: a
  93. )
  94. name: b
  95. args: array(
  96. )
  97. )
  98. dim: Scalar_String(
  99. value: c
  100. )
  101. )
  102. 8: Expr_ArrayDimFetch(
  103. var: Expr_MethodCall(
  104. var: Expr_Variable(
  105. name: a
  106. )
  107. name: b
  108. args: array(
  109. )
  110. )
  111. dim: Scalar_String(
  112. value: c
  113. )
  114. )
  115. )