Well yes, that's the whole point. You cant just pass an empty string and be done with it, it has to be a StreamableInterface intaance. It doesnt seem elegant to create an empty one just for that purpose
--
You received this message because you are subscribed to a topic in the Google Groups "PHP Framework Interoperability Group" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/php-fig/c7amaAhnZbg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to php-fig+u...@googlegroups.com.
To post to this group, send email to php...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/php-fig/981974d6-19e4-4425-9728-701551229d76%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to the Google Groups "PHP Framework Interoperability Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to php-fig+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/php-fig/CANamvv13CABFGgrboNxP5wHeZg%2BwR1_%3DC-fJawUtfMAeciXV-Q%40mail.gmail.com.
Its not really about overhead or some optimization. I just like the idea of being able to use withBody(null).
Also allowing nullable geyBody turns it to an optional parameter. So insteaf of passing 'new StringStream('')' I could just use null.
To view this discussion on the web visit https://groups.google.com/d/msgid/php-fig/45FC7F6D-96F5-49E3-84A2-4125DB006C61%40gmail.com.
Well yes the null check is a downside, although in a lot of cases when reading a message a (string) cast will be used anyway:
echo (string) $response->getBody();
In this case null works perfectly
--
You received this message because you are subscribed to a topic in the Google Groups "PHP Framework Interoperability Group" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/php-fig/c7amaAhnZbg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to php-fig+u...@googlegroups.com.
To post to this group, send email to php...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/php-fig/5535AF82.1070509%40gmail.com.
That would fix nothing since StringStream('') would still be there just in a different place
You can write your specific implementation which converts null argument to empty stream inside, this will keep getBody() behavior consistent.
To view this discussion on the web visit https://groups.google.com/d/msgid/php-fig/f977eb1d-51b5-4420-a111-81e75dda9509%40googlegroups.com.
I think it's clear that there is no "fix" needed here, I would argue that the null conditional is plenty to decide against this.
To view this discussion on the web visit https://groups.google.com/d/msgid/php-fig/CANamvv360T1vWC%3DWgzLjM7u75Qzph9t2t6KKNUHyrHi_u8bAvQ%40mail.gmail.com.
Ah, well, lets leave it at that then. Its not that huge of a deal anyeway and the conditional argument does make sense
To view this discussion on the web visit https://groups.google.com/d/msgid/php-fig/CANeXGWWxzGz7OUJhLvrKzOkANhYkKWCiqu59QJ%3DwwvDgORBa6Q%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/php-fig/CANamvv3feCWNOBpStoiTfP7Pb5s60-3Go-k2FG_VV%2B%3Ds_%2Bm%2BFA%40mail.gmail.com.