`array_splice` type and side effects not handled properly
#8,202 opened on Jun 29, 2022
Description
I recently updated to 5.0.0-beta1 for a PHP 8.1-based project, and now I'm getting an error reported with array_splice().
https://psalm.dev/r/367fd63316
I'm having PHP take a chunk of items off an array in C code, so it takes fewer interpreter steps to get the work done. But Psalm doesn't seem to realize that the return value from splice matches the input type (including preserving string keys), or that the splice changes the array it is given.
Building the equivalent with a for-loop and array_shift() is accepted, or else there is an error in my own understanding.
I'm unsure when I last checked this exact code in Psalm 4.x. The exact version I'm using reports itself as Psalm 5.0.0-beta1@f960d71b7e8dccb0815bce28a22a33ce5410e361.