Skip to content

preg: improve tagged unions #11528

Closed
phpstan/phpdoc-parser
#248
@ondrejmirtes

Description

@ondrejmirtes

Bug report

Hi @staabm,
I thought I already reported this but can't find it. In phpdoc-parser we have this piece of code and it's currently causing a false positive. Do you think that with the recent tagged unions improvements, we could fix this? The idea is that if $str[0] === 'u' then $matches[2] exists.

Maybe it's not a problem with the regex array shapes anymore, but rather with the $str[0] === 'u', not sure.

Can you look into it? Thanks.

Code snippet that reproduces the problem

https://phpstan.org/r/11eb77e5-ad9c-4eae-bc16-16755aeff9ec

Expected output

if $str[0] === 'u' then $matches[2] exists.

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

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions