Skip to content

Matching $ with preg_match results in non-empty-string instead of string #14575

@tacovandenbroek

Description

@tacovandenbroek

Bug report

When a regular expression might match $ (end of subject), phpstan thinks the matched value always is a non-empty-string.

Code snippet that reproduces the problem

https://phpstan.org/r/b7eec0b8-6a8a-47e2-85a9-c5ddb2833d30

Expected output

I would expect the output to be:

Dumped type: array{string}

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

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions