Skip to content

preg_match() and preg_match_all() $matches type mixed #6426

@staabm

Description

@staabm

Feature request

I think phpstan should have a better idea about the type $matches has after a preg_match or preg_match_all call.
atm it seems it is always inferred as mixed.

it should at least know that we are only dealing with strings in $matches

I just leave it here as a feature request (so I don't forget), as I did not thought yet about the details.

maybe we can get some inspiration about types in https://github.com/composer/pcre

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions