Skip to content

Misinterpreting Whether Regular Expression Piece Exists #11602

@oleibman

Description

@oleibman

Bug report

This is a most unwelcome development with PhpStan 1.12.0. Our code has many examples like the issue below, where a capturing group must exist if a capturing group in which it is defined exists. In our example, matches[3] is tested for existence with isset, and, since it does exist, matches[4] and matches[5] must also exist. I would be satisfied if the offending new check were removed, but, if not, then further analysis is required to check if nested groups must exist.

Code snippet that reproduces the problem

https://phpstan.org/r/10819497-432a-41c9-91c4-9c4ef8d53d5f

Expected output

No errors should be detected in the code.

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

I am a little frustrated with it today. But I am normally extremely pleased with it.

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