constants_comments_001.phpt 583 B

12345678910111213141516171819202122232425262728293031323334
  1. --TEST--
  2. Class constants and doc comments
  3. --INI--
  4. opcache.save_comments=1
  5. --FILE--
  6. <?php
  7. class X {
  8. /** comment X1 */
  9. const X1 = 1;
  10. const X2 = 2;
  11. /** comment X3 */
  12. const X3 = 3;
  13. }
  14. class Y extends X {
  15. /** comment Y1 */
  16. const Y1 = 1;
  17. const Y2 = 2;
  18. /** comment Y3 */
  19. const Y3 = 3;
  20. }
  21. $r = new ReflectionClass('Y');
  22. foreach ($r->getReflectionConstants() as $rc) {
  23. echo $rc->getName() . " : " . $rc->getDocComment() . "\n";
  24. }
  25. ?>
  26. --EXPECT--
  27. Y1 : /** comment Y1 */
  28. Y2 :
  29. Y3 : /** comment Y3 */
  30. X1 : /** comment X1 */
  31. X2 :
  32. X3 : /** comment X3 */