xref: /PHP-8.1/ext/reflection/tests/bug79062.phpt (revision 6c48da9a)
1--TEST--
2Bug #79062: Property with heredoc default value returns false for getDocComment
3--FILE--
4<?php
5
6class BugReportMailrcConfigTests
7{
8    /** @var string */
9    private $s1 = <<<STRING
10I'm a string :(
11STRING;
12    /** @var string */
13    private $s2 = <<<'STRING'
14I'm a string :)
15STRING;
16    /** @var string */
17    private $s3 = 'I\'m a string :)';
18}
19
20$ref = new \ReflectionClass(BugReportMailrcConfigTests::class);
21$s1 = $ref->getProperty('s1');
22var_dump($s1->getDocComment());
23
24$s2 = $ref->getProperty('s2');
25var_dump($s2->getDocComment());
26
27$s3 = $ref->getProperty('s3');
28var_dump($s2->getDocComment());
29
30?>
31--EXPECT--
32string(18) "/** @var string */"
33string(18) "/** @var string */"
34string(18) "/** @var string */"
35