ReflectionFunction_getDocComment.001.phpt 614 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. --TEST--
  2. ReflectionFunction::getDocComment()
  3. --CREDITS--
  4. Robin Fernandes <robinf@php.net>
  5. Steve Seear <stevseea@php.net>
  6. --INI--
  7. opcache.save_comments=1
  8. opcache.load_comments=1
  9. --FILE--
  10. <?php
  11. /**
  12. * my doc comment
  13. */
  14. function foo () {
  15. static $c;
  16. static $a = 1;
  17. static $b = "hello";
  18. $d = 5;
  19. }
  20. /***
  21. * not a doc comment
  22. */
  23. function bar () {}
  24. function dumpFuncInfo($name) {
  25. $funcInfo = new ReflectionFunction($name);
  26. var_dump($funcInfo->getDocComment());
  27. }
  28. dumpFuncInfo('foo');
  29. dumpFuncInfo('bar');
  30. dumpFuncInfo('extract');
  31. ?>
  32. --EXPECTF--
  33. string(%d) "/**
  34. * my doc comment
  35. */"
  36. bool(false)
  37. bool(false)