Skip to content

Trimming a numeric-string might also return a numeric-string #10860

@Dean151

Description

@Dean151

Feature request

There are string functions that we can send numeric string into, that will often return numeric string.
Examples:

  • trim, rtrim, ltrim on a numeric-string will either be empty, or a numeric string. But if second parameter is not dynamic and not a number, we can know for sure that it'll return a numeric-string as well. Example: ltrim($number, '-') will be numeric, and is a nice way of getting the absolute value of a numeric-string.

Given the proper guidance, and assuming this would be accepted, I'd be happy to contribute and open a pull request on phpstan-src.

Thanks for maintaining this awesome software!

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

PHPStan helps me everyday on my personal codebases. And it's also an incredible tool to help me improve the overall quality on the business code of my employer.
Thank you so much!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions