diff --git a/core/includes/bootstrap.inc b/core/includes/bootstrap.inc
index 8e24668..37d35ad 100644
--- a/core/includes/bootstrap.inc
+++ b/core/includes/bootstrap.inc
@@ -1,28 +1,19 @@
 <?php
 
 use Drupal\Component\Utility\Crypt;
-use Drupal\Component\Utility\NestedArray;
 use Drupal\Component\Utility\Settings;
 use Drupal\Component\Utility\String;
 use Drupal\Component\Utility\Timer;
 use Drupal\Component\Utility\Unicode;
-use Drupal\Component\Utility\Url;
 use Drupal\Core\DrupalKernel;
-use Drupal\Core\Database\Database;
-use Drupal\Core\DependencyInjection\ContainerBuilder;
 use Drupal\Core\Extension\ExtensionDiscovery;
 use Drupal\Core\Utility\Title;
 use Drupal\Core\Utility\Error;
 use Symfony\Component\ClassLoader\ApcClassLoader;
-use Symfony\Component\DependencyInjection\ContainerInterface;
-use Symfony\Component\DependencyInjection\Container;
-use Symfony\Component\DependencyInjection\Reference;
 use Symfony\Component\DependencyInjection\Exception\RuntimeException as DependencyInjectionRuntimeException;
 use Symfony\Component\HttpFoundation\Request;
 use Symfony\Component\HttpFoundation\Response;
 use Drupal\Core\Language\Language;
-use Drupal\Core\Lock\DatabaseLockBackend;
-use Drupal\Core\Lock\LockBackendInterface;
 use Drupal\Core\Session\UserSession;
 
 /**
@@ -335,6 +326,7 @@ function find_conf_path($http_host, $script_name, $require_settings = TRUE) {
  *   (optional) The type of config directory to return. Drupal core provides
  *   'active' and 'staging'. Defaults to CONFIG_ACTIVE_DIRECTORY.
  *
+ * @throws Exception
  * @return string
  *   The configuration directory path.
  */
@@ -473,7 +465,9 @@ function drupal_environment_initialize() {
 /**
  * Validates that a hostname (for example $_SERVER['HTTP_HOST']) is safe.
  *
- * @return
+ * @param string
+ *
+ * @return bool
  *  TRUE if only containing valid characters, or FALSE otherwise.
  */
 function drupal_valid_http_host($host) {
@@ -635,15 +629,15 @@ function _drupal_request_initialize() {
  * Calling drupal_get_filename('module', 'foo') will give you one of
  * the above, depending on where the module is located.
  *
- * @param $type
+ * @param string $type
  *   The type of the item (theme, theme_engine, module, profile).
- * @param $name
+ * @param string $name
  *   The name of the item for which the filename is requested.
- * @param $filename
+ * @param string $filename
  *   The filename of the item if it is to be set explicitly rather
  *   than by consulting the database.
  *
- * @return
+ * @return string|null
  *   The filename of the requested item or NULL if the item is not found.
  */
 function drupal_get_filename($type, $name, $filename = NULL) {
@@ -693,6 +687,8 @@ function drupal_get_filename($type, $name, $filename = NULL) {
   if (isset($files[$type][$name])) {
     return $files[$type][$name];
   }
+
+  return NULL;
 }
 
 /**
@@ -737,22 +733,24 @@ function drupal_page_cache_get_cid(Request $request) {
  * @param \Symfony\Component\HttpFoundation\Request $request
  *   The request for this page.
  *
- * @return
+ * @return object|null
  *   The cache object, if the page was found in the cache, NULL otherwise.
  */
 function drupal_page_get_cache(Request $request) {
   if (drupal_page_is_cacheable()) {
     return \Drupal::cache('page')->get(drupal_page_cache_get_cid($request));
   }
+
+  return NULL;
 }
 
 /**
  * Determines the cacheability of the current page.
  *
- * @param $allow_caching
+ * @param bool $allow_caching
  *   Set to FALSE if you want to prevent this page to get cached.
  *
- * @return
+ * @return bool
  *   TRUE if the current page can be cached, FALSE otherwise.
  */
 function drupal_page_is_cacheable($allow_caching = NULL) {
@@ -761,7 +759,8 @@ function drupal_page_is_cacheable($allow_caching = NULL) {
     $allow_caching_static = $allow_caching;
   }
 
-  return $allow_caching_static && ($_SERVER['REQUEST_METHOD'] == 'GET' || $_SERVER['REQUEST_METHOD'] == 'HEAD')
+  return $allow_caching_static
+    && ($_SERVER['REQUEST_METHOD'] == 'GET' || $_SERVER['REQUEST_METHOD'] == 'HEAD')
     && !drupal_is_cli();
 }
 
@@ -771,13 +770,13 @@ function drupal_page_is_cacheable($allow_caching = NULL) {
  * Note: When sending a Content-Type header, always include a 'charset' type,
  * too. This is necessary to avoid security bugs (e.g. UTF-7 XSS).
  *
- * @param $name
+ * @param string $name
  *   The HTTP header name, or the special 'Status' header name.
- * @param $value
+ * @param string|false $value
  *   The HTTP header value; if equal to FALSE, the specified header is unset.
  *   If $name is 'Status', this is expected to be a status code followed by a
  *   reason phrase, e.g. "404 Not Found".
- * @param $append
+ * @param bool $append
  *   Whether to append the value to an existing header or to replace it.
  *
  * @deprecated in Drupal 8.x-dev, will be removed before Drupal 8.0.
@@ -807,11 +806,11 @@ function drupal_add_http_header($name, $value, $append = FALSE) {
 /**
  * Gets the HTTP response headers for the current page.
  *
- * @param $name
+ * @param string $name
  *   An HTTP header name. If omitted, all headers are returned as name/value
  *   pairs. If an array value is FALSE, the header has been unset.
  *
- * @return
+ * @return string
  *   A string containing the header value, or FALSE if the header has been set,
  *   or NULL if the header has not been set.
  *
@@ -836,6 +835,10 @@ function drupal_get_http_header($name = NULL) {
  * Header names are case-insensitive, but for maximum compatibility they should
  * follow "common form" (see RFC 2616, section 4.2).
  *
+ * @param string $name
+ *
+ * @return array|null
+ *
  * @deprecated in Drupal 8.x-dev, will be removed before Drupal 8.0.
  *   See https://drupal.org/node/2181523.
  */
@@ -846,6 +849,8 @@ function _drupal_set_preferred_header_name($name = NULL) {
     return $header_names;
   }
   $header_names[strtolower($name)] = $name;
+
+  return NULL;
 }
 
 /**
@@ -917,6 +922,8 @@ function drupal_send_headers($default_headers = array(), $only_default = FALSE)
  *
  * @see drupal_page_set_cache()
  *
+ * @return true|null
+ *
  * @deprecated in Drupal 8.x-dev, will be removed before Drupal 8.0.
  *   See https://drupal.org/node/2181523.
  */
@@ -934,6 +941,8 @@ function drupal_page_header() {
     'ETag' => '"' . REQUEST_TIME . '"',
   );
   drupal_send_headers($default_headers);
+
+  return NULL;
 }
 
 /**
@@ -1064,27 +1073,27 @@ function drupal_serve_page_from_cache(stdClass $cache, Response $response, Reque
  * @code
  * $text = t("@name's blog", array('@name' => user_format_name($account)));
  * @endcode
- * Basically, you can put variables like @name into your string, and t() will
+ * Basically, you can put variables like '@name' into your string, and t() will
  * substitute their sanitized values at translation time. (See the
  * Localization API pages referenced above and the documentation of
  * format_string() for details about how to define variables in your string.)
  * Translators can then rearrange the string as necessary for the language
  * (e.g., in Spanish, it might be "blog de @name").
  *
- * @param $string
+ * @param string $string
  *   A string containing the English string to translate.
- * @param $args
+ * @param array $args
  *   An associative array of replacements to make after translation. Based
  *   on the first character of the key, the value is escaped and/or themed.
  *   See format_string() for details.
- * @param $options
+ * @param array $options
  *   An associative array of additional options, with the following elements:
  *   - 'langcode' (defaults to the current language): The language code to
  *     translate to a language other than what is used to display the page.
  *   - 'context' (defaults to the empty context): The context the source string
  *     belongs to.
  *
- * @return
+ * @return string
  *   The translated string.
  *
  * @see format_string()
@@ -1136,10 +1145,10 @@ function check_plain($text) {
  * The function does not return FALSE for strings containing character codes
  * above U+10FFFF, even though these are prohibited by RFC 3629.
  *
- * @param $text
+ * @param string $text
  *   The text to check.
  *
- * @return
+ * @return bool
  *   TRUE if the text is valid UTF-8, FALSE if not.
  *
  * @see \Drupal\Component\Utility\Unicode::validateUtf8()
@@ -1183,20 +1192,20 @@ function request_uri($omit_query_string = FALSE) {
  * This is a wrapper function for watchdog() which automatically decodes an
  * exception.
  *
- * @param $type
+ * @param string $type
  *   The category to which this message belongs.
- * @param $exception
+ * @param Exception $exception
  *   The exception that is going to be logged.
- * @param $message
+ * @param string $message
  *   The message to store in the log. If empty, a text that contains all useful
  *   information about the passed-in exception is used.
- * @param $variables
+ * @param array $variables
  *   Array of variables to replace in the message on display or
  *   NULL if message is already translated or not possible to
  *   translate.
- * @param $severity
+ * @param int $severity
  *   The severity of the message, as per RFC 3164.
- * @param $link
+ * @param string $link
  *   A link to associate with the message.
  *
  * @see watchdog()
@@ -1404,7 +1413,7 @@ function drupal_get_messages($type = NULL, $clear_queue = TRUE) {
  *
  * The title is displayed on the page and in the title bar.
  *
- * @return
+ * @return string
  *   The current page's title.
  */
 function drupal_get_title() {
@@ -1416,17 +1425,17 @@ function drupal_get_title() {
  *
  * The title is displayed on the page and in the title bar.
  *
- * @param $title
+ * @param string $title
  *   Optional string value to assign to the page title; or if set to NULL
  *   (default), leaves the current title unchanged.
- * @param $output
+ * @param int $output
  *   Optional flag - normally should be left as Title::CHECK_PLAIN. Only set to
  *   PASS_THROUGH if you have already removed any possibly dangerous code
  *   from $title using a function like
  *   \Drupal\Component\Utility\String::checkPlain() or filter_xss(). With this
  *   flag the string will be passed through unchanged.
  *
- * @return
+ * @return string
  *   The updated title of the current page.
  */
 function drupal_set_title($title = NULL, $output = Title::CHECK_PLAIN) {
@@ -1484,7 +1493,7 @@ function drupal_anonymous_user() {
  *   - DRUPAL_BOOTSTRAP_FULL: Fully loads Drupal. Validates and fixes input
  *     data.
  *
- * @return
+ * @return string
  *   The most recently completed phase.
  */
 function drupal_bootstrap($phase = NULL) {
@@ -1617,7 +1626,8 @@ function drupal_get_user_timezone() {
 /**
  * Gets a salt useful for hardening against SQL injection.
  *
- * @return
+ * @throws RuntimeException
+ * @return string
  *   A salt based on information in settings.php, not in the database.
  */
 function drupal_get_hash_salt() {
@@ -1767,6 +1777,10 @@ function _drupal_bootstrap_page_cache() {
     $cache = drupal_page_get_cache($request);
     // If there is a cached page, display it.
     if (is_object($cache)) {
+      if (!$cache instanceof stdClass) {
+        $cache_class = get_class($cache);
+        throw new \Exception("\$cache must be an instance of stdClass, not $cache_class.");
+      }
       $response = new Response();
       $response->headers->set('X-Drupal-Cache', 'HIT');
       // Restore the metadata cached with the page.
@@ -2028,6 +2042,8 @@ function drupal_language_initialize() {
  * @param string $type
  *   The type of language object needed, e.g. Language::TYPE_INTERFACE.
  *
+ * @return \Drupal\Core\Language\Language
+ *
  * @deprecated in Drupal 8.x-dev, will be removed before Drupal 8.0.
  *   Use \Drupal::languageManager()->getCurrentLanguage().
  */
@@ -2038,7 +2054,7 @@ function language($type) {
 /**
  * Returns a list of languages set up on the site.
  *
- * @param $flags
+ * @param int $flags
  *   (optional) Specifies the state of the languages that have to be returned.
  *   It can be: Language::STATE_CONFIGURABLE, Language::STATE_LOCKED,
  *   Language::STATE_ALL.
@@ -2060,7 +2076,7 @@ function language_list($flags = Language::STATE_CONFIGURABLE) {
  * @param string $langcode
  *   The language code.
  *
- * @return \Drupal\core\Language\Language|null
+ * @return \Drupal\Core\Language\Language|null
  *   A fully-populated language object or NULL.
  *
  * @see \Drupal\Core\Language\LanguageManager::getLanguage()
@@ -2099,7 +2115,7 @@ function language_default() {
  * - http://example.com/index.php returns an empty string (meaning: front page).
  * - http://example.com/index.php?page=1 returns an empty string.
  *
- * @return
+ * @return string
  *   The requested Drupal URL path.
  *
  * @see current_path()
@@ -2161,13 +2177,13 @@ function _current_path($path = NULL) {
  * When attempting to use this function to load an element from the current
  * path, e.g. loading the node on a node page, use menu_get_object() instead.
  *
- * @param $index
+ * @param int|null $index
  *   The index of the component, where each component is separated by a '/'
  *   (forward-slash), and where the first component has an index of 0 (zero).
- * @param $path
+ * @param string|null $path
  *   A path to break into components. Defaults to the path of the current page.
  *
- * @return
+ * @return string|array|null
  *   The component specified by $index, or NULL if the specified component was
  *   not found. If called without arguments, it returns an array containing all
  *   the components of the current path.
@@ -2198,6 +2214,8 @@ function arg($index = NULL, $path = NULL) {
   if (isset($arguments[$path][$index])) {
     return $arguments[$path][$index];
   }
+
+  return NULL;
 }
 
 /**
@@ -2207,7 +2225,7 @@ function arg($index = NULL, $path = NULL) {
  * classes, interfaces, and traits (PHP 5.4 and later). It's only dependency
  * is DRUPAL_ROOT. Otherwise it may be called as early as possible.
  *
- * @param $class_loader
+ * @param string $class_loader
  *   The name of class loader to use. This can be used to change the class
  *   loader class when calling drupal_classloader() from settings.php. It is
  *   ignored otherwise.
@@ -2352,21 +2370,21 @@ function drupal_classloader_register($name, $path) {
  * }
  * @endcode
  *
- * @param $name
+ * @param string $name
  *   Globally unique name for the variable. For a function with only one static,
  *   variable, the function name (e.g. via the PHP magic __FUNCTION__ constant)
  *   is recommended. For a function with multiple static variables add a
  *   distinguishing suffix to the function name for each one.
- * @param $default_value
+ * @param mixed|null $default_value
  *   Optional default value.
- * @param $reset
+ * @param bool $reset
  *   TRUE to reset a specific named variable, or all variables if $name is NULL.
  *   Resetting every variable should only be used, for example, for running
  *   unit tests with a clean environment. Should be used only though via
  *   function drupal_static_reset() and the return value should not be used in
  *   this case.
  *
- * @return
+ * @return mixed
  *   Returns a variable by reference.
  *
  * @see drupal_static_reset()
@@ -2407,7 +2425,7 @@ function &drupal_static($name, $default_value = NULL, $reset = FALSE) {
 /**
  * Resets one or all centrally stored static variable(s).
  *
- * @param $name
+ * @param string $name
  *   Name of the static variable to reset. Omit to reset all variables.
  */
 function drupal_static_reset($name = NULL) {
@@ -2436,12 +2454,12 @@ function drupal_placeholder($text) {
  * Wrapper for register_shutdown_function() that catches thrown exceptions to
  * avoid "Exception thrown without a stack frame in Unknown".
  *
- * @param $callback
+ * @param callback $callback
  *   The shutdown function to register.
  * @param ...
  *   Additional arguments to pass to the shutdown function.
  *
- * @return
+ * @return callback[]
  *   Array of shutdown functions to be executed.
  *
  * @see register_shutdown_function()
@@ -2500,17 +2518,17 @@ function _drupal_shutdown_function() {
 /**
  * Compares the memory required for an operation to the available memory.
  *
- * @param $required
+ * @param string $required
  *   The memory required for the operation, expressed as a number of bytes with
  *   optional SI or IEC binary unit prefix (e.g. 2, 3K, 5MB, 10G, 6GiB, 8bytes,
  *   9mbytes).
- * @param $memory_limit
+ * @param string $memory_limit
  *   (optional) The memory limit for the operation, expressed as a number of
  *   bytes with optional SI or IEC binary unit prefix (e.g. 2, 3K, 5MB, 10G,
  *   6GiB, 8bytes, 9mbytes). If no value is passed, the current PHP
  *   memory_limit will be used. Defaults to NULL.
  *
- * @return
+ * @return bool
  *   TRUE if there is sufficient memory to allow the operation, or FALSE
  *   otherwise.
  */
@@ -2524,7 +2542,9 @@ function drupal_check_memory_limit($required, $memory_limit = NULL) {
   // - The memory limit is set to unlimited (-1).
   // - The memory limit is greater than or equal to the memory required for
   //   the operation.
-  return ((!$memory_limit) || ($memory_limit == -1) || (parse_size($memory_limit) >= parse_size($required)));
+  return !$memory_limit
+    || $memory_limit == -1
+    || parse_size($memory_limit) >= parse_size($required);
 }
 
 /**
