public static function isStringCastable($value): bool
    {
        $result = false;
        $type = strtolower(gettype($value));
        switch ($type) {
            case 'string':
            case 'null':
            case 'boolean':
            case 'integer':
            case 'double':
                $result = true;
                break;
            case 'object':
                if (method_exists($value, '__toString')) {
                    $result = true;
                }
                break;
            default:
                break;
        }

        return $result;
    }
public static function isStringCastable($value): bool
    {
        $result = false;
        $type = strtolower(gettype($value));
        switch ($type) {
            case 'string':
            case 'null':
            case 'boolean':
            case 'integer':
            case 'double':
                $result = true;
                break;
            case 'object':
                if (method_exists($value, '__toString')) {
                    $result = true;
                }
                break;
            default:
                break;
        }

        return $result;
    }
public static function isStringCastable ( $ value ) : bool { $ result = false ; $ type = strtolower ( gettype ( $ value ) ) ; switch ( $ type ) { case 'string' : case 'null' : case 'boolean' : case 'integer' : case 'double' : $ result = true ; break ; case 'object' : if ( method_exists ( $ value , '__toString' ) ) { $ result = true ; } break ; default : break ; } return $ result ; }
Checks if value can be cast to a string

@param mixed $value The value

@return bool
Checks if value can be cast to a string