Skip to content

False positive with substr_count #5513

@enumag

Description

@enumag

Bug report

substr_count() can't return a negative integer. Somehow PHPStan knows that on PHP 7 but not on PHP 8.

Code snippet that reproduces the problem

https://phpstan.org/r/1a52b064-480a-4891-826a-64f4f833ea41

Expected output

No error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions