mirror of
https://github.com/php/php-src.git
synced 2024-09-21 18:07:23 +00:00
064b464448
RFC: https://wiki.php.net/rfc/constructor_promotion Closes GH-5291.
54 lines
1.0 KiB
PHP
54 lines
1.0 KiB
PHP
--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
|
|
) {
|
|
|
|
}
|
|
}
|
|
|
|
/** Correct docblock */
|
|
$func = function(
|
|
/** wrong docblock */
|
|
$arg
|
|
) {
|
|
};
|
|
|
|
/** Correct docblock */
|
|
$func2 = fn(
|
|
/** wrong docblock */
|
|
$arg
|
|
) => null;
|
|
|
|
$reflectionFunction = new ReflectionFunction('foo');
|
|
$reflectionClass = new ReflectionClass(Foo::class);
|
|
$reflectionClosure = new ReflectionFunction($func);
|
|
$reflectionArrowFn = new ReflectionFunction($func2);
|
|
|
|
echo $reflectionFunction->getDocComment() . PHP_EOL;
|
|
echo $reflectionClass->getMethod('bar')->getDocComment() . PHP_EOL;
|
|
echo $reflectionClosure->getDocComment() . PHP_EOL;
|
|
echo $reflectionArrowFn->getDocComment() . PHP_EOL;
|
|
|
|
echo "Done\n";
|
|
?>
|
|
--EXPECT--
|
|
/** Correct docblock */
|
|
/** Correct docblock */
|
|
/** Correct docblock */
|
|
/** Correct docblock */
|
|
Done
|