Change record status: 
Project: 
Introduced in branch: 
8.x
Description: 

Under special circumstances like the installer and early bootstrap, not all services can be used.
Previously the container was consulted directly, now there is a helper function on the \Drupal class.

// Before
if (!\Drupal::getContainer()->has('request')) {
  // Something not using the request.
}
// After
if (!\Drupal::hasService('request')) {
  // Something not using the request.
}
Impacts: 
Module developers