Skip to content

Property with heredoc default is always seen as not having a type #2742

@AJenbo

Description

@AJenbo

Bug report

A property that has a default in the heredoc format will always be seen as not having a type, this isn't the case for a regular string or Nowdoc

PHPStan 0.12.3

Code snippet that reproduces the problem

<?php declare(strict_types = 1);

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

https://phpstan.org/r/e225ae46-945f-4327-bff5-77df51e1bf5b

Expected output

[OK] No errors

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions