X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fseekat;a=blobdiff_plain;f=lib%2FAPI%2FContentType%2FHandler%2FText.php;h=1f13a61bd7d0d9ba7ae0adcea2d63a0915d0c808;hp=25e6e805875f1abed6ff3cd5d0834ab8ba3b61f2;hb=HEAD;hpb=2121556150be871684b5046af7cf250b8219128d 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; } }