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