https://psalm.dev/r/439491af3d
There should be an error for non-empty-string in both cases, not only in the case with %d.
It seems there is some return type provider in psalm for this already, but I couldn't find it. @orklah could you point me to the file that has it?