Skip to content

strpos() can never return -1 #3790

@staabm

Description

@staabm

Bug report

I would expect phpstan to error, because strpos cannot return a negative number:
https://phpstan.org/r/7dc3f972-bcac-4aea-8bbc-ae2b063146ff

this can be a common mistake, because people might be used to javascript in which the equivalent function returns -1

real world bug caused by this typo: https://github.com/justinrainbow/json-schema/pull/641/files

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