Skip to content

Regex wildcard omitted from type #12211

@jtojnar

Description

@jtojnar

Bug report

When a wildcard character (.) is included in a regex capture group, the inferred type will be as if the wildcard was not there:

preg_match("((m.x))", ..., $match) // ^ array{string, 'mx'}

Code snippet that reproduces the problem

https://phpstan.org/r/ca2201e5-a8d0-410d-894f-c95fa6dcc2fa

Expected output

In this case, the capture group should probably result in a non-falsy-string, like ((m.+x)) would.

Related: #12210

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