bug71767.phpt 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. --TEST--
  2. Bug #71767 (ReflectionMethod::getDocComment returns the wrong comment)
  3. --FILE--
  4. <?php
  5. /** Correct docblock */
  6. function foo(
  7. /** wrong docblock */
  8. $arg
  9. ) {
  10. }
  11. class Foo {
  12. /** Correct docblock */
  13. public function bar(
  14. /** wrong docblock */
  15. $arg
  16. ) {
  17. }
  18. }
  19. /** Correct docblock */
  20. $func = function(
  21. /** wrong docblock */
  22. $arg
  23. ) {
  24. };
  25. /** Correct docblock */
  26. $func2 = fn(
  27. /** wrong docblock */
  28. $arg
  29. ) => null;
  30. $reflectionFunction = new ReflectionFunction('foo');
  31. $reflectionClass = new ReflectionClass(Foo::class);
  32. $reflectionClosure = new ReflectionFunction($func);
  33. $reflectionArrowFn = new ReflectionFunction($func2);
  34. echo $reflectionFunction->getDocComment() . PHP_EOL;
  35. echo $reflectionClass->getMethod('bar')->getDocComment() . PHP_EOL;
  36. echo $reflectionClosure->getDocComment() . PHP_EOL;
  37. echo $reflectionArrowFn->getDocComment() . PHP_EOL;
  38. echo "Done\n";
  39. ?>
  40. --EXPECT--
  41. /** Correct docblock */
  42. /** Correct docblock */
  43. /** Correct docblock */
  44. /** Correct docblock */
  45. Done