src/Type/Definition/StringType.php
public function serialize($value)
    {
        if ($value === true) {
            return 'true';
        }
        if ($value === false) {
            return 'false';
        }
        if ($value === null) {
            return 'null';
        }
        if (is_object($value) && method_exists($value, '__toString')) {
            return (string) $value;
        }
        if (! is_scalar($value)) {
            throw new Error('String cannot represent non scalar value: ' . Utils::printSafe($value));
        }

        return $this->coerceString($value);
    }
public function serialize($value)
    {
        if ($value === true) {
            return 'true';
        }
        if ($value === false) {
            return 'false';
        }
        if ($value === null) {
            return 'null';
        }
        if (is_object($value) && method_exists($value, '__toString')) {
            return (string) $value;
        }
        if (! is_scalar($value)) {
            throw new Error('String cannot represent non scalar value: ' . Utils::printSafe($value));
        }

        return $this->coerceString($value);
    }
public function serialize ( $ value ) { if ( $ value === true ) { return 'true' ; } if ( $ value === false ) { return 'false' ; } if ( $ value === null ) { return 'null' ; } if ( is_object ( $ value ) && method_exists ( $ value , '__toString' ) ) { return ( string ) $ value ; } if ( ! is_scalar ( $ value ) ) { throw new Error ( 'String cannot represent non scalar value: ' . Utils :: printSafe ( $ value ) ) ; } return $ this -> coerceString ( $ value ) ; }
@param mixed $value

@return mixed|string

@throws Error
@param mixed $value