update to PHP-8.1
[m6w6/seekat] / lib / API / ContentType / Handler / Text.php
index 25e6e805875f1abed6ff3cd5d0834ab8ba3b61f2..1f13a61bd7d0d9ba7ae0adcea2d63a0915d0c808 100644 (file)
@@ -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;
        }
 }