Skip to content

String interpolation like "hello {$world}" loses literal-string type #5994

@NLthijs48

Description

@NLthijs48

Bug report

Concatenation of two literal-strings will make the result a literal-string as well, but using string interpolation it does not make the result a literal-string, but instead makes it a non-empty-string.

Code snippet that reproduces the problem

https://phpstan.org/r/c3a9d482-2963-4711-949c-7c387c2aff89

Expected output

I would expect no error from the string interpolation, and allow it to continue as a literal-string. Maybe I'm missing something though and this is intended behavior, let me know what you think.

Did PHPStan help you today? Did it make you happy in any way?

Congratulations with reaching version 1 😄 , looking forward to using all features of it (I already have a couple of them enabled using experimental flags of the previous version)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions