X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;ds=inline;f=lib%2FAPI%2FContentType%2FHandler%2FText.php;h=1f13a61bd7d0d9ba7ae0adcea2d63a0915d0c808;hb=654d736df2c46ec2520f73e9089d06a44f2b9c50;hp=25e6e805875f1abed6ff3cd5d0834ab8ba3b61f2;hpb=2121556150be871684b5046af7cf250b8219128d;p=m6w6%2Fseekat diff --git a/lib/API/ContentType/Handler/Text.php b/lib/API/ContentType/Handler/Text.php index 25e6e80..1f13a61 100644 --- a/lib/API/ContentType/Handler/Text.php +++ b/lib/API/ContentType/Handler/Text.php @@ -17,21 +17,20 @@ final class Text implements Handler { /** * @inheritdoc - * @param string $data */ - function encode($data): Body { + function encode(mixed $data): Body { if (isset($data) && !is_scalar($data)) { throw new InvalidArgumentException( "Text encoding argument must be scalar, got ".typeof($data)); } - return (new Body)->append($data); + return (new Body)->append((string) $data); } /** * @inheritdoc * @return string */ - function decode(Body $body) { + function decode(Body $body) : string { return (string) $body; } }