ReflectionFunction_getDocComment.001.phpt 607 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  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. --FILE--
  9. <?php
  10. /**
  11. * my doc comment
  12. */
  13. function foo () {
  14. static $c;
  15. static $a = 1;
  16. static $b = "hello";
  17. $d = 5;
  18. }
  19. /***
  20. * not a doc comment
  21. */
  22. function bar () {}
  23. function dumpFuncInfo($name) {
  24. $funcInfo = new ReflectionFunction($name);
  25. var_dump($funcInfo->getDocComment());
  26. }
  27. dumpFuncInfo('foo');
  28. dumpFuncInfo('bar');
  29. dumpFuncInfo('extract');
  30. ?>
  31. --EXPECTF--
  32. string(%d) "/**
  33. * my doc comment
  34. */"
  35. bool(false)
  36. bool(false)