2016-03-11 16:28:45 +00:00
|
|
|
--TEST--
|
|
|
|
Bug #71767 (ReflectionMethod::getDocComment returns the wrong comment)
|
|
|
|
--FILE--
|
|
|
|
<?php
|
|
|
|
|
|
|
|
/** Correct docblock */
|
|
|
|
function foo(
|
|
|
|
/** wrong docblock */
|
|
|
|
$arg
|
|
|
|
) {
|
|
|
|
}
|
|
|
|
|
|
|
|
class Foo {
|
|
|
|
/** Correct docblock */
|
|
|
|
public function bar(
|
|
|
|
/** wrong docblock */
|
|
|
|
$arg
|
|
|
|
) {
|
2018-09-16 17:16:42 +00:00
|
|
|
|
2016-03-11 16:28:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Correct docblock */
|
|
|
|
$func = function(
|
|
|
|
/** wrong docblock */
|
|
|
|
$arg
|
|
|
|
) {
|
|
|
|
};
|
|
|
|
|
2020-03-24 12:18:28 +00:00
|
|
|
/** Correct docblock */
|
|
|
|
$func2 = fn(
|
|
|
|
/** wrong docblock */
|
|
|
|
$arg
|
|
|
|
) => null;
|
|
|
|
|
2016-03-11 16:28:45 +00:00
|
|
|
$reflectionFunction = new ReflectionFunction('foo');
|
|
|
|
$reflectionClass = new ReflectionClass(Foo::class);
|
|
|
|
$reflectionClosure = new ReflectionFunction($func);
|
2020-03-24 12:18:28 +00:00
|
|
|
$reflectionArrowFn = new ReflectionFunction($func2);
|
2016-03-11 16:28:45 +00:00
|
|
|
|
|
|
|
echo $reflectionFunction->getDocComment() . PHP_EOL;
|
|
|
|
echo $reflectionClass->getMethod('bar')->getDocComment() . PHP_EOL;
|
|
|
|
echo $reflectionClosure->getDocComment() . PHP_EOL;
|
2020-03-24 12:18:28 +00:00
|
|
|
echo $reflectionArrowFn->getDocComment() . PHP_EOL;
|
2016-03-11 16:28:45 +00:00
|
|
|
|
|
|
|
echo "Done\n";
|
|
|
|
?>
|
2018-02-19 08:59:41 +00:00
|
|
|
--EXPECT--
|
2016-03-11 16:28:45 +00:00
|
|
|
/** Correct docblock */
|
|
|
|
/** Correct docblock */
|
|
|
|
/** Correct docblock */
|
2020-03-24 12:18:28 +00:00
|
|
|
/** Correct docblock */
|
2016-03-11 16:28:45 +00:00
|
|
|
Done
|