guzzle / uri-template

MIT License
145 stars 8 forks source link

Make sure UriTemplate::expand() returns a string #8

Closed GrahamCampbell closed 4 years ago

GrahamCampbell commented 4 years ago

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!

GrahamCampbell commented 4 years ago

Gonna make part of https://github.com/guzzle/uri-template/pull/6.