Missing error detection for some functions #9940
Replies: 1 comment
-
Before PHP 8, PHP used to specifically support numeric-string for abs: https://www.php.net/manual/en/function.abs.php#refsect1-function.abs-changelog It has led to a specific signature in Psalm's internals: https://github.com/vimeo/psalm/blob/e3f589d79e6ced49336cec5016dd9abce9c310ba/dictionaries/CallMap.php#L92 so that it specifically accepts strings that are numeric That was not removed for PHP 8 though: If you feel like scratching that itch, you should be able to just copy the |
Beta Was this translation helpful? Give feedback.
-
Hey folks,
during a recent PHP 8 upgrade, we noticed that Psalm seems to be missing error detection for some functions.
In particular, we set up a Psalm config to only report
InvalidScalarArgument
errors:And created a basic test script:
When running Psalm on this test script, only the
floor()
function reports an error, even though all of these functions require a validint|float
:Are we missing something?
Edit: Running the test script on https://psalm.dev, at least
chr()
gets reported as well.abs()
is still not reported, though:Beta Was this translation helpful? Give feedback.
All reactions