src/Valkyrja/Routing/Annotations/NativeRouteAnnotations.php
protected function validatePath(string $path): string
    {
        // Trim slashes from the beginning and end of the path
        $path = trim($path, '/');

        // If the path only had a slash
        if (! $path) {
            // Return as just slash
            return '/';
        }

        // If the route doesn't begin with an optional or required group
        if ($path[0] !== '[' && $path[0] !== '<') {
            // Append a slash
            return '/' . $path;
        }

        return $path;
    }
protected function validatePath(string $path): string
    {
        // Trim slashes from the beginning and end of the path
        $path = trim($path, '/');

        // If the path only had a slash
        if (! $path) {
            // Return as just slash
            return '/';
        }

        // If the route doesn't begin with an optional or required group
        if ($path[0] !== '[' && $path[0] !== '<') {
            // Append a slash
            return '/' . $path;
        }

        return $path;
    }
Validate a path.

@param string $path The path

@return string