Closed vitkutny closed 3 months ago
Calling is_numeric on string converts variable type to float/int. It should remain string – specificaly can be changed to numeric-string similar to phpstan behaviour https://phpstan.org/writing-php-code/phpdoc-types#other-advanced-string-types
is_numeric
numeric-string
Code with error:
$string = '0123'; if (is_numeric($string)) { echo trim($string, '0'); # Argument '1' passed to trim() is expected to be of type string, float|int given – PHP0406 }
Expected result: no error
thanks, this inferring will be removed for now.
Calling
is_numeric
on string converts variable type to float/int. It should remain string – specificaly can be changed tonumeric-string
similar to phpstan behaviour https://phpstan.org/writing-php-code/phpdoc-types#other-advanced-string-typesCode with error:
Expected result: no error