### Bug report Hi, I have found a small issue after upgrading to newest phpstan `2.1.39` (from 2.1.36), and got reported ``` Parameter #1 $value of function intval expects array|bool|float|int|resource|string|null, SimpleXMLElement given. ``` Even when official doc says > intval() should not be used on objects, as doing so will emit an E_WARNING level error and return 1. it works without a warning and looks like a special case. (https://3v4l.org/cOvks#v8.5.3) ### Code snippet that reproduces the problem https://phpstan.org/r/974d2e74-2e37-461b-814f-1a3d8d84b4a9 ### Expected output No error reported ### Did PHPStan help you today? Did it make you happy in any way? _No response_
Activity
VincentLanglet commentedon Feb 17, 2026
NB you have no error with
(int)https://phpstan.org/r/8111387c-a024-47ff-8e5d-ddacf8ef510bbecause it rely on
toIntmethod in ObjectTypehttps://github.com/phpstan/phpstan-src/blob/c2da2e89e611749d0d455133c1ec482ab936efc6/src/Type/ObjectType.php#L64
but for intval, it's https://github.com/phpstan/phpstan-src/blob/c2da2e89e611749d0d455133c1ec482ab936efc6/resources/functionMap.php#L5078
if you want to work on the PR.
Other
*valshould be checked/updated.But since it's a special case which is not even documented, I'm not sure if we should add it...
phpstan-bot commentedon Feb 28, 2026
Closed via merging phpstan/phpstan-src#5020
github-actions commentedon Apr 1, 2026
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.