Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Phpstan could detect always true/false str_ function calls #14594

@VincentLanglet

Description

@VincentLanglet

Feature request

PHPStan has a StrContainingTypeSpecifyingExtension but nothing about the returnType.

In the following example, the return type is known
https://phpstan.org/r/31113597-4171-447b-ab83-4eb6ceaa1c66

Some rules could be written

  • For constants strings, it could be computed
  • For lowercase-string, if the needle is not a lowercase-string it will be false
  • For uppercase-string, if the needle is not a uppercase-string it will be false
  • For numeric-string, the needle should be compatible with the format [whitespace] [+/-] [digits] [.digits] [e/E [+/-] digits] [whitespace]

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

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions