http-message icon indicating copy to clipboard operation
http-message copied to clipboard

declare `__toString` as `@throws void`

Open staabm opened this issue 4 years ago • 0 comments

with this change static analysis tools are able to detect implementations which throw.

see https://phpstan.org/r/90fcf22e-b99b-4455-bf32-a9a7078fbb39

technically throwing from __toString() is allowed since php 7.4+, but since the contract explicitly mentions this should not be done, I figured declaring the respective phpdoc would be a improvement.

staabm avatar Nov 26 '21 14:11 staabm