-
-
Notifications
You must be signed in to change notification settings - Fork 932
Open
phpstan/phpstan-src
#4550Description
Bug report
PHPStan incorrectly reports a type error when using ltrim() with the result of number_format() inside strlen()
function ok(): int {
return strlen(number_format(15, 0, '', ''));
}
/**
* @param numeric-string $str
*/
function ok2(string $str): int {
return strlen($str);
}
function fail(): int {
return strlen(ltrim(number_format(15, 0, '', ''), '-'));
}Error: Parameter #1 $string of function strlen expects string, numeric-string given.
Code snippet that reproduces the problem
https://phpstan.org/r/73c4b606-2bc7-4450-8c0d-3bdc7867dd75
Expected output
No error
Did PHPStan help you today? Did it make you happy in any way?
No response
Metadata
Metadata
Assignees
Labels
No labels