It could never have returned string[]. I assume that change was incorrectly advised by phpstan. We should actually say we return a string, and fail loudly if replacement fails due to some internal preg error. This is going to be what consumers of this code expect. The old return type would have made the library horrible to use, having to check if the template returned a string or not, each time!
It could never have returned
string[]
. I assume that change was incorrectly advised by phpstan. We should actually say we return a string, and fail loudly if replacement fails due to some internal preg error. This is going to be what consumers of this code expect. The old return type would have made the library horrible to use, having to check if the template returned a string or not, each time!