summaryrefslogtreecommitdiff
path: root/ext/reflection/tests/bug71767.phpt
blob: 95094290bf3402b2321757753dc21827fb2f71c1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
--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