Closed sagikazarmark closed 7 years ago
According to the interface the allowed types are string|resource|StreamInterface|null, so an object would not be valid in the first place, you would have to cast it to string first.
yes, but there is no type check to avoid objects. what exactly do we fix with this? is writing '' to a stream a bug? or is it just to be strict?
Well, I guess you can technically pass objects there. There is a string casting before writting.
is writing '' to a stream a bug? or is it just to be strict?
I don't think it's a bug. But we spare an unnecessary write (and now a rewind) operation. Not sure if adding an extra cast just to check if the string value of something is empty worth it.
if objects are not supposed to be passed, i think we are good here. if you incorrectly pass an object, the behaviour does not change compared to previous, and should still not fail.
What's in this PR?
Stream factories now check empty strings as well, not just null values.