|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #79062 Property with heredoc default value returns false for getDocComment
Submitted: 2020-01-04 13:11 UTC Modified: 2020-01-05 11:42 UTC
Avg. Score:2.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: ondrej at mirtes dot cz Assigned:
Status: Verified Package: Reflection related
PHP Version: 7.4.1 OS: any
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: ondrej at mirtes dot cz
New email:
PHP Version: OS:


 [2020-01-04 13:11 UTC] ondrej at mirtes dot cz
If property is assigned a default string value in the form of heredoc, its ReflectionProperty::getDocComment() returns false even if there's a PHPDoc.

Looks like this bug was introduced in PHP 7.3.0:

Related PHPStan bug:

Test script:

class BugReportMailrcConfigTests
    /** @var string */
    private $s1 = <<<STRING
I'm a string :(
    /** @var string */
    private $s2 = <<<'STRING'
I'm a string :)
    /** @var string */
    private $s3 = 'I\'m a string :)';

$ref = new \ReflectionClass(BugReportMailrcConfigTests::class);
$s1 = $ref->getProperty('s1');

$s2 = $ref->getProperty('s2');

$s3 = $ref->getProperty('s3');

Expected result:
string(18) "/** @var string */"
string(18) "/** @var string */"
string(18) "/** @var string */"

Actual result:
string(18) "/** @var string */"
string(18) "/** @var string */"


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2020-01-05 11:42 UTC]
-Status: Open +Status: Verified
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Tue Feb 25 00:01:26 2020 UTC