Change record status: 
Project: 
Introduced in branch: 
9.3.x
Introduced in version: 
9.3.0
Description: 

The function file_build_uri() has been deprecated. There is no direct replacement for this function.

It does two things: Combine the default schema with the provided path and normalize it.

For an exact replacement, the current implementation, the current code of the function can be used:

Before:
$uri = file_build_uri($path)

After:

  $uri = \Drupal::config('system.file')->get('default_scheme') . '://' . $path;
  /** @var \Drupal\Core\StreamWrapper\StreamWrapperManagerInterface $stream_wrapper_manager */
  $stream_wrapper_manager = \Drupal::service('stream_wrapper_manager');
  $uri = $stream_wrapper_manager->normalizeUri($uri);

However, normalizing the path is not necessary if it's a hardcoded module folder, e.g. file_build_uri('my_module') to store something, so only the first line needs to be used: \Drupal::config('system.file')->get('default_scheme') . '://my_module'

For configurable path locations, it is recommended to include the stream wrapper explicitly, either as a separate configuration option like file fields or combined in a textfield.

Impacts: 
Module developers