diff --git a/core/modules/file/css/file.admin.css b/core/modules/file/css/file.admin.css
index ff87783..80eb78d 100644
--- a/core/modules/file/css/file.admin.css
+++ b/core/modules/file/css/file.admin.css
@@ -1,4 +1,3 @@
-
 /**
  * @file
  * Admin stylesheet for file module.
diff --git a/core/modules/file/file.api.php b/core/modules/file/file.api.php
index 23a0291..5bbb7a9 100644
--- a/core/modules/file/file.api.php
+++ b/core/modules/file/file.api.php
@@ -5,6 +5,8 @@
  * Hooks for file module.
  */
 
+use Drupal\file\FileInterface;
+
 /**
  * @addtogroup hooks
  * @{
@@ -18,13 +20,14 @@
  *
  * @param \Drupal\file\FileInterface $file
  *   The file entity being validated.
- * @return
+ *
+ * @return array
  *   An array of error messages. If there are no problems with the file return
  *   an empty array.
  *
  * @see file_validate()
  */
-function hook_file_validate(Drupal\file\FileInterface $file) {
+function hook_file_validate(FileInterface $file) {
   $errors = array();
 
   if (!$file->getFilename()) {
@@ -47,7 +50,7 @@ function hook_file_validate(Drupal\file\FileInterface $file) {
  *
  * @see file_copy()
  */
-function hook_file_copy(Drupal\file\FileInterface $file, Drupal\file\FileInterface $source) {
+function hook_file_copy(FileInterface $file, FileInterface $source) {
   // Make sure that the file name starts with the owner's user name.
   if (strpos($file->getFilename(), $file->getOwner()->name) !== 0) {
     $file->setFilename($file->getOwner()->name . '_' . $file->getFilename());
@@ -67,7 +70,7 @@ function hook_file_copy(Drupal\file\FileInterface $file, Drupal\file\FileInterfa
  *
  * @see file_move()
  */
-function hook_file_move(Drupal\file\FileInterface $file, Drupal\file\FileInterface $source) {
+function hook_file_move(FileInterface $file, FileInterface $source) {
   // Make sure that the file name starts with the owner's user name.
   if (strpos($file->getFilename(), $file->getOwner()->name) !== 0) {
     $file->setFilename($file->getOwner()->name . '_' . $file->getFilename());
diff --git a/core/modules/file/file.field.inc b/core/modules/file/file.field.inc
index 3e88433..f863666 100644
--- a/core/modules/file/file.field.inc
+++ b/core/modules/file/file.field.inc
@@ -20,7 +20,7 @@
  *   An associative array containing:
  *   - element: A render element representing the file.
  */
-function template_preprocess_file_widget(&$variables) {
+function template_preprocess_file_widget(array &$variables) {
   $element = $variables['element'];
   if (!empty($element['fids']['#value'])) {
     // Add the file size after the file name.
@@ -29,7 +29,9 @@ function template_preprocess_file_widget(&$variables) {
   }
   $variables['element'] = $element;
   // The "form-managed-file" class is required for proper Ajax functionality.
-  $variables['attributes'] = array('class' => array('file-widget', 'form-managed-file', 'clearfix'));
+  $variables['attributes'] = array(
+    'class' => array('file-widget', 'form-managed-file', 'clearfix'),
+  );
 }
 
 /**
@@ -41,7 +43,7 @@ function template_preprocess_file_widget(&$variables) {
  *   An associative array containing:
  *   - element: A render element representing the widgets.
  */
-function template_preprocess_file_widget_multiple(&$variables) {
+function template_preprocess_file_widget_multiple(array &$variables) {
   $element = $variables['element'];
 
   // Special ID and classes for draggable tables.
@@ -160,7 +162,7 @@ function template_preprocess_file_widget_multiple(&$variables) {
  *   - upload_validators: An array of upload validators as used in
  *     $element['#upload_validators'].
  */
-function template_preprocess_file_upload_help(&$variables) {
+function template_preprocess_file_upload_help(array &$variables) {
   $description = $variables['description'];
   $upload_validators = $variables['upload_validators'];
   $cardinality = $variables['cardinality'];
diff --git a/core/modules/file/file.install b/core/modules/file/file.install
index 8d13c03..dc64477 100644
--- a/core/modules/file/file.install
+++ b/core/modules/file/file.install
@@ -64,6 +64,7 @@ function file_schema() {
  */
 function file_requirements($phase) {
   $requirements = array();
+  $t = get_t();
 
   // Check the server's ability to indicate upload progress.
   if ($phase == 'runtime') {
@@ -73,30 +74,30 @@ function file_requirements($phase) {
     $fastcgi = strpos($server_software, 'mod_fastcgi') !== FALSE || strpos($server_software, 'mod_fcgi') !== FALSE;
     $description = NULL;
     if (!$apache) {
-      $value = t('Not enabled');
-      $description = t('Your server is not capable of displaying file upload progress. File upload progress requires an Apache server running PHP with mod_php.');
+      $value = $t('Not enabled');
+      $description = $t('Your server is not capable of displaying file upload progress. File upload progress requires an Apache server running PHP with mod_php.');
     }
     elseif ($fastcgi) {
-      $value = t('Not enabled');
-      $description = t('Your server is not capable of displaying file upload progress. File upload progress requires PHP be run with mod_php and not as FastCGI.');
+      $value = $t('Not enabled');
+      $description = $t('Your server is not capable of displaying file upload progress. File upload progress requires PHP be run with mod_php and not as FastCGI.');
     }
     elseif (!$implementation && extension_loaded('apc')) {
-      $value = t('Not enabled');
-      $description = t('Your server is capable of displaying file upload progress through APC, but it is not enabled. Add <code>apc.rfc1867 = 1</code> to your php.ini configuration. Alternatively, it is recommended to use <a href="@url">PECL uploadprogress</a>, which supports more than one simultaneous upload.', array('@url' => 'http://pecl.php.net/package/uploadprogress'));
+      $value = $t('Not enabled');
+      $description = $t('Your server is capable of displaying file upload progress through APC, but it is not enabled. Add <code>apc.rfc1867 = 1</code> to your php.ini configuration. Alternatively, it is recommended to use <a href="@url">PECL uploadprogress</a>, which supports more than one simultaneous upload.', array('@url' => 'http://pecl.php.net/package/uploadprogress'));
     }
     elseif (!$implementation) {
-      $value = t('Not enabled');
-      $description = t('Your server is capable of displaying file upload progress, but does not have the required libraries. It is recommended to install the <a href="@uploadprogress_url">PECL uploadprogress library</a> (preferred) or to install <a href="@apc_url">APC</a>.', array('@uploadprogress_url' => 'http://pecl.php.net/package/uploadprogress', '@apc_url' => 'http://php.net/apc'));
+      $value = $t('Not enabled');
+      $description = $t('Your server is capable of displaying file upload progress, but does not have the required libraries. It is recommended to install the <a href="@uploadprogress_url">PECL uploadprogress library</a> (preferred) or to install <a href="@apc_url">APC</a>.', array('@uploadprogress_url' => 'http://pecl.php.net/package/uploadprogress', '@apc_url' => 'http://php.net/apc'));
     }
     elseif ($implementation == 'apc') {
-      $value = t('Enabled (<a href="@url">APC RFC1867</a>)', array('@url' => 'http://php.net/manual/apc.configuration.php#ini.apc.rfc1867'));
-      $description = t('Your server is capable of displaying file upload progress using APC RFC1867. Note that only one upload at a time is supported. It is recommended to use the <a href="@url">PECL uploadprogress library</a> if possible.', array('@url' => 'http://pecl.php.net/package/uploadprogress'));
+      $value = $t('Enabled (<a href="@url">APC RFC1867</a>)', array('@url' => 'http://php.net/manual/apc.configuration.php#ini.apc.rfc1867'));
+      $description = $t('Your server is capable of displaying file upload progress using APC RFC1867. Note that only one upload at a time is supported. It is recommended to use the <a href="@url">PECL uploadprogress library</a> if possible.', array('@url' => 'http://pecl.php.net/package/uploadprogress'));
     }
     elseif ($implementation == 'uploadprogress') {
-      $value = t('Enabled (<a href="@url">PECL uploadprogress</a>)', array('@url' => 'http://pecl.php.net/package/uploadprogress'));
+      $value = $t('Enabled (<a href="@url">PECL uploadprogress</a>)', array('@url' => 'http://pecl.php.net/package/uploadprogress'));
     }
     $requirements['file_progress'] = array(
-      'title' => t('Upload progress'),
+      'title' => $t('Upload progress'),
       'value' => $value,
       'description' => $description,
     );
diff --git a/core/modules/file/file.module b/core/modules/file/file.module
index 03e10bf..9f83779 100644
--- a/core/modules/file/file.module
+++ b/core/modules/file/file.module
@@ -81,7 +81,7 @@ function file_element_info() {
  *
  * @param array $fids
  *   (optional) An array of entity IDs. If omitted, all entities are loaded.
- * @param $reset
+ * @param bool $reset
  *   Whether to reset the internal file_load_multiple() cache.
  *
  * @return array
@@ -105,9 +105,9 @@ function file_load_multiple(array $fids = NULL, $reset = FALSE) {
 /**
  * Loads a single file entity from the database.
  *
- * @param $fid
+ * @param int $fid
  *   A file ID.
- * @param $reset
+ * @param bool $reset
  *   Whether to reset the internal file_load_multiple() cache.
  *
  * @return \Drupal\file\FileInterface
@@ -144,10 +144,10 @@ function file_load($fid, $reset = FALSE) {
  *
  * @param \Drupal\file\FileInterface $source
  *   A file entity.
- * @param $destination
+ * @param string $destination
  *   A string containing the destination that $source should be copied to.
  *   This must be a stream wrapper URI.
- * @param $replace
+ * @param int $replace
  *   Replace behavior when the destination file already exists:
  *   - FILE_EXISTS_REPLACE - Replace the existing file. If a managed file with
  *       the destination name exists then its database entry will be updated. If
@@ -156,7 +156,7 @@ function file_load($fid, $reset = FALSE) {
  *       unique.
  *   - FILE_EXISTS_ERROR - Do nothing and return FALSE.
  *
- * @return
+ * @return Drupal/Entity/EntityInterface
  *   File object if the copy is successful, or FALSE in the event of an error.
  *
  * @see file_unmanaged_copy()
@@ -165,7 +165,11 @@ function file_load($fid, $reset = FALSE) {
 function file_copy(FileInterface $source, $destination = NULL, $replace = FILE_EXISTS_RENAME) {
   if (!file_valid_uri($destination)) {
     if (($realpath = drupal_realpath($source->getFileUri())) !== FALSE) {
-      \Drupal::logger('file')->notice('File %file (%realpath) could not be copied because the destination %destination is invalid. This is often caused by improper use of file_copy() or a missing stream wrapper.', array('%file' => $source->getFileUri(), '%realpath' => $realpath, '%destination' => $destination));
+      \Drupal::logger('file')->notice('File %file (%realpath) could not be copied because the destination %destination is invalid. This is often caused by improper use of file_copy() or a missing stream wrapper.', array(
+        '%file' => $source->getFileUri(),
+        '%realpath' => $realpath,
+        '%destination' => $destination)
+      );
     }
     else {
       \Drupal::logger('file')->notice('File %file could not be copied because the destination %destination is invalid. This is often caused by improper use of file_copy() or a missing stream wrapper.', array('%file' => $source->getFileUri(), '%destination' => $destination));
@@ -219,10 +223,10 @@ function file_copy(FileInterface $source, $destination = NULL, $replace = FILE_E
  *
  * @param \Drupal\file\FileInterface $source
  *   A file entity.
- * @param $destination
+ * @param string $destination
  *   A string containing the destination that $source should be moved to.
  *   This must be a stream wrapper URI.
- * @param $replace
+ * @param int $replace
  *   Replace behavior when the destination file already exists:
  *   - FILE_EXISTS_REPLACE - Replace the existing file. If a managed file with
  *       the destination name exists then its database entry will be updated and
@@ -242,7 +246,11 @@ function file_copy(FileInterface $source, $destination = NULL, $replace = FILE_E
 function file_move(FileInterface $source, $destination = NULL, $replace = FILE_EXISTS_RENAME) {
   if (!file_valid_uri($destination)) {
     if (($realpath = drupal_realpath($source->getFileUri())) !== FALSE) {
-      \Drupal::logger('file')->notice('File %file (%realpath) could not be moved because the destination %destination is invalid. This may be caused by improper use of file_move() or a missing stream wrapper.', array('%file' => $source->getFileUri(), '%realpath' => $realpath, '%destination' => $destination));
+      \Drupal::logger('file')->notice('File %file (%realpath) could not be moved because the destination %destination is invalid. This may be caused by improper use of file_move() or a missing stream wrapper.', array(
+        '%file' => $source->getFileUri(),
+        '%realpath' => $realpath,
+        '%destination' => $destination)
+      );
     }
     else {
       \Drupal::logger('file')->notice('File %file could not be moved because the destination %destination is invalid. This may be caused by improper use of file_move() or a missing stream wrapper.', array('%file' => $source->getFileUri(), '%destination' => $destination));
@@ -295,7 +303,7 @@ function file_move(FileInterface $source, $destination = NULL, $replace = FILE_E
  *
  * @param \Drupal\file\FileInterface $file
  *   A file entity.
- * @param $validators
+ * @param array $validators
  *   An optional, associative array of callback functions used to validate the
  *   file. The keys are function names and the values arrays of callback
  *   parameters which will be passed in after the file entity. The
@@ -303,12 +311,12 @@ function file_move(FileInterface $source, $destination = NULL, $replace = FILE_E
  *   indicates that the file passed validation. The functions will be called in
  *   the order specified.
  *
- * @return
+ * @return array
  *   An array containing validation error messages.
  *
  * @see hook_file_validate()
  */
-function file_validate(FileInterface $file, $validators = array()) {
+function file_validate(FileInterface $file, array $validators = array()) {
   // Call the validation functions specified by this function's caller.
   $errors = array();
   foreach ($validators as $function => $args) {
@@ -328,7 +336,7 @@ function file_validate(FileInterface $file, $validators = array()) {
  * @param \Drupal\file\FileInterface $file
  *   A file entity.
  *
- * @return
+ * @return array|string
  *   An array. If the file name is too long, it will contain an error message.
  */
 function file_validate_name_length(FileInterface $file) {
@@ -348,10 +356,10 @@ function file_validate_name_length(FileInterface $file) {
  *
  * @param \Drupal\file\FileInterface $file
  *   A file entity.
- * @param $extensions
+ * @param string $extensions
  *   A string with a space separated list of allowed extensions.
  *
- * @return
+ * @return array|string
  *   An array. If the file extension is not allowed, it will contain an error
  *   message.
  *
@@ -372,14 +380,14 @@ function file_validate_extensions(FileInterface $file, $extensions) {
  *
  * @param \Drupal\file\FileInterface $file
  *   A file entity.
- * @param $file_limit
+ * @param int $file_limit
  *   An integer specifying the maximum file size in bytes. Zero indicates that
  *   no limit should be enforced.
- * @param $user_limit
+ * @param int $user_limit
  *   An integer specifying the maximum number of bytes the user is allowed.
  *   Zero indicates that no limit should be enforced.
  *
- * @return
+ * @return array|string
  *   An array. If the file size exceeds limits, it will contain an error
  *   message.
  *
@@ -407,7 +415,7 @@ function file_validate_size(FileInterface $file, $file_limit = 0, $user_limit =
  * @param \Drupal\file\FileInterface $file
  *   A file entity.
  *
- * @return
+ * @return array
  *   An array. If the file is not an image, it will contain an error message.
  *
  * @see hook_file_validate()
@@ -433,16 +441,16 @@ function file_validate_is_image(FileInterface $file) {
  *
  * @param \Drupal\file\FileInterface $file
  *   A file entity. This function may resize the file affecting its size.
- * @param $maximum_dimensions
+ * @param int $maximum_dimensions
  *   An optional string in the form WIDTHxHEIGHT e.g. '640x480' or '85x85'. If
  *   an image toolkit is installed the image will be resized down to these
  *   dimensions. A value of 0 indicates no restriction on size, so resizing
  *   will be attempted.
- * @param $minimum_dimensions
+ * @param int $minimum_dimensions
  *   An optional string in the form WIDTHxHEIGHT. This will check that the
  *   image meets a minimum size. A value of 0 indicates no restriction.
  *
- * @return
+ * @return array
  *   An array. If the file is an image and did not meet the requirements, it
  *   will contain an error message.
  *
@@ -486,13 +494,13 @@ function file_validate_image_resolution(FileInterface $file, $maximum_dimensions
 /**
  * Saves a file to the specified destination and creates a database entry.
  *
- * @param $data
+ * @param string $data
  *   A string containing the contents of the file.
- * @param $destination
+ * @param string $destination
  *   A string containing the destination URI. This must be a stream wrapper URI.
  *   If no value is provided, a randomized name will be generated and the file
  *   will be saved using Drupal's default files scheme, usually "public://".
- * @param $replace
+ * @param int $replace
  *   Replace behavior when the destination file already exists:
  *   - FILE_EXISTS_REPLACE - Replace the existing file. If a managed file with
  *       the destination name exists then its database entry will be updated. If
@@ -555,7 +563,7 @@ function file_save_data($data, $destination = NULL, $replace = FILE_EXISTS_RENAM
  * @param \Drupal\file\FileInterface $file
  *   A file entity.
  *
- * @return
+ * @return array
  *   An associative array of headers, as expected by
  *   \Symfony\Component\HttpFoundation\StreamedResponse.
  */
@@ -576,7 +584,12 @@ function file_theme() {
   return array(
     // From file.module.
     'file_link' => array(
-      'variables' => array('file' => NULL, 'icon_directory' => NULL, 'description' => NULL, 'attributes' => array()),
+      'variables' => array(
+        'file' => NULL,
+        'icon_directory' => NULL,
+        'description' => NULL,
+        'attributes' => array(),
+      ),
       'template' => 'file-link',
     ),
     'file_managed_file' => array(
@@ -596,7 +609,11 @@ function file_theme() {
       'file' => 'file.field.inc',
     ),
     'file_upload_help' => array(
-      'variables' => array('description' => NULL, 'upload_validators' => NULL, 'cardinality' => NULL),
+      'variables' => array(
+        'description' => NULL,
+        'upload_validators' => NULL,
+        'cardinality' => NULL,
+      ),
       'template' => 'file-upload-help',
       'file' => 'file.field.inc',
     ),
@@ -608,7 +625,7 @@ function file_theme() {
  */
 function file_file_download($uri) {
   // Get the file record based on the URI. If not in the database just return.
-  /** @var \Drupal\file\FileInterface[] $files */
+  /* @var \Drupal\file\FileInterface[] $files */
   $files = entity_load_multiple_by_properties('file', array('uri' => $uri));
   if (count($files)) {
     foreach ($files as $item) {
@@ -646,7 +663,7 @@ function file_file_download($uri) {
 }
 
 /**
- * Implements file_cron()
+ * Implements file_cron().
  */
 function file_cron() {
   $age = \Drupal::config('system.file')->get('temporary_maximum_age');
@@ -671,7 +688,10 @@ function file_cron() {
         }
       }
       else {
-        \Drupal::logger('file system')->info('Did not delete temporary file "%path" during garbage collection because it is in use by the following modules: %modules.', array('%path' => $file->getFileUri(), '%modules' => implode(', ', array_keys($references))));
+        \Drupal::logger('file system')->info('Did not delete temporary file "%path" during garbage collection because it is in use by the following modules: %modules.', array(
+          '%path' => $file->getFileUri(),
+          '%modules' => implode(', ', array_keys($references)),
+        ));
       }
     }
   }
@@ -684,12 +704,10 @@ function file_cron() {
  * Temporary files are periodically cleaned. Use the 'file.usage' service to
  * register the usage of the file which will automatically mark it as permanent.
  *
- * @param $form_field_name
+ * @param string $form_field_name
  *   A string that is the associative array key of the upload form element in
  *   the form array.
- * @param \Drupal\Core\Form\FormStateInterface $form_state
- *   The current state of the form.
- * @param $validators
+ * @param array $validators
  *   An optional, associative array of callback functions used to validate the
  *   file. See file_validate() for a full discussion of the array format.
  *   If no extension validator is provided it will default to a limited safe
@@ -698,20 +716,20 @@ function file_cron() {
  *   explicitly set the 'file_validate_extensions' validator to an empty array
  *   (Beware: this is not safe and should only be allowed for trusted users, if
  *   at all).
- * @param $destination
+ * @param string $destination
  *   A string containing the URI that the file should be copied to. This must
  *   be a stream wrapper URI. If this value is omitted, Drupal's temporary
  *   files scheme will be used ("temporary://").
- * @param $delta
+ * @param int $delta
  *   Delta of the file to save or NULL to save all files. Defaults to NULL.
- * @param $replace
+ * @param int $replace
  *   Replace behavior when the destination file already exists:
  *   - FILE_EXISTS_REPLACE: Replace the existing file.
  *   - FILE_EXISTS_RENAME: Append _{incrementing number} until the filename is
  *     unique.
  *   - FILE_EXISTS_ERROR: Do nothing and return FALSE.
  *
- * @return
+ * @return array
  *   Function returns array of files or a single file object if $delta
  *   != NULL. Each file object contains the file information if the
  *   upload succeeded or FALSE in the event of an error. Function
@@ -724,7 +742,7 @@ function file_cron() {
  *   - source: Path to the file before it is moved.
  *   - destination: Path to the file after it is moved (same as 'uri').
  */
-function file_save_upload($form_field_name, $validators = array(), $destination = FALSE, $delta = NULL, $replace = FILE_EXISTS_RENAME) {
+function file_save_upload($form_field_name, array $validators = array(), $destination = FALSE, $delta = NULL, $replace = FILE_EXISTS_RENAME) {
   $user = \Drupal::currentUser();
   static $upload_cache;
 
@@ -775,7 +793,7 @@ function file_save_upload($form_field_name, $validators = array(), $destination
           break;
         }
 
-        // Unknown error
+        // Unknown error.
       default:
         drupal_set_message(t('The file %file could not be saved. An unknown error has occurred.', array('%file' => $file_info->getFilename())), 'error');
         $files[$i] = FALSE;
@@ -801,8 +819,8 @@ function file_save_upload($form_field_name, $validators = array(), $destination
       }
       else {
         // If 'file_validate_extensions' is set and the list is empty then the
-        // caller wants to allow any extension. In this case we have to remove the
-        // validator or else it will reject all extensions.
+        // caller wants to allow any extension. In this case we have to remove
+        // the validator or else it will reject all extensions.
         unset($validators['file_validate_extensions']);
       }
     }
@@ -828,8 +846,8 @@ function file_save_upload($form_field_name, $validators = array(), $destination
       $file->setMimeType('text/plain');
       // The destination filename will also later be used to create the URI.
       $file->setFilename($file->getFilename() . '.txt');
-      // The .txt extension may not be in the allowed list of extensions. We have
-      // to add it here or else the file upload will fail.
+      // The .txt extension may not be in the allowed list of extensions. We
+      // have to add it here or else the file upload will fail.
       if (!empty($extensions)) {
         $validators['file_validate_extensions'][0] .= ' txt';
         drupal_set_message(t('For security reasons, your upload has been renamed to %filename.', array('%filename' => $file->getFilename())));
@@ -855,8 +873,8 @@ function file_save_upload($form_field_name, $validators = array(), $destination
       $destination .= '/';
     }
     $file->destination = file_destination($destination . $file->getFilename(), $replace);
-    // If file_destination() returns FALSE then $replace === FILE_EXISTS_ERROR and
-    // there's an existing file so we need to bail.
+    // If file_destination() returns FALSE then $replace === FILE_EXISTS_ERROR
+    // and there's an existing file so we need to bail.
     if ($file->destination === FALSE) {
       drupal_set_message(t('The file %source could not be uploaded because a file by that name already exists in the destination %directory.', array('%source' => $form_field_name, '%directory' => $destination)), 'error');
       $files[$i] = FALSE;
@@ -927,7 +945,7 @@ function file_save_upload($form_field_name, $validators = array(), $destination
 /**
  * Determines the preferred upload progress implementation.
  *
- * @return
+ * @return string
  *   A string indicating which upload progress system is available. Either "apc"
  *   or "uploadprogress". If neither are available, returns FALSE.
  */
@@ -949,7 +967,7 @@ function file_progress_implementation() {
 }
 
 /**
- * Implements hook_ENTITY_TYPE_predelete() for file entities.
+ * Implements hook_ENTITY_TYPE_predelete().
  */
 function file_file_predelete(File $file) {
   // TODO: Remove references to a file that is in-use.
@@ -974,7 +992,7 @@ function file_tokens($type, $tokens, array $data = array(), array $options = arr
   $replacements = array();
 
   if ($type == 'file' && !empty($data['file'])) {
-    /** @var \Drupal\file\FileInterface $file */
+    /* @var \Drupal\file\FileInterface $file */
     $file = $data['file'];
 
     foreach ($tokens as $name => $original) {
@@ -984,7 +1002,7 @@ function file_tokens($type, $tokens, array $data = array(), array $options = arr
           $replacements[$original] = $file->id();
           break;
 
-        // Essential file data
+        // Essential file data.
         case 'name':
           $replacements[$original] = $sanitize ? String::checkPlain($file->getFilename()) : $file->getFilename();
           break;
@@ -1234,8 +1252,14 @@ function file_managed_file_process($element, FormStateInterface $form_state, $fo
     $element['upload']['#attached']['js'] = array(
       array(
         'type' => 'setting',
-        'data' => array('file' => array('elements' => array('#' . $element['#id'] => $extension_list)))
-      )
+        'data' => array(
+          'file' => array(
+            'elements' => array(
+              '#' . $element['#id'] => $extension_list,
+            ),
+          ),
+        ),
+      ),
     );
   }
 
@@ -1398,8 +1422,8 @@ function file_managed_file_submit($form, FormStateInterface $form_state) {
 
     foreach ($remove_fids as $fid) {
       // If it's a temporary file we can safely remove it immediately, otherwise
-      // it's up to the implementing module to remove usages of files to have them
-      // removed.
+      // it's up to the implementing module to remove usages of files to have
+      // them removed.
       if ($element['#files'][$fid] && $element['#files'][$fid]->isTemporary()) {
         $element['#files'][$fid]->delete();
       }
@@ -1427,16 +1451,16 @@ function file_managed_file_submit($form, FormStateInterface $form_state) {
 /**
  * Saves any files that have been uploaded into a managed_file element.
  *
- * @param $element
+ * @param array $element
  *   The FAPI element whose values are being saved.
  * @param \Drupal\Core\Form\FormStateInterface $form_state
  *   The current state of the form.
  *
- * @return
+ * @return array
  *   An array of file entities for each file that was saved, keyed by its file
  *   ID, or FALSE if no files were saved.
  */
-function file_managed_file_save_upload($element, FormStateInterface $form_state) {
+function file_managed_file_save_upload(array $element, FormStateInterface $form_state) {
   $upload_name = implode('_', $element['#parents']);
   $file_upload = \Drupal::request()->files->get("files[$upload_name]", NULL, TRUE);
   if (empty($file_upload)) {
@@ -1462,7 +1486,9 @@ function file_managed_file_save_upload($element, FormStateInterface $form_state)
 
     // Value callback expects FIDs to be keys.
     $files = array_filter($files);
-    $fids = array_map(function($file) { return $file->id(); }, $files);
+    $fids = array_map(function ($file) {
+      return $file->id();
+    }, $files);
 
     return empty($files) ? array() : array_combine($fids, $files);
   }
@@ -1479,7 +1505,7 @@ function file_managed_file_save_upload($element, FormStateInterface $form_state)
  *   An associative array containing:
  *   - element: A render element representing the file.
  */
-function template_preprocess_file_managed_file(&$variables) {
+function template_preprocess_file_managed_file(array &$variables) {
   $element = $variables['element'];
 
   $variables['attributes'] = array();
@@ -1540,7 +1566,7 @@ function file_managed_file_pre_render($element) {
  *   - description: A description to be displayed instead of the filename.
  *   - attributes: An associative array of attributes to be placed in the a tag.
  */
-function template_preprocess_file_link(&$variables) {
+function template_preprocess_file_link(array &$variables) {
   $file = $variables['file'];
   $options = array(
     'attributes' => $variables['attributes'],
@@ -1598,11 +1624,11 @@ function template_preprocess_file_link(&$variables) {
  *
  * @param \Drupal\file\FileInterface $file
  *   A file entity.
- * @param $icon_directory
+ * @param string $icon_directory
  *   (optional) A path to a directory of icons to be used for files. Defaults to
  *   the value of the "icon.directory" variable.
  *
- * @return
+ * @return string
  *   A URL string to the icon, or FALSE if an appropriate icon cannot be found.
  */
 function file_icon_url(FileInterface $file, $icon_directory = NULL) {
@@ -1617,11 +1643,11 @@ function file_icon_url(FileInterface $file, $icon_directory = NULL) {
  *
  * @param \Drupal\file\FileInterface $file
  *   A file entity.
- * @param $icon_directory
+ * @param string $icon_directory
  *   (optional) A path to a directory of icons to be used for files. Defaults to
  *   the value of the "icon.directory" variable.
  *
- * @return
+ * @return string
  *   A string to the icon as a local path, or FALSE if an appropriate icon could
  *   not be found.
  */
@@ -1671,7 +1697,7 @@ function file_icon_path(FileInterface $file, $icon_directory = NULL) {
  * @param \Drupal\file\FileInterface $file
  *   A file entity.
  *
- * @return
+ * @return string
  *   The generic icon MIME package expected for this file.
  */
 function file_icon_map(FileInterface $file) {
@@ -1797,21 +1823,21 @@ function file_icon_map(FileInterface $file) {
  * @param \Drupal\file\FileInterface $file
  *   A file entity.
  * @param \Drupal\Core\Field\FieldDefinitionInterface $field
- *   (optional) A field definition to be used for this check. If given, limits the
- *   reference check to the given field.
- * @param $age
+ *   (optional) A field definition to be used for this check. If given, limits
+ *   the reference check to the given field.
+ * @param string $age
  *   (optional) A constant that specifies which references to count. Use
  *   EntityStorageInterface::FIELD_LOAD_REVISION to retrieve all
  *   references within all revisions or
  *   EntityStorageInterface::FIELD_LOAD_CURRENT to retrieve references
  *   only in the current revisions.
- * @param $field_type
+ * @param string $field_type
  *   (optional) The name of a field type. If given, limits the reference check
  *   to fields of the given type. If both $field and $field_type is given but
  *   $field is not the same type as $field_type, an empty array will be
  *   returned.
  *
- * @return
+ * @return array
  *   A multidimensional array. The keys are field_name, entity_type,
  *   entity_id and the value is an entity referencing this file.
  *
@@ -1908,6 +1934,7 @@ function file_permission() {
  *
  * @param int $choice
  *   integer Status code.
+ *
  * @return string
  *   string Text-represented file status.
  */
diff --git a/core/modules/file/src/FileAccessControlHandler.php b/core/modules/file/src/FileAccessControlHandler.php
index ee62c22..83ae025 100644
--- a/core/modules/file/src/FileAccessControlHandler.php
+++ b/core/modules/file/src/FileAccessControlHandler.php
@@ -21,11 +21,10 @@ class FileAccessControlHandler extends EntityAccessControlHandler {
    * {@inheritdoc}
    */
   protected function checkAccess(EntityInterface $entity, $operation, $langcode, AccountInterface $account) {
-
     if ($operation == 'download') {
       foreach ($this->getFileReferences($entity) as $field_name => $entity_map) {
         foreach ($entity_map as $referencing_entity_type => $referencing_entities) {
-          /** @var \Drupal\Core\Entity\EntityInterface $referencing_entity */
+          /* @var \Drupal\Core\Entity\EntityInterface $referencing_entity */
           foreach ($referencing_entities as $referencing_entity) {
             if ($referencing_entity->access('view', $account) && $referencing_entity->$field_name->access('view', $account)) {
               return TRUE;
diff --git a/core/modules/file/src/FileUsage/FileUsageInterface.php b/core/modules/file/src/FileUsage/FileUsageInterface.php
index 63600b5..85faf0d 100644
--- a/core/modules/file/src/FileUsage/FileUsageInterface.php
+++ b/core/modules/file/src/FileUsage/FileUsageInterface.php
@@ -69,7 +69,6 @@ public function delete(FileInterface $file, $module, $type = NULL, $id = NULL, $
    *   A nested array with usage data. The first level is keyed by module name,
    *   the second by object type and the third by the object id. The value of
    *   the third level contains the usage count.
-   *
    */
   public function listUsage(FileInterface $file);
 }
diff --git a/core/modules/file/src/FileViewsData.php b/core/modules/file/src/FileViewsData.php
index 5a977a2..fd1d430 100644
--- a/core/modules/file/src/FileViewsData.php
+++ b/core/modules/file/src/FileViewsData.php
@@ -25,7 +25,7 @@ public function getViewsData() {
     $data['file_managed']['table']['base']['defaults']['field'] = 'filename';
     $data['file_managed']['table']['wizard_id'] = 'file_managed';
 
-    $data['file_managed']['fid']['field']['id'] ='file';
+    $data['file_managed']['fid']['field']['id'] = 'file';
     $data['file_managed']['fid']['argument'] = array(
       'id' => 'file_fid',
       // The field to display in the summary.
@@ -55,7 +55,7 @@ public function getViewsData() {
       'field' => array(
         'id' => 'file_extension',
         'click sortable' => FALSE,
-       ),
+      ),
     );
 
     $data['file_managed']['filesize']['field']['id'] = 'file_size';
@@ -119,14 +119,20 @@ public function getViewsData() {
     // relationships are type-restricted in the joins declared above, and
     // file->entity relationships are type-restricted in the relationship
     // declarations below.
-
     // Describes relationships between files and nodes.
     $data['file_usage']['file_to_node'] = array(
       'title' => t('Content'),
       'help' => t('Content that is associated with this file, usually because this file is in a field on the content.'),
       // Only provide this field/relationship/etc.,
       // when the 'file_managed' base table is present.
-      'skip base' => array('node', 'node_field_revision', 'users', 'comment', 'taxonomy_term_data', 'taxonomy_vocabulary'),
+      'skip base' => array(
+        'node',
+        'node_field_revision',
+        'users',
+        'comment',
+        'taxonomy_term_data',
+        'taxonomy_vocabulary',
+      ),
       'real field' => 'id',
       'relationship' => array(
         'title' => t('Content'),
@@ -134,7 +140,12 @@ public function getViewsData() {
         'base' => 'node',
         'base field' => 'nid',
         'relationship field' => 'id',
-        'extra' => array(array('table' => 'file_usage', 'field' => 'type', 'operator' => '=', 'value' => 'node')),
+        'extra' => array(array(
+          'table' => 'file_usage',
+          'field' => 'type',
+          'operator' => '=',
+          'value' => 'node',
+          )),
       ),
     );
     $data['file_usage']['node_to_file'] = array(
@@ -142,7 +153,13 @@ public function getViewsData() {
       'help' => t('A file that is associated with this node, usually because it is in a field on the node.'),
       // Only provide this field/relationship/etc.,
       // when the 'node' base table is present.
-      'skip base' => array('file_managed', 'users', 'comment', 'taxonomy_term_data', 'taxonomy_vocabulary'),
+      'skip base' => array(
+        'file_managed',
+        'users',
+        'comment',
+        'taxonomy_term_data',
+        'taxonomy_vocabulary',
+      ),
       'real field' => 'fid',
       'relationship' => array(
         'title' => t('File'),
@@ -159,7 +176,14 @@ public function getViewsData() {
       'help' => t('A user that is associated with this file, usually because this file is in a field on the user.'),
       // Only provide this field/relationship/etc.,
       // when the 'file_managed' base table is present.
-      'skip base' => array('node', 'node_field_revision', 'users', 'comment', 'taxonomy_term_data', 'taxonomy_vocabulary'),
+      'skip base' => array(
+        'node',
+        'node_field_revision',
+        'users',
+        'comment',
+        'taxonomy_term_data',
+        'taxonomy_vocabulary',
+      ),
       'real field' => 'id',
       'relationship' => array(
         'title' => t('User'),
@@ -167,7 +191,12 @@ public function getViewsData() {
         'base' => 'users',
         'base field' => 'uid',
         'relationship field' => 'id',
-        'extra' => array(array('table' => 'file_usage', 'field' => 'type', 'operator' => '=', 'value' => 'user')),
+        'extra' => array(array(
+          'table' => 'file_usage',
+          'field' => 'type',
+          'operator' => '=',
+          'value' => 'user',
+          )),
       ),
     );
     $data['file_usage']['user_to_file'] = array(
@@ -175,7 +204,14 @@ public function getViewsData() {
       'help' => t('A file that is associated with this user, usually because it is in a field on the user.'),
       // Only provide this field/relationship/etc.,
       // when the 'users' base table is present.
-      'skip base' => array('file_managed', 'node', 'node_field_revision', 'comment', 'taxonomy_term_data', 'taxonomy_vocabulary'),
+      'skip base' => array(
+        'file_managed',
+        'node',
+        'node_field_revision',
+        'comment',
+        'taxonomy_term_data',
+        'taxonomy_vocabulary',
+      ),
       'real field' => 'fid',
       'relationship' => array(
         'title' => t('File'),
@@ -192,7 +228,14 @@ public function getViewsData() {
       'help' => t('A comment that is associated with this file, usually because this file is in a field on the comment.'),
       // Only provide this field/relationship/etc.,
       // when the 'file_managed' base table is present.
-      'skip base' => array('node', 'node_field_revision', 'users', 'comment', 'taxonomy_term_data', 'taxonomy_vocabulary'),
+      'skip base' => array(
+        'node',
+        'node_field_revision',
+        'users',
+        'comment',
+        'taxonomy_term_data',
+        'taxonomy_vocabulary',
+      ),
       'real field' => 'id',
       'relationship' => array(
         'title' => t('Comment'),
@@ -200,7 +243,12 @@ public function getViewsData() {
         'base' => 'comment',
         'base field' => 'cid',
         'relationship field' => 'id',
-        'extra' => array(array('table' => 'file_usage', 'field' => 'type', 'operator' => '=', 'value' => 'comment')),
+        'extra' => array(array(
+          'table' => 'file_usage',
+          'field' => 'type',
+          'operator' => '=',
+          'value' => 'comment',
+          )),
       ),
     );
     $data['file_usage']['comment_to_file'] = array(
@@ -208,7 +256,14 @@ public function getViewsData() {
       'help' => t('A file that is associated with this comment, usually because it is in a field on the comment.'),
       // Only provide this field/relationship/etc.,
       // when the 'comment' base table is present.
-      'skip base' => array('file_managed', 'node', 'node_field_revision', 'users', 'taxonomy_term_data', 'taxonomy_vocabulary'),
+      'skip base' => array(
+        'file_managed',
+        'node',
+        'node_field_revision',
+        'users',
+        'taxonomy_term_data',
+        'taxonomy_vocabulary',
+      ),
       'real field' => 'fid',
       'relationship' => array(
         'title' => t('File'),
@@ -225,7 +280,14 @@ public function getViewsData() {
       'help' => t('A taxonomy term that is associated with this file, usually because this file is in a field on the taxonomy term.'),
       // Only provide this field/relationship/etc.,
       // when the 'file_managed' base table is present.
-      'skip base' => array('node', 'node_field_revision', 'users', 'comment', 'taxonomy_term_data', 'taxonomy_vocabulary'),
+      'skip base' => array(
+        'node',
+        'node_field_revision',
+        'users',
+        'comment',
+        'taxonomy_term_data',
+        'taxonomy_vocabulary',
+      ),
       'real field' => 'id',
       'relationship' => array(
         'title' => t('Taxonomy Term'),
@@ -233,7 +295,12 @@ public function getViewsData() {
         'base' => 'taxonomy_term_data',
         'base field' => 'tid',
         'relationship field' => 'id',
-        'extra' => array(array('table' => 'file_usage', 'field' => 'type', 'operator' => '=', 'value' => 'taxonomy_term')),
+        'extra' => array(array(
+          'table' => 'file_usage',
+          'field' => 'type',
+          'operator' => '=',
+          'value' => 'taxonomy_term',
+          )),
       ),
     );
     $data['file_usage']['taxonomy_term_to_file'] = array(
@@ -241,7 +308,14 @@ public function getViewsData() {
       'help' => t('A file that is associated with this taxonomy term, usually because it is in a field on the taxonomy term.'),
       // Only provide this field/relationship/etc.,
       // when the 'taxonomy_term_data' base table is present.
-      'skip base' => array('file_managed', 'node', 'node_field_revision', 'users', 'comment', 'taxonomy_vocabulary'),
+      'skip base' => array(
+        'file_managed',
+        'node',
+        'node_field_revision',
+        'users',
+        'comment',
+        'taxonomy_vocabulary',
+      ),
       'real field' => 'fid',
       'relationship' => array(
         'title' => t('File'),
@@ -258,7 +332,14 @@ public function getViewsData() {
       'help' => t('A taxonomy vocabulary that is associated with this file, usually because this file is in a field on the taxonomy vocabulary.'),
       // Only provide this field/relationship/etc.,
       // when the 'file_managed' base table is present.
-      'skip base' => array('node', 'node_field_revision', 'users', 'comment', 'taxonomy_term_data', 'taxonomy_vocabulary'),
+      'skip base' => array(
+        'node',
+        'node_field_revision',
+        'users',
+        'comment',
+        'taxonomy_term_data',
+        'taxonomy_vocabulary',
+      ),
       'real field' => 'id',
       'relationship' => array(
         'title' => t('Taxonomy Vocabulary'),
@@ -266,7 +347,12 @@ public function getViewsData() {
         'base' => 'taxonomy_vocabulary',
         'base field' => 'vid',
         'relationship field' => 'id',
-        'extra' => array(array('table' => 'file_usage', 'field' => 'type', 'operator' => '=', 'value' => 'taxonomy_vocabulary')),
+        'extra' => array(array(
+          'table' => 'file_usage',
+          'field' => 'type',
+          'operator' => '=',
+          'value' => 'taxonomy_vocabulary',
+          )),
       ),
     );
     $data['file_usage']['taxonomy_vocabulary_to_file'] = array(
@@ -274,7 +360,14 @@ public function getViewsData() {
       'help' => t('A file that is associated with this taxonomy vocabulary, usually because it is in a field on the taxonomy vocabulary.'),
       // Only provide this field/relationship/etc.,
       // when the 'taxonomy_vocabulary' base table is present.
-      'skip base' => array('file_managed', 'node', 'node_field_revision', 'users', 'comment', 'taxonomy_term_data'),
+      'skip base' => array(
+        'file_managed',
+        'node',
+        'node_field_revision',
+        'users',
+        'comment',
+        'taxonomy_term_data',
+      ),
       'real field' => 'fid',
       'relationship' => array(
         'title' => t('File'),
@@ -285,15 +378,15 @@ public function getViewsData() {
       ),
     );
 
-    // Provide basic fields from the {file_usage} table to all of the base tables
-    // we've declared joins to, because there is no 'skip base' property on these
-    // fields.
+    // Provide basic fields from the {file_usage} table to all of the base
+    // tables we've declared joins to, because there is no 'skip base' property
+    // on these fields.
     $data['file_usage']['module'] = array(
       'title' => t('Module'),
       'help' => t('The module managing this file relationship.'),
       'field' => array(
         'id' => 'standard',
-       ),
+      ),
       'filter' => array(
         'id' => 'string',
       ),
@@ -309,7 +402,7 @@ public function getViewsData() {
       'help' => t('The type of entity that is related to the file.'),
       'field' => array(
         'id' => 'standard',
-       ),
+      ),
       'filter' => array(
         'id' => 'string',
       ),
@@ -341,7 +434,7 @@ public function getViewsData() {
       'help' => t('The number of times the file is used by this entity.'),
       'field' => array(
         'id' => 'numeric',
-       ),
+      ),
       'filter' => array(
         'id' => 'numeric',
       ),
diff --git a/core/modules/file/src/Plugin/Field/FieldType/FileFieldItemList.php b/core/modules/file/src/Plugin/Field/FieldType/FileFieldItemList.php
index f8ee03c..56ded38 100644
--- a/core/modules/file/src/Plugin/Field/FieldType/FileFieldItemList.php
+++ b/core/modules/file/src/Plugin/Field/FieldType/FileFieldItemList.php
@@ -18,7 +18,8 @@ class FileFieldItemList extends EntityReferenceFieldItemList {
   /**
    * {@inheritdoc}
    */
-  public function defaultValuesForm(array &$form, FormStateInterface $form_state) { }
+  public function defaultValuesForm(array &$form, FormStateInterface $form_state) {
+  }
 
   /**
    * {@inheritdoc}
diff --git a/core/modules/file/src/Plugin/Field/FieldType/FileItem.php b/core/modules/file/src/Plugin/Field/FieldType/FileItem.php
index c84da26..2187bcb 100644
--- a/core/modules/file/src/Plugin/Field/FieldType/FileItem.php
+++ b/core/modules/file/src/Plugin/Field/FieldType/FileItem.php
@@ -21,7 +21,7 @@
  * @FieldType(
  *   id = "file",
  *   label = @Translation("File"),
- *   description = @Translation("This field stores the ID of a file as an integer value."),
+ *   description = @Translation("This field stores the file ID as an integer."),
  *   default_widget = "file_generic",
  *   default_formatter = "file_default",
  *   list_class = "\Drupal\file\Plugin\Field\FieldType\FileFieldItemList"
@@ -202,11 +202,11 @@ public function instanceSettingsForm(array $form, FormStateInterface $form_state
   }
 
   /**
-   * Form API callback
+   * Form API callback.
    *
    * Removes slashes from the beginning and end of the destination value and
-   * ensures that the file directory path is not included at the beginning of the
-   * value.
+   * ensures that the file directory path is not included at the beginning of
+   * the value.
    *
    * This function is assigned as an #element_validate callback in
    * instanceSettingsForm().
@@ -259,15 +259,15 @@ public static function validateMaxFilesize($element, FormStateInterface $form_st
   /**
    * Determines the URI for a file field instance.
    *
-   * @param $data
+   * @param array $data
    *   An array of token objects to pass to token_replace().
    *
-   * @return
+   * @return string
    *   A file directory URI with tokens replaced.
    *
    * @see token_replace()
    */
-  public function getUploadLocation($data = array()) {
+  public function getUploadLocation(array $data = array()) {
     $settings = $this->getSettings();
     $destination = trim($settings['file_directory'], '/');
 
@@ -280,7 +280,7 @@ public function getUploadLocation($data = array()) {
   /**
    * Retrieves the upload validators for a file field.
    *
-   * @return
+   * @return array
    *   An array suitable for passing to file_save_upload() or the file field
    *   element's '#upload_validators' property.
    */
@@ -318,7 +318,7 @@ public static function generateSampleValue(FieldDefinitionInterface $field_defin
     $file = file_save_data($data, $destination, FILE_EXISTS_ERROR);
     $values = array(
       'target_id' => $file->id(),
-      'display' => (int)$settings['display_default'],
+      'display' => (int) $settings['display_default'],
       'description' => $random->sentences(10),
     );
     return $values;
diff --git a/core/modules/file/src/Plugin/Field/FieldWidget/FileWidget.php b/core/modules/file/src/Plugin/Field/FieldWidget/FileWidget.php
index f9becf4..3c8954d 100644
--- a/core/modules/file/src/Plugin/Field/FieldWidget/FileWidget.php
+++ b/core/modules/file/src/Plugin/Field/FieldWidget/FileWidget.php
@@ -302,8 +302,9 @@ public static function value($element, $input = FALSE, FormStateInterface $form_
   }
 
   /**
-   * Form element validation callback for upload element on file widget. Checks
-   * if user has uploaded more files than allowed.
+   * Form element validation callback for upload element on file widget.
+   *
+   * Checks if user has uploaded more files than allowed.
    *
    * This validator is used only when cardinality not set to 1 or unlimited.
    */
@@ -326,7 +327,12 @@ public static function validateMultipleCount($element, FormStateInterface $form_
         $file = file_load($fid);
         $removed_names[] = $file->getFilename();
       }
-      $args = array('%field' => $field_storage->getFieldName(), '@max' => $field_storage->getCardinality(), '@count' => $keep, '%list' => implode(', ', $removed_names));
+      $args = array(
+        '%field' => $field_storage->getFieldName(),
+        '@max' => $field_storage->getCardinality(),
+        '@count' => $keep,
+        '%list' => implode(', ', $removed_names),
+      );
       $message = t('Field %field can only hold @max values but there were @count uploaded. The following files have been omitted as a result: %list.', $args);
       drupal_set_message($message, 'warning');
       $values['fids'] = array_slice($values['fids'], 0, $keep);
@@ -405,7 +411,9 @@ public static function process($element, FormStateInterface $form_state, $form)
     // not just the individual item, to be valid.
     foreach (array('upload_button', 'remove_button') as $key) {
       $element[$key]['#submit'][] = array(get_called_class(), 'submit');
-      $element[$key]['#limit_validation_errors'] = array(array_slice($element['#parents'], 0, -1));
+      $element[$key]['#limit_validation_errors'] = array(
+        array_slice($element['#parents'], 0, -1),
+      );
     }
 
     return $element;
@@ -465,7 +473,7 @@ public static function processMultiple($element, FormStateInterface $form_state,
    *   A description of the file suitable for use in the administrative
    *   interface.
    */
-  protected static function getDescriptionFromElement($element) {
+  protected static function getDescriptionFromElement(array $element) {
     // Use the actual file description, if it's available.
     if (!empty($element['#default_value']['description'])) {
       return $element['#default_value']['description'];
diff --git a/core/modules/file/src/Plugin/views/argument/Fid.php b/core/modules/file/src/Plugin/views/argument/Fid.php
index a296a0c..4132657 100644
--- a/core/modules/file/src/Plugin/views/argument/Fid.php
+++ b/core/modules/file/src/Plugin/views/argument/Fid.php
@@ -24,7 +24,7 @@
 class Fid extends Numeric implements ContainerFactoryPluginInterface {
 
   /**
-   * The entity manager service
+   * The entity manager service.
    *
    * @var \Drupal\Core\Entity\EntityManagerInterface
    */
@@ -48,7 +48,7 @@ class Fid extends Numeric implements ContainerFactoryPluginInterface {
    *   The plugin implementation definition.
    * @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager
    *   The entity manager.
-   * @param \Drupal\Core\Entity\Query\QueryFactory
+   * @param \Drupal\Core\Entity\Query\QueryFactory $entity_query
    *   The entity query factory.
    */
   public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityManagerInterface $entity_manager, QueryFactory $entity_query) {
diff --git a/core/modules/file/src/Plugin/views/field/File.php b/core/modules/file/src/Plugin/views/field/File.php
index 135ff7f..8d2ef02 100644
--- a/core/modules/file/src/Plugin/views/field/File.php
+++ b/core/modules/file/src/Plugin/views/field/File.php
@@ -33,6 +33,9 @@ public function init(ViewExecutable $view, DisplayPluginBase $display, array &$o
     }
   }
 
+  /**
+   * {@inheritdoc}
+   */
   protected function defineOptions() {
     $options = parent::defineOptions();
     $options['link_to_file'] = array('default' => FALSE, 'bool' => TRUE);
@@ -40,7 +43,7 @@ protected function defineOptions() {
   }
 
   /**
-   * Provide link to file option
+   * Provide link to file option.
    */
   public function buildOptionsForm(&$form, FormStateInterface $form_state) {
     $form['link_to_file'] = array(
diff --git a/core/modules/file/src/Plugin/views/field/FileMime.php b/core/modules/file/src/Plugin/views/field/FileMime.php
index 5576e34..fe2629d 100644
--- a/core/modules/file/src/Plugin/views/field/FileMime.php
+++ b/core/modules/file/src/Plugin/views/field/FileMime.php
@@ -11,7 +11,7 @@
 use Drupal\views\ResultRow;
 
 /**
- * Field handler to add rendering MIME type images as an option on the filemime field.
+ * Field handler to add rendering MIME type images as option on filemime field.
  *
  * @ingroup views_field_handlers
  *
@@ -19,12 +19,18 @@
  */
 class FileMime extends File {
 
+  /**
+   * {@inheritdoc}
+   */
   protected function defineOptions() {
     $options = parent::defineOptions();
     $options['filemime_image'] = array('default' => FALSE, 'bool' => TRUE);
     return $options;
   }
 
+  /**
+   * {@inheritdoc}
+   */
   public function buildOptionsForm(&$form, FormStateInterface $form_state) {
     $form['filemime_image'] = array(
       '#title' => t('Display an icon representing the file type, instead of the MIME text (such as "image/jpeg")'),
diff --git a/core/modules/file/src/Plugin/views/field/Uri.php b/core/modules/file/src/Plugin/views/field/Uri.php
index 2d2c481..c3208bf 100644
--- a/core/modules/file/src/Plugin/views/field/Uri.php
+++ b/core/modules/file/src/Plugin/views/field/Uri.php
@@ -11,18 +11,26 @@
 use Drupal\views\ResultRow;
 
 /**
- * Field handler to add rendering file paths as file URLs instead of as internal file URIs.
+ * Field handler to add rendering file paths as file URLs.
+ *
+ * Instead of as internal file URIs.
  *
  * @ViewsField("file_uri")
  */
 class Uri extends File {
 
+  /**
+   * {@inheritdoc}
+   */
   protected function defineOptions() {
     $options = parent::defineOptions();
     $options['file_download_path'] = array('default' => FALSE, 'bool' => TRUE);
     return $options;
   }
 
+  /**
+   * {@inheritdoc}
+   */
   public function buildOptionsForm(&$form, FormStateInterface $form_state) {
     $form['file_download_path'] = array(
       '#title' => t('Display download path instead of file storage URI'),
diff --git a/core/modules/file/src/Plugin/views/wizard/File.php b/core/modules/file/src/Plugin/views/wizard/File.php
index 94529a0..d3d4ff0 100644
--- a/core/modules/file/src/Plugin/views/wizard/File.php
+++ b/core/modules/file/src/Plugin/views/wizard/File.php
@@ -33,11 +33,11 @@ class File extends WizardPluginBase {
     'table' => 'file_managed',
     'field' => 'uri',
     'exclude' => TRUE,
-    'file_download_path' => TRUE
+    'file_download_path' => TRUE,
   );
 
   /**
-   * Overrides Drupal\views\Plugin\views\wizard\WizardPluginBase::defaultDisplayOptions().
+   * Overrides ..\..\..\..\wizard\WizardPluginBase::defaultDisplayOptions().
    */
   protected function defaultDisplayOptions() {
     $display_options = parent::defaultDisplayOptions();
diff --git a/core/modules/file/src/Tests/CopyTest.php b/core/modules/file/src/Tests/CopyTest.php
index 3a3a727..8795df8 100644
--- a/core/modules/file/src/Tests/CopyTest.php
+++ b/core/modules/file/src/Tests/CopyTest.php
@@ -16,7 +16,7 @@ class CopyTest extends FileManagedUnitTestBase {
   /**
    * Test file copying in the normal, base case.
    */
-  function testNormal() {
+  public function testNormal() {
     $contents = $this->randomMachineName(10);
     $source = $this->createFile(NULL, $contents);
     $desired_uri = 'public://' . $this->randomMachineName();
@@ -45,7 +45,7 @@ function testNormal() {
   /**
    * Test renaming when copying over a file that already exists.
    */
-  function testExistingRename() {
+  public function testExistingRename() {
     // Setup a file to overwrite.
     $contents = $this->randomMachineName(10);
     $source = $this->createFile(NULL, $contents);
@@ -85,7 +85,7 @@ function testExistingRename() {
   /**
    * Test replacement when copying over a file that already exists.
    */
-  function testExistingReplace() {
+  public function testExistingReplace() {
     // Setup a file to overwrite.
     $contents = $this->randomMachineName(10);
     $source = $this->createFile(NULL, $contents);
@@ -121,10 +121,11 @@ function testExistingReplace() {
   }
 
   /**
-   * Test that copying over an existing file fails when FILE_EXISTS_ERROR is
-   * specified.
+   * Test that copying over an existing file fails when.
+   *
+   * FILE_EXISTS_ERROR is specified.
    */
-  function testExistingError() {
+  public function testExistingError() {
     $contents = $this->randomMachineName(10);
     $source = $this->createFile();
     $target = $this->createFile(NULL, $contents);
diff --git a/core/modules/file/src/Tests/DeleteTest.php b/core/modules/file/src/Tests/DeleteTest.php
index f39239f..b8b035f 100644
--- a/core/modules/file/src/Tests/DeleteTest.php
+++ b/core/modules/file/src/Tests/DeleteTest.php
@@ -16,7 +16,7 @@ class DeleteTest extends FileManagedUnitTestBase {
   /**
    * Tries deleting a normal file (as opposed to a directory, symlink, etc).
    */
-  function testUnused() {
+  public function testUnused() {
     $file = $this->createFile();
 
     // Check that deletion removes the file and database record.
@@ -30,7 +30,7 @@ function testUnused() {
   /**
    * Tries deleting a file that is in use.
    */
-  function testInUse() {
+  public function testInUse() {
     $file = $this->createFile();
     $file_usage = $this->container->get('file.usage');
     $file_usage->add($file, 'testing', 'test', 1);
@@ -66,7 +66,7 @@ function testInUse() {
       ->execute();
     \Drupal::service('cron')->run();
 
-    // file_cron() loads
+    // file_cron() loads.
     $this->assertFileHooksCalled(array('delete'));
     $this->assertFalse(file_exists($file->getFileUri()), 'File has been deleted after its last usage was removed.');
     $this->assertFalse(file_load($file->id()), 'File was removed from the database.');
diff --git a/core/modules/file/src/Tests/DownloadTest.php b/core/modules/file/src/Tests/DownloadTest.php
index 92ba740..386b332 100644
--- a/core/modules/file/src/Tests/DownloadTest.php
+++ b/core/modules/file/src/Tests/DownloadTest.php
@@ -15,7 +15,10 @@
  * @group file
  */
 class DownloadTest extends FileManagedTestBase {
-  protected function setUp() {
+  /**
+   * {@inheritdoc}
+   */
+  public function setUp() {
     parent::setUp();
     // Clear out any hook calls.
     file_test_reset();
@@ -24,12 +27,12 @@ protected function setUp() {
   /**
    * Test the public file transfer system.
    */
-  function testPublicFileTransfer() {
+  public function testPublicFileTransfer() {
     // Test generating an URL to a created file.
     $file = $this->createFile();
     $url = file_create_url($file->getFileUri());
-    // URLs can't contain characters outside the ASCII set so $filename has to be
-    // encoded.
+    // URLs can't contain characters outside the ASCII set
+    // so $filename has to be encoded.
     $filename = $GLOBALS['base_url'] . '/' . file_stream_wrapper_get_instance_by_scheme('public')->getDirectoryPath() . '/' . rawurlencode($file->getFilename());
     $this->assertEqual($filename, $url, 'Correctly generated a URL for a created file.');
     $this->drupalHead($url);
@@ -69,7 +72,6 @@ public function testPrivateFileTransferWithPageCache() {
    */
   protected function doPrivateFileTransferTest() {
     // Set file downloads to private so handler functions get called.
-
     // Create a file.
     $contents = $this->randomMachineName(8);
     $file = $this->createFile(NULL, $contents, 'private');
@@ -99,14 +101,17 @@ protected function doPrivateFileTransferTest() {
   /**
    * Test file_create_url().
    */
-  function testFileCreateUrl() {
+  public function testFileCreateUrl() {
 
     // Tilde (~) is excluded from this test because it is encoded by
     // rawurlencode() in PHP 5.2 but not in PHP 5.3, as per RFC 3986.
     // @see http://www.php.net/manual/function.rawurlencode.php#86506
-    $basename = " -._!$'\"()*@[]?&+%#,;=:\n\x00" . // "Special" ASCII characters.
-      "%23%25%26%2B%2F%3F" . // Characters that look like a percent-escaped string.
-      "éøïвβ中國書۞"; // Characters from various non-ASCII alphabets.
+    // "Special" ASCII characters.
+    $basename = " -._!$'\"()*@[]?&+%#,;=:\n\x00" .
+      // Characters that look like a percent-escaped string.
+      "%23%25%26%2B%2F%3F" .
+      // Characters from various non-ASCII alphabets.
+      "éøïвβ中國書۞";;
     $basename_encoded = '%20-._%21%24%27%22%28%29%2A%40%5B%5D%3F%26%2B%25%23%2C%3B%3D%3A__' .
       '%2523%2525%2526%252B%252F%253F' .
       '%C3%A9%C3%B8%C3%AF%D0%B2%CE%B2%E4%B8%AD%E5%9C%8B%E6%9B%B8%DB%9E';
@@ -135,14 +140,14 @@ function testFileCreateUrl() {
    * the URL generated by file_create_url() for the specified file equals the
    * specified URL; fetch the URL and then compare the contents to the file.
    *
-   * @param $scheme
-   *   A scheme, e.g. "public"
-   * @param $directory
-   *   A directory, possibly ""
-   * @param $filename
-   *   A filename
-   * @param $expected_url
-   *   The expected URL
+   * @param string $scheme
+   *   A scheme, e.g. "public".
+   * @param string $directory
+   *   A directory, possibly "".
+   * @param string $filename
+   *   A filename.
+   * @param string $expected_url
+   *   The expected URL.
    */
   private function checkUrl($scheme, $directory, $filename, $expected_url) {
     // Convert $filename to a valid filename, i.e. strip characters not
diff --git a/core/modules/file/src/Tests/FileFieldDisplayTest.php b/core/modules/file/src/Tests/FileFieldDisplayTest.php
index 6a1798d..d65e289 100644
--- a/core/modules/file/src/Tests/FileFieldDisplayTest.php
+++ b/core/modules/file/src/Tests/FileFieldDisplayTest.php
@@ -19,7 +19,7 @@ class FileFieldDisplayTest extends FileFieldTestBase {
   /**
    * Tests normal formatter display on node display.
    */
-  function testNodeDisplay() {
+  public function testNodeDisplay() {
     $field_name = strtolower($this->randomMachineName());
     $type_name = 'article';
     $field_settings = array(
@@ -38,7 +38,8 @@ function testNodeDisplay() {
     $node = $this->drupalCreateNode(array('type' => $type_name));
     // Check file_default last as the assertions below assume that this is the
     // case.
-    $file_formatters = array('file_table', 'file_url_plain', 'hidden', 'file_default');
+    $file_formatters = array('file_table', 'file_url_plain',
+      'hidden', 'file_default');
     foreach ($file_formatters as $formatter) {
       $edit = array(
         "fields[$field_name][type]" => $formatter,
@@ -63,7 +64,8 @@ function testNodeDisplay() {
     $default_output = drupal_render($file_link);
     $this->assertRaw($default_output, 'Default formatter displaying correctly on full node view.');
 
-    // Turn the "display" option off and check that the file is no longer displayed.
+    // Turn the "display" option off and
+    // Check that the file is no longer displayed.
     $edit = array($field_name . '[0][display]' => FALSE);
     $this->drupalPostForm('node/' . $nid . '/edit', $edit, t('Save and keep published'));
 
diff --git a/core/modules/file/src/Tests/FileFieldPathTest.php b/core/modules/file/src/Tests/FileFieldPathTest.php
index 865317a..fa2f667 100644
--- a/core/modules/file/src/Tests/FileFieldPathTest.php
+++ b/core/modules/file/src/Tests/FileFieldPathTest.php
@@ -16,7 +16,7 @@ class FileFieldPathTest extends FileFieldTestBase {
   /**
    * Tests the normal formatter display on node display.
    */
-  function testUploadPath() {
+  public function testUploadPath() {
     $field_name = strtolower($this->randomMachineName());
     $type_name = 'article';
     $this->createFileField($field_name, 'node', $type_name);
@@ -53,7 +53,7 @@ function testUploadPath() {
     $node_file = file_load($node->{$field_name}->target_id);
     // Do token replacement using the same user which uploaded the file, not
     // the user running the test case.
-    $data = array('user' => $this->admin_user);
+    $data = array('user' => $this->adminUser);
     $subdirectory = \Drupal::token()->replace('[user:uid]/[user:name]', $data);
     $this->assertPathMatch('public://' . $subdirectory . '/' . $test_file->getFilename(), $node_file->getFileUri(), format_string('The file %file was uploaded to the correct path with token replacements.', array('%file' => $node_file->getFileUri())));
   }
@@ -61,15 +61,15 @@ function testUploadPath() {
   /**
    * Asserts that a file is uploaded to the right location.
    *
-   * @param $expected_path
+   * @param string $expected_path
    *   The location where the file is expected to be uploaded. Duplicate file
    *   names to not need to be taken into account.
-   * @param $actual_path
+   * @param string $actual_path
    *   Where the file was actually uploaded.
-   * @param $message
+   * @param string $message
    *   The message to display with this assertion.
    */
-  function assertPathMatch($expected_path, $actual_path, $message) {
+  public function assertPathMatch($expected_path, $actual_path, $message) {
     // Strip off the extension of the expected path to allow for _0, _1, etc.
     // suffixes when the file hits a duplicate name.
     $pos = strrpos($expected_path, '.');
diff --git a/core/modules/file/src/Tests/FileFieldRSSContentTest.php b/core/modules/file/src/Tests/FileFieldRSSContentTest.php
index db265c2..c0d265b 100644
--- a/core/modules/file/src/Tests/FileFieldRSSContentTest.php
+++ b/core/modules/file/src/Tests/FileFieldRSSContentTest.php
@@ -24,7 +24,7 @@ class FileFieldRSSContentTest extends FileFieldTestBase {
   /**
    * Tests RSS enclosure formatter display for RSS feeds.
    */
-  function testFileFieldRSSContent() {
+  public function testFileFieldRSSContent() {
     $field_name = strtolower($this->randomMachineName());
     $type_name = 'article';
     $field_settings = array(
@@ -70,7 +70,7 @@ function testFileFieldRSSContent() {
       'attributes' => array(
         'url' => url("$this->public_files_directory/$uploaded_filename", array('absolute' => TRUE)),
         'length' => $node_file->getSize(),
-        'type' => $node_file->getMimeType()
+        'type' => $node_file->getMimeType(),
       ),
     );
     $this->assertRaw(format_xml_elements(array($test_element)), 'File field RSS enclosure is displayed when viewing the RSS feed.');
diff --git a/core/modules/file/src/Tests/FileFieldRevisionTest.php b/core/modules/file/src/Tests/FileFieldRevisionTest.php
index b45b200..145f344 100644
--- a/core/modules/file/src/Tests/FileFieldRevisionTest.php
+++ b/core/modules/file/src/Tests/FileFieldRevisionTest.php
@@ -24,7 +24,7 @@ class FileFieldRevisionTest extends FileFieldTestBase {
    *  - When the last revision that uses a file is deleted, the original file
    *    should be deleted also.
    */
-  function testRevisions() {
+  public function testRevisions() {
     $type_name = 'article';
     $field_name = strtolower($this->randomMachineName());
     $this->createFileField($field_name, 'node', $type_name);
diff --git a/core/modules/file/src/Tests/FileFieldTestBase.php b/core/modules/file/src/Tests/FileFieldTestBase.php
index fb9552a..5ba7f70 100644
--- a/core/modules/file/src/Tests/FileFieldTestBase.php
+++ b/core/modules/file/src/Tests/FileFieldTestBase.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\file\Tests;
 
+use Drupal\Core\Entity\EntityInterface;
 use Drupal\field\Entity\FieldStorageConfig;
 use Drupal\field\Entity\FieldInstanceConfig;
 use Drupal\file\FileInterface;
@@ -18,25 +19,39 @@
 abstract class FileFieldTestBase extends WebTestBase {
 
   /**
-  * Modules to enable.
-  *
-  * @var array
-  */
+   * Modules to enable.
+   *
+   * @var array
+   */
   public static $modules = array('node', 'file', 'file_module_test', 'field_ui');
 
-  protected $admin_user;
+  protected $adminUser;
 
+  /**
+   * {@inheritdoc}
+   */
   protected function setUp() {
     parent::setUp();
-    $this->admin_user = $this->drupalCreateUser(array('access content', 'access administration pages', 'administer site configuration', 'administer users', 'administer permissions', 'administer content types', 'administer node fields', 'administer node display', 'administer nodes', 'bypass node access'));
-    $this->drupalLogin($this->admin_user);
+    $this->adminUser = $this->drupalCreateUser(array(
+      'access content',
+      'access administration pages',
+      'administer site configuration',
+      'administer users',
+      'administer permissions',
+      'administer content types',
+      'administer node fields',
+      'administer node display',
+      'administer nodes',
+      'bypass node access',
+    ));
+    $this->drupalLogin($this->adminUser);
     $this->drupalCreateContentType(array('type' => 'article', 'name' => 'Article'));
   }
 
   /**
    * Retrieves a sample file of the specified type.
    */
-  function getTestFile($type_name, $size = NULL) {
+  public function getTestFile($type_name, $size = NULL) {
     // Get a file to upload.
     $file = current($this->drupalGetTestFiles($type_name, $size));
 
@@ -49,27 +64,29 @@ function getTestFile($type_name, $size = NULL) {
   /**
    * Retrieves the fid of the last inserted file.
    */
-  function getLastFileId() {
+  public function getLastFileId() {
     return (int) db_query('SELECT MAX(fid) FROM {file_managed}')->fetchField();
   }
 
   /**
    * Creates a new file field (storage and instance).
    *
-   * @param $name
+   * @param string $name
    *   The name of the new field (all lowercase), exclude the "field_" prefix.
-   * @param $entity_type
+   * @param string $entity_type
    *   The entity type.
-   * @param $bundle
+   * @param string $bundle
    *   The bundle that this field will be added to.
-   * @param $storage_settings
+   * @param array $storage_settings
    *   A list of field storage settings that will be added to the defaults.
-   * @param $instance_settings
+   * @param array $instance_settings
    *   A list of instance settings that will be added to the instance defaults.
-   * @param $widget_settings
+   * @param array $widget_settings
    *   A list of widget settings that will be added to the widget defaults.
+   *
+   * @return EntityInterface
    */
-  function createFileField($name, $entity_type, $bundle, $storage_settings = array(), $instance_settings = array(), $widget_settings = array()) {
+  public function createFileField($name, $entity_type, $bundle, array $storage_settings = array(), array $instance_settings = array(), array $widget_settings = array()) {
     $field_storage = entity_create('field_storage_config', array(
       'entity_type' => $entity_type,
       'name' => $name,
@@ -86,20 +103,18 @@ function createFileField($name, $entity_type, $bundle, $storage_settings = array
   /**
    * Attaches a file field to an entity.
    *
-   * @param $name
+   * @param string $name
    *   The name of the new field (all lowercase), exclude the "field_" prefix.
-   * @param $entity_type
+   * @param string $entity_type
    *   The entity type this field will be added to.
-   * @param $bundle
+   * @param string $bundle
    *   The bundle this field will be added to.
-   * @param $field_settings
-   *   A list of field settings that will be added to the defaults.
-   * @param $instance_settings
+   * @param array $instance_settings
    *   A list of instance settings that will be added to the instance defaults.
-   * @param $widget_settings
+   * @param array $widget_settings
    *   A list of widget settings that will be added to the widget defaults.
    */
-  function attachFileField($name, $entity_type, $bundle, $instance_settings = array(), $widget_settings = array()) {
+  public function attachFileField($name, $entity_type, $bundle, array $instance_settings = array(), array $widget_settings = array()) {
     $instance = array(
       'field_name' => $name,
       'label' => $name,
@@ -122,7 +137,7 @@ function attachFileField($name, $entity_type, $bundle, $instance_settings = arra
   /**
    * Updates an existing file field with new settings.
    */
-  function updateFileField($name, $type_name, $instance_settings = array(), $widget_settings = array()) {
+  public function updateFileField($name, $type_name, $instance_settings = array(), $widget_settings = array()) {
     $instance = FieldInstanceConfig::loadByName('node', $type_name, $name);
     $instance->settings = array_merge($instance->settings, $instance_settings);
     $instance->save();
@@ -137,7 +152,7 @@ function updateFileField($name, $type_name, $instance_settings = array(), $widge
   /**
    * Uploads a file to a node.
    */
-  function uploadNodeFile($file, $field_name, $nid_or_type, $new_revision = TRUE, $extras = array()) {
+  public function uploadNodeFile($file, $field_name, $nid_or_type, $new_revision = TRUE, $extras = array()) {
     $edit = array(
       'title[0][value]' => $this->randomMachineName(),
       'revision' => (string) (int) $new_revision,
@@ -175,7 +190,7 @@ function uploadNodeFile($file, $field_name, $nid_or_type, $new_revision = TRUE,
    *
    * Note that if replacing a file, it must first be removed then added again.
    */
-  function removeNodeFile($nid, $new_revision = TRUE) {
+  public function removeNodeFile($nid, $new_revision = TRUE) {
     $edit = array(
       'revision' => (string) (int) $new_revision,
     );
@@ -187,7 +202,7 @@ function removeNodeFile($nid, $new_revision = TRUE) {
   /**
    * Replaces a file within a node.
    */
-  function replaceNodeFile($file, $field_name, $nid, $new_revision = TRUE) {
+  public function replaceNodeFile($file, $field_name, $nid, $new_revision = TRUE) {
     $edit = array(
       'files[' . $field_name . '_0]' => drupal_realpath($file->getFileUri()),
       'revision' => (string) (int) $new_revision,
@@ -200,7 +215,7 @@ function replaceNodeFile($file, $field_name, $nid, $new_revision = TRUE) {
   /**
    * Asserts that a file exists physically on disk.
    */
-  function assertFileExists($file, $message = NULL) {
+  public function assertFileExists($file, $message = NULL) {
     $message = isset($message) ? $message : format_string('File %file exists on the disk.', array('%file' => $file->getFileUri()));
     $this->assertTrue(is_file($file->getFileUri()), $message);
   }
@@ -208,7 +223,7 @@ function assertFileExists($file, $message = NULL) {
   /**
    * Asserts that a file exists in the database.
    */
-  function assertFileEntryExists($file, $message = NULL) {
+  public function assertFileEntryExists($file, $message = NULL) {
     $this->container->get('entity.manager')->getStorage('file')->resetCache();
     $db_file = file_load($file->id());
     $message = isset($message) ? $message : format_string('File %file exists in database at the correct path.', array('%file' => $file->getFileUri()));
@@ -218,7 +233,7 @@ function assertFileEntryExists($file, $message = NULL) {
   /**
    * Asserts that a file does not exist on disk.
    */
-  function assertFileNotExists($file, $message = NULL) {
+  public function assertFileNotExists($file, $message = NULL) {
     $message = isset($message) ? $message : format_string('File %file exists on the disk.', array('%file' => $file->getFileUri()));
     $this->assertFalse(is_file($file->getFileUri()), $message);
   }
@@ -226,7 +241,7 @@ function assertFileNotExists($file, $message = NULL) {
   /**
    * Asserts that a file does not exist in the database.
    */
-  function assertFileEntryNotExists($file, $message) {
+  public function assertFileEntryNotExists($file, $message) {
     $this->container->get('entity.manager')->getStorage('file')->resetCache();
     $message = isset($message) ? $message : format_string('File %file exists in database at the correct path.', array('%file' => $file->getFileUri()));
     $this->assertFalse(file_load($file->id()), $message);
@@ -235,7 +250,7 @@ function assertFileEntryNotExists($file, $message) {
   /**
    * Asserts that a file's status is set to permanent in the database.
    */
-  function assertFileIsPermanent(FileInterface $file, $message = NULL) {
+  public function assertFileIsPermanent(FileInterface $file, $message = NULL) {
     $message = isset($message) ? $message : format_string('File %file is permanent.', array('%file' => $file->getFileUri()));
     $this->assertTrue($file->isPermanent(), $message);
   }
diff --git a/core/modules/file/src/Tests/FileFieldValidateTest.php b/core/modules/file/src/Tests/FileFieldValidateTest.php
index 182ffad..14685d2 100644
--- a/core/modules/file/src/Tests/FileFieldValidateTest.php
+++ b/core/modules/file/src/Tests/FileFieldValidateTest.php
@@ -18,12 +18,12 @@
  */
 class FileFieldValidateTest extends FileFieldTestBase {
   protected $field;
-  protected $node_type;
+  protected $nodeType;
 
   /**
    * Tests the required property on file fields.
    */
-  function testRequired() {
+  public function testRequired() {
     $type_name = 'article';
     $field_name = strtolower($this->randomMachineName());
     $field = $this->createFileField($field_name, 'node', $type_name, array(), array('required' => '1'));
@@ -39,7 +39,12 @@ function testRequired() {
 
     // Create a new node with the uploaded file.
     $nid = $this->uploadNodeFile($test_file, $field_name, $type_name);
-    $this->assertTrue($nid !== FALSE, format_string('uploadNodeFile(@test_file, @field_name, @type_name) succeeded', array('@test_file' => $test_file->getFileUri(), '@field_name' => $field_name, '@type_name' => $type_name)));
+    $this->assertTrue($nid !== FALSE, format_string('uploadNodeFile(@test_file, @field_name, @type_name) succeeded',
+      array(
+        '@test_file' => $test_file->getFileUri(),
+        '@field_name' => $field_name,
+        '@type_name' => $type_name,
+      )));
 
     $node = node_load($nid, TRUE);
 
@@ -68,13 +73,15 @@ function testRequired() {
   /**
    * Tests the max file size validator.
    */
-  function testFileMaxSize() {
+  public function testFileMaxSize() {
     $type_name = 'article';
     $field_name = strtolower($this->randomMachineName());
     $this->createFileField($field_name, 'node', $type_name, array(), array('required' => '1'));
 
-    $small_file = $this->getTestFile('text', 131072); // 128KB.
-    $large_file = $this->getTestFile('text', 1310720); // 1.2MB
+    // 128KB.
+    $small_file = $this->getTestFile('text', 131072);
+    // 1.2MB
+    $large_file = $this->getTestFile('text', 1310720);
 
     // Test uploading both a large and small file with different increments.
     $sizes = array(
@@ -114,7 +121,7 @@ function testFileMaxSize() {
   /**
    * Tests file extension checking.
    */
-  function testFileExtension() {
+  public function testFileExtension() {
     $type_name = 'article';
     $field_name = strtolower($this->randomMachineName());
     $this->createFileField($field_name, 'node', $type_name);
diff --git a/core/modules/file/src/Tests/FileFieldWidgetTest.php b/core/modules/file/src/Tests/FileFieldWidgetTest.php
index 9ae0940..9b76226 100644
--- a/core/modules/file/src/Tests/FileFieldWidgetTest.php
+++ b/core/modules/file/src/Tests/FileFieldWidgetTest.php
@@ -11,8 +11,10 @@
 use Drupal\field\Entity\FieldInstanceConfig;
 
 /**
- * Tests the file field widget, single and multi-valued, with and without AJAX,
- * with public and private files.
+ * Tests the file field widget.
+ *
+ * All options viz. single and multi-valued, with and without AJAX,
+ * with public and private files
  *
  * @group file
  */
@@ -28,7 +30,7 @@ class FileFieldWidgetTest extends FileFieldTestBase {
   /**
    * Tests upload and remove buttons for a single-valued File field.
    */
-  function testSingleValuedWidget() {
+  public function testSingleValuedWidget() {
     $type_name = 'article';
     $field_name = strtolower($this->randomMachineName());
     $this->createFileField($field_name, 'node', $type_name);
@@ -59,6 +61,7 @@ function testSingleValuedWidget() {
         case 'nojs':
           $this->drupalPostForm(NULL, array(), t('Remove'));
           break;
+
         case 'js':
           $button = $this->xpath('//input[@type="submit" and @value="' . t('Remove') . '"]');
           $this->drupalPostAjaxForm(NULL, array(), array((string) $button[0]['name'] => (string) $button[0]['value']));
@@ -82,7 +85,7 @@ function testSingleValuedWidget() {
   /**
    * Tests upload and remove buttons for multiple multi-valued File fields.
    */
-  function testMultiValuedWidget() {
+  public function testMultiValuedWidget() {
     $type_name = 'article';
     // Use explicit names instead of random names for those fields, because of a
     // bug in drupalPostForm() with multiple file uploads in one form, where the
@@ -103,15 +106,14 @@ function testMultiValuedWidget() {
       // until after the 3rd file, and after that, isn't displayed. Because
       // SimpleTest triggers the last button with a given name, so upload to the
       // second field first.
-      // @todo This is only testing a non-Ajax upload, because drupalPostAjaxForm()
-      //   does not yet emulate jQuery's file upload.
-      //
+      // @todo This is only testing a non-Ajax upload, because
+      //   drupalPostAjaxForm() does not yet emulate jQuery's file upload.
       $this->drupalGet("node/add/$type_name");
       foreach (array($field_name2, $field_name) as $each_field_name) {
         for ($delta = 0; $delta < 3; $delta++) {
           $edit = array('files[' . $each_field_name . '_' . $delta . '][]' => drupal_realpath($test_file->getFileUri()));
-          // If the Upload button doesn't exist, drupalPostForm() will automatically
-          // fail with an assertion message.
+          // If the Upload button doesn't exist, drupalPostForm() will
+          // automatically fail with an assertion message.
           $this->drupalPostForm(NULL, $edit, t('Upload'));
         }
       }
@@ -122,13 +124,13 @@ function testMultiValuedWidget() {
       foreach (array($field_name, $field_name2) as $current_field_name) {
         // How many uploaded files for the current field are remaining.
         $remaining = 3;
-        // Test clicking each "Remove" button. For extra robustness, test them out
-        // of sequential order. They are 0-indexed, and get renumbered after each
-        // iteration, so array(1, 1, 0) means:
+        // Test clicking each "Remove" button. For extra robustness,
+        // test them out of sequential order. They are 0-indexed, and
+        // get renumbered after each iteration, so array(1, 1, 0) means:
         // - First remove the 2nd file.
-        // - Then remove what is then the 2nd file (was originally the 3rd file).
+        // - Then remove what is then the 2nd file(was originally the 3rd file).
         // - Then remove the first file.
-        foreach (array(1,1,0) as $delta) {
+        foreach (array(1, 1, 0) as $delta) {
           // Ensure we have the expected number of Remove buttons, and that they
           // are numbered sequentially.
           $buttons = $this->xpath('//input[@type="submit" and @value="Remove"]');
@@ -140,20 +142,21 @@ function testMultiValuedWidget() {
               $check_field_name = $field_name;
             }
 
-            $this->assertIdentical((string) $button['name'], $check_field_name . '_' . $key. '_remove_button');
+            $this->assertIdentical((string) $button['name'], $check_field_name . '_' . $key . '_remove_button');
           }
 
-          // "Click" the remove button (emulating either a nojs or js submission).
+          // "Click" remove button (emulating either a nojs or js submission).
           $button_name = $current_field_name . '_' . $delta . '_remove_button';
           switch ($type) {
             case 'nojs':
-              // drupalPostForm() takes a $submit parameter that is the value of the
-              // button whose click we want to emulate. Since we have multiple
-              // buttons with the value "Remove", and want to control which one we
-              // use, we change the value of the other ones to something else.
+              // drupalPostForm() takes a $submit parameter that is the value
+              // of the button whose click we want to emulate. Since we have
+              // multiple buttons with the value "Remove", and want to control
+              // which one we use, we change the value of the other ones to
+              // something else.
               // Since non-clicked buttons aren't included in the submitted POST
-              // data, and since drupalPostForm() will result in $this being updated
-              // with a newly rebuilt form, this doesn't cause problems.
+              // data, and since drupalPostForm() will result in $this being
+              // updated with a newly rebuilt form, this doesn't cause problems.
               foreach ($buttons as $button) {
                 if ($button['name'] != $button_name) {
                   $button['value'] = 'DUMMY';
@@ -161,17 +164,18 @@ function testMultiValuedWidget() {
               }
               $this->drupalPostForm(NULL, array(), t('Remove'));
               break;
+
             case 'js':
-              // drupalPostAjaxForm() lets us target the button precisely, so we don't
-              // require the workaround used above for nojs.
+              // drupalPostAjaxForm() lets us target the button precisely,
+              // so we don't require the workaround used above for nojs.
               $this->drupalPostAjaxForm(NULL, array(), array($button_name => t('Remove')));
               break;
           }
           $num_expected_remove_buttons--;
           $remaining--;
 
-          // Ensure an "Upload" button for the current field is displayed with the
-          // correct name.
+          // Ensure an "Upload" button for the current field is displayed with
+          // the correct name.
           $upload_button_name = $current_field_name . '_' . $remaining . '_upload_button';
           $buttons = $this->xpath('//input[@type="submit" and @value="Upload" and @name=:name]', array(':name' => $upload_button_name));
           $this->assertTrue(is_array($buttons) && count($buttons) == 1, format_string('The upload button is displayed with the correct name (JSMode=%type).', array('%type' => $type)));
@@ -199,9 +203,9 @@ function testMultiValuedWidget() {
   /**
    * Tests a file field with a "Private files" upload destination setting.
    */
-  function testPrivateFileSetting() {
+  public function testPrivateFileSetting() {
     // Grant the admin user required permissions.
-    user_role_grant_permissions($this->admin_user->roles[0]->value, array('administer node fields'));
+    user_role_grant_permissions($this->adminUser->roles[0]->value, array('administer node fields'));
 
     $type_name = 'article';
     $field_name = strtolower($this->randomMachineName());
@@ -236,11 +240,11 @@ function testPrivateFileSetting() {
   /**
    * Tests that download restrictions on private files work on comments.
    */
-  function testPrivateFileComment() {
+  public function testPrivateFileComment() {
     $user = $this->drupalCreateUser(array('access comments'));
 
     // Grant the admin user required comment permissions.
-    $roles = $this->admin_user->getRoles();
+    $roles = $this->adminUser->getRoles();
     user_role_grant_permissions($roles[1], array('administer comment fields', 'administer comments'));
 
     // Revoke access comments permission from anon user, grant post to
@@ -300,7 +304,7 @@ function testPrivateFileComment() {
     $this->assertResponse(403, 'Confirmed that access is denied for the file without the needed permission.');
 
     // Unpublishes node.
-    $this->drupalLogin($this->admin_user);
+    $this->drupalLogin($this->adminUser);
     $this->drupalPostForm('node/' . $node->id() . '/edit', array(), t('Save and unpublish'));
 
     // Ensures normal user can no longer download the file.
@@ -312,7 +316,7 @@ function testPrivateFileComment() {
   /**
    * Tests validation with the Upload button.
    */
-  function testWidgetValidation() {
+  public function testWidgetValidation() {
     $type_name = 'article';
     $field_name = strtolower($this->randomMachineName());
     $this->createFileField($field_name, 'node', $type_name);
@@ -333,6 +337,7 @@ function testWidgetValidation() {
         case 'nojs':
           $this->drupalPostForm(NULL, $edit, t('Upload'));
           break;
+
         case 'js':
           $button = $this->xpath('//input[@type="submit" and @value="' . t('Upload') . '"]');
           $this->drupalPostAjaxForm(NULL, $edit, array((string) $button[0]['name'] => (string) $button[0]['value']));
@@ -341,16 +346,19 @@ function testWidgetValidation() {
       $error_message = t('Only files with the following extensions are allowed: %files-allowed.', array('%files-allowed' => 'txt'));
       $this->assertRaw($error_message, t('Validation error when file with wrong extension uploaded (JSMode=%type).', array('%type' => $type)));
 
-      // Upload file with correct extension, check that error message is removed.
+      // Upload file with correct extension, check that error message is
+      // removed.
       $edit[$name] = drupal_realpath($test_file_text->getFileUri());
       switch ($type) {
         case 'nojs':
           $this->drupalPostForm(NULL, $edit, t('Upload'));
           break;
+
         case 'js':
           $button = $this->xpath('//input[@type="submit" and @value="' . t('Upload') . '"]');
           $this->drupalPostAjaxForm(NULL, $edit, array((string) $button[0]['name'] => (string) $button[0]['value']));
           break;
+
       }
       $this->assertNoRaw($error_message, t('Validation error removed when file with correct extension uploaded (JSMode=%type).', array('%type' => $type)));
     }
diff --git a/core/modules/file/src/Tests/FileItemTest.php b/core/modules/file/src/Tests/FileItemTest.php
index 0c55585..e4d938b 100644
--- a/core/modules/file/src/Tests/FileItemTest.php
+++ b/core/modules/file/src/Tests/FileItemTest.php
@@ -33,6 +33,9 @@ class FileItemTest extends FieldUnitTestBase {
    */
   protected $file;
 
+  /**
+   * {@inheritdoc}
+   */
   protected function setUp() {
     parent::setUp();
 
@@ -61,7 +64,7 @@ protected function setUp() {
    * Tests using entity fields of the file field type.
    */
   public function testFileItem() {
-    // Create a test entity with the
+    // Create a test entity with the.
     $entity = entity_create('entity_test');
     $entity->file_test->target_id = $this->file->id();
     $entity->file_test->display = 1;
diff --git a/core/modules/file/src/Tests/FileListingTest.php b/core/modules/file/src/Tests/FileListingTest.php
index 216bb5f..681dc96 100644
--- a/core/modules/file/src/Tests/FileListingTest.php
+++ b/core/modules/file/src/Tests/FileListingTest.php
@@ -17,7 +17,7 @@ class FileListingTest extends FileFieldTestBase {
   /**
    * Modules to enable.
    *
-   * @var array
+   * @var array $modules
    */
   public static $modules = array('views', 'file', 'image');
 
@@ -32,12 +32,13 @@ protected function setUp() {
   /**
    * Calculates total count of usages for a file.
    *
-   * @param $usage array
+   * @param array $usage
    *   Array of file usage information as returned from file_usage subsystem.
+   *
    * @return int
    *   Total usage count.
    */
-  protected function sumUsages($usage) {
+  protected function sumUsages(array $usage) {
     $count = 0;
     foreach ($usage as $module) {
       foreach ($module as $entity_type) {
@@ -53,7 +54,7 @@ protected function sumUsages($usage) {
   /**
    * Tests file overview with different user permissions.
    */
-  function testFileListingPages() {
+  public function testFileListingPages() {
     $file_usage = $this->container->get('file.usage');
     // Users without sufficient permissions should not see file listing.
     $this->drupalLogin($this->base_user);
@@ -143,7 +144,7 @@ function testFileListingPages() {
    * Creates and saves a test file.
    *
    * @return \Drupal\Core\Entity\EntityInterface
-   *  A file entity.
+   *   A file entity.
    */
   protected function createFile() {
     // Create a new file entity.
diff --git a/core/modules/file/src/Tests/FileManagedFileElementTest.php b/core/modules/file/src/Tests/FileManagedFileElementTest.php
index 8368610..4001164 100644
--- a/core/modules/file/src/Tests/FileManagedFileElementTest.php
+++ b/core/modules/file/src/Tests/FileManagedFileElementTest.php
@@ -18,7 +18,7 @@ class FileManagedFileElementTest extends FileFieldTestBase {
   /**
    * Tests the managed_file element type.
    */
-  function testManagedFile() {
+  public function testManagedFile() {
     // Check that $element['#size'] is passed to the child upload element.
     $this->drupalGet('file/test');
     $this->assertFieldByXpath('//input[@name="files[nested_file]" and @size="13"]', NULL, 'The custom #size attribute is passed to the child upload element.');
diff --git a/core/modules/file/src/Tests/FileManagedTestBase.php b/core/modules/file/src/Tests/FileManagedTestBase.php
index 3147f73..263b200 100644
--- a/core/modules/file/src/Tests/FileManagedTestBase.php
+++ b/core/modules/file/src/Tests/FileManagedTestBase.php
@@ -11,8 +11,7 @@
 use Drupal\simpletest\WebTestBase;
 
 /**
- * Base class for file tests that use the file_test module to test uploads and
- * hooks.
+ * Base class for file tests that use the file_test module to test uploads and hooks.
  */
 abstract class FileManagedTestBase extends WebTestBase {
 
@@ -23,21 +22,25 @@
    */
   public static $modules = array('file_test', 'file');
 
-  protected function setUp() {
+  /**
+   * {@inheritdoc}
+   */
+  public function setUp() {
     parent::setUp();
     // Clear out any hook calls.
     file_test_reset();
   }
 
   /**
-   * Assert that all of the specified hook_file_* hooks were called once, other
-   * values result in failure.
+   * Assert that all of the specified hook_file_* hooks were called once.
    *
-   * @param $expected
+   * Other values result in failure.
+   *
+   * @param array $expected
    *   Array with string containing with the hook name, e.g. 'load', 'save',
    *   'insert', etc.
    */
-  function assertFileHooksCalled($expected) {
+  public function assertFileHooksCalled(array $expected) {
     \Drupal::state()->resetCache();
 
     // Determine which hooks were called.
@@ -46,7 +49,11 @@ function assertFileHooksCalled($expected) {
     // Determine if there were any expected that were not called.
     $uncalled = array_diff($expected, $actual);
     if (count($uncalled)) {
-      $this->assertTrue(FALSE, format_string('Expected hooks %expected to be called but %uncalled was not called.', array('%expected' => implode(', ', $expected), '%uncalled' => implode(', ', $uncalled))));
+      $this->assertTrue(FALSE, format_string('Expected hooks %expected to be called but %uncalled was not called.',
+        array(
+          '%expected' => implode(', ', $expected),
+          '%uncalled' => implode(', ', $uncalled),
+        )));
     }
     else {
       $this->assertTrue(TRUE, format_string('All the expected hooks were called: %expected', array('%expected' => empty($expected) ? '(none)' : implode(', ', $expected))));
@@ -65,14 +72,14 @@ function assertFileHooksCalled($expected) {
   /**
    * Assert that a hook_file_* hook was called a certain number of times.
    *
-   * @param $hook
+   * @param string $hook
    *   String with the hook name, e.g. 'load', 'save', 'insert', etc.
-   * @param $expected_count
+   * @param int $expected_count
    *   Optional integer count.
-   * @param $message
+   * @param string $message
    *   Optional translated string message.
    */
-  function assertFileHookCalled($hook, $expected_count = 1, $message = NULL) {
+  public function assertFileHookCalled($hook, $expected_count = 1, $message = NULL) {
     $actual_count = count(file_test_get_calls($hook));
 
     if (!isset($message)) {
@@ -83,7 +90,12 @@ function assertFileHookCalled($hook, $expected_count = 1, $message = NULL) {
         $message = format_plural($actual_count, 'hook_file_@name was not expected to be called but was actually called once.', 'hook_file_@name was not expected to be called but was actually called @count times.', array('@name' => $hook, '@count' => $actual_count));
       }
       else {
-        $message = format_string('hook_file_@name was expected to be called %expected times but was called %actual times.', array('@name' => $hook, '%expected' => $expected_count, '%actual' => $actual_count));
+        $message = format_string('hook_file_@name was expected to be called %expected times but was called %actual times.',
+          array(
+            '@name' => $hook,
+            '%expected' => $expected_count,
+            '%actual' => $actual_count,
+          ));
       }
     }
     $this->assertEqual($actual_count, $expected_count, $message);
@@ -97,7 +109,7 @@ function assertFileHookCalled($hook, $expected_count = 1, $message = NULL) {
    * @param \Drupal\file\FileInterface $after
    *   File object to compare.
    */
-  function assertFileUnchanged(FileInterface $before, FileInterface $after) {
+  public function assertFileUnchanged(FileInterface $before, FileInterface $after) {
     $this->assertEqual($before->id(), $after->id(), t('File id is the same: %file1 == %file2.', array('%file1' => $before->id(), '%file2' => $after->id())), 'File unchanged');
     $this->assertEqual($before->getOwner()->id(), $after->getOwner()->id(), t('File owner is the same: %file1 == %file2.', array('%file1' => $before->getOwner()->id(), '%file2' => $after->getOwner()->id())), 'File unchanged');
     $this->assertEqual($before->getFilename(), $after->getFilename(), t('File name is the same: %file1 == %file2.', array('%file1' => $before->getFilename(), '%file2' => $after->getFilename())), 'File unchanged');
@@ -115,7 +127,7 @@ function assertFileUnchanged(FileInterface $before, FileInterface $after) {
    * @param \Drupal\file\FileInterface $file2
    *   File object to compare.
    */
-  function assertDifferentFile(FileInterface $file1, FileInterface $file2) {
+  public function assertDifferentFile(FileInterface $file1, FileInterface $file2) {
     $this->assertNotEqual($file1->id(), $file2->id(), t('Files have different ids: %file1 != %file2.', array('%file1' => $file1->id(), '%file2' => $file2->id())), 'Different file');
     $this->assertNotEqual($file1->getFileUri(), $file2->getFileUri(), t('Files have different paths: %file1 != %file2.', array('%file1' => $file1->getFileUri(), '%file2' => $file2->getFileUri())), 'Different file');
   }
@@ -128,28 +140,28 @@ function assertDifferentFile(FileInterface $file1, FileInterface $file2) {
    * @param \Drupal\file\FileInterface $file2
    *   File object to compare.
    */
-  function assertSameFile(FileInterface $file1, FileInterface $file2) {
+  public function assertSameFile(FileInterface $file1, FileInterface $file2) {
     $this->assertEqual($file1->id(), $file2->id(), t('Files have the same ids: %file1 == %file2.', array('%file1' => $file1->id(), '%file2-fid' => $file2->id())), 'Same file');
     $this->assertEqual($file1->getFileUri(), $file2->getFileUri(), t('Files have the same path: %file1 == %file2.', array('%file1' => $file1->getFileUri(), '%file2' => $file2->getFileUri())), 'Same file');
   }
 
   /**
-   * Create a file and save it to the files table and assert that it occurs
-   * correctly.
+   * Create a file and save it to the files table and assert that it occurs correctly.
    *
-   * @param $filepath
+   * @param string $filepath
    *   Optional string specifying the file path. If none is provided then a
    *   randomly named file will be created in the site's files directory.
-   * @param $contents
+   * @param string $contents
    *   Optional contents to save into the file. If a NULL value is provided an
    *   arbitrary string will be used.
-   * @param $scheme
+   * @param string $scheme
    *   Optional string indicating the stream scheme to use. Drupal core includes
    *   public, private, and temporary. The public wrapper is the default.
-   * @return \Drupal\file\FileInterface
-   *   File entity.
+   *
+   * @return string
+   *   \Drupal\file\FileInterface File entity.
    */
-  function createFile($filepath = NULL, $contents = NULL, $scheme = NULL) {
+  public function createFile($filepath = NULL, $contents = NULL, $scheme = NULL) {
     // Don't count hook invocations caused by creating the file.
     \Drupal::state()->set('file_test.count_hook_invocations', FALSE);
     $file = entity_create('file', array(
@@ -181,7 +193,7 @@ function createFile($filepath = NULL, $contents = NULL, $scheme = NULL) {
    * @return string
    *   File URI.
    */
-  function createUri($filepath = NULL, $contents = NULL, $scheme = NULL) {
+  public function createUri($filepath = NULL, $contents = NULL, $scheme = NULL) {
     if (!isset($filepath)) {
       // Prefix with non-latin characters to ensure that all file-related
       // tests work with international filenames.
diff --git a/core/modules/file/src/Tests/FileManagedUnitTestBase.php b/core/modules/file/src/Tests/FileManagedUnitTestBase.php
index 051601a..7104745 100644
--- a/core/modules/file/src/Tests/FileManagedUnitTestBase.php
+++ b/core/modules/file/src/Tests/FileManagedUnitTestBase.php
@@ -11,8 +11,7 @@
 use Drupal\simpletest\DrupalUnitTestBase;
 
 /**
- * Base class for file unit tests that use the file_test module to test uploads and
- * hooks.
+ * Base class for file tests using file_test module to test uploads and hooks.
  */
 abstract class FileManagedUnitTestBase extends DrupalUnitTestBase {
 
@@ -23,7 +22,10 @@
    */
   public static $modules = array('file_test', 'file', 'system', 'field', 'user');
 
-  protected function setUp() {
+  /**
+   * {@inheritdoc}
+   */
+  public function setUp() {
     parent::setUp();
     // Clear out any hook calls.
     file_test_reset();
@@ -42,14 +44,15 @@ protected function setUp() {
   }
 
   /**
-   * Assert that all of the specified hook_file_* hooks were called once, other
-   * values result in failure.
+   * Assert that all of the specified hook_file_* hooks were called once.
    *
-   * @param $expected
+   * Other values result in failure.
+   *
+   * @param array $expected
    *   Array with string containing with the hook name, e.g. 'load', 'save',
    *   'insert', etc.
    */
-  function assertFileHooksCalled($expected) {
+  public function assertFileHooksCalled(array $expected) {
     \Drupal::state()->resetCache();
 
     // Determine which hooks were called.
@@ -58,7 +61,11 @@ function assertFileHooksCalled($expected) {
     // Determine if there were any expected that were not called.
     $uncalled = array_diff($expected, $actual);
     if (count($uncalled)) {
-      $this->assertTrue(FALSE, format_string('Expected hooks %expected to be called but %uncalled was not called.', array('%expected' => implode(', ', $expected), '%uncalled' => implode(', ', $uncalled))));
+      $this->assertTrue(FALSE, format_string('Expected hooks %expected to be called but %uncalled was not called.',
+        array(
+          '%expected' => implode(', ', $expected),
+          '%uncalled' => implode(', ', $uncalled),
+        )));
     }
     else {
       $this->assertTrue(TRUE, format_string('All the expected hooks were called: %expected', array('%expected' => empty($expected) ? '(none)' : implode(', ', $expected))));
@@ -77,14 +84,14 @@ function assertFileHooksCalled($expected) {
   /**
    * Assert that a hook_file_* hook was called a certain number of times.
    *
-   * @param $hook
+   * @param string $hook
    *   String with the hook name, e.g. 'load', 'save', 'insert', etc.
-   * @param $expected_count
+   * @param int $expected_count
    *   Optional integer count.
-   * @param $message
+   * @param string $message
    *   Optional translated string message.
    */
-  function assertFileHookCalled($hook, $expected_count = 1, $message = NULL) {
+  public function assertFileHookCalled($hook, $expected_count = 1, $message = NULL) {
     $actual_count = count(file_test_get_calls($hook));
 
     if (!isset($message)) {
@@ -95,7 +102,12 @@ function assertFileHookCalled($hook, $expected_count = 1, $message = NULL) {
         $message = format_plural($actual_count, 'hook_file_@name was not expected to be called but was actually called once.', 'hook_file_@name was not expected to be called but was actually called @count times.', array('@name' => $hook, '@count' => $actual_count));
       }
       else {
-        $message = format_string('hook_file_@name was expected to be called %expected times but was called %actual times.', array('@name' => $hook, '%expected' => $expected_count, '%actual' => $actual_count));
+        $message = format_string('hook_file_@name was expected to be called %expected times but was called %actual times.',
+          array(
+            '@name' => $hook,
+            '%expected' => $expected_count,
+            '%actual' => $actual_count,
+          ));
       }
     }
     $this->assertEqual($actual_count, $expected_count, $message);
@@ -109,7 +121,7 @@ function assertFileHookCalled($hook, $expected_count = 1, $message = NULL) {
    * @param \Drupal\file\FileInterface $after
    *   File object to compare.
    */
-  function assertFileUnchanged(FileInterface $before, FileInterface $after) {
+  public function assertFileUnchanged(FileInterface $before, FileInterface $after) {
     $this->assertEqual($before->id(), $after->id(), t('File id is the same: %file1 == %file2.', array('%file1' => $before->id(), '%file2' => $after->id())), 'File unchanged');
     $this->assertEqual($before->getOwner()->id(), $after->getOwner()->id(), t('File owner is the same: %file1 == %file2.', array('%file1' => $before->getOwner()->id(), '%file2' => $after->getOwner()->id())), 'File unchanged');
     $this->assertEqual($before->getFilename(), $after->getFilename(), t('File name is the same: %file1 == %file2.', array('%file1' => $before->getFilename(), '%file2' => $after->getFilename())), 'File unchanged');
@@ -127,7 +139,7 @@ function assertFileUnchanged(FileInterface $before, FileInterface $after) {
    * @param \Drupal\file\FileInterface $file2
    *   File object to compare.
    */
-  function assertDifferentFile(FileInterface $file1, FileInterface $file2) {
+  public function assertDifferentFile(FileInterface $file1, FileInterface $file2) {
     $this->assertNotEqual($file1->id(), $file2->id(), t('Files have different ids: %file1 != %file2.', array('%file1' => $file1->id(), '%file2' => $file2->id())), 'Different file');
     $this->assertNotEqual($file1->getFileUri(), $file2->getFileUri(), t('Files have different paths: %file1 != %file2.', array('%file1' => $file1->getFileUri(), '%file2' => $file2->getFileUri())), 'Different file');
   }
@@ -140,28 +152,28 @@ function assertDifferentFile(FileInterface $file1, FileInterface $file2) {
    * @param \Drupal\file\FileInterface $file2
    *   File object to compare.
    */
-  function assertSameFile(FileInterface $file1, FileInterface $file2) {
+  public function assertSameFile(FileInterface $file1, FileInterface $file2) {
     $this->assertEqual($file1->id(), $file2->id(), t('Files have the same ids: %file1 == %file2.', array('%file1' => $file1->id(), '%file2-fid' => $file2->id())), 'Same file');
     $this->assertEqual($file1->getFileUri(), $file2->getFileUri(), t('Files have the same path: %file1 == %file2.', array('%file1' => $file1->getFileUri(), '%file2' => $file2->getFileUri())), 'Same file');
   }
 
   /**
-   * Create a file and save it to the files table and assert that it occurs
-   * correctly.
+   * Create a file, save to the files table & assert that it occurs correctly.
    *
-   * @param $filepath
+   * @param string $filepath
    *   Optional string specifying the file path. If none is provided then a
    *   randomly named file will be created in the site's files directory.
-   * @param $contents
+   * @param string $contents
    *   Optional contents to save into the file. If a NULL value is provided an
    *   arbitrary string will be used.
-   * @param $scheme
+   * @param string $scheme
    *   Optional string indicating the stream scheme to use. Drupal core includes
    *   public, private, and temporary. The public wrapper is the default.
+   *
    * @return \Drupal\file\FileInterface
    *   File entity.
    */
-  function createFile($filepath = NULL, $contents = NULL, $scheme = NULL) {
+  public function createFile($filepath = NULL, $contents = NULL, $scheme = NULL) {
     // Don't count hook invocations caused by creating the file.
     \Drupal::state()->set('file_test.count_hook_invocations', FALSE);
     $file = entity_create('file', array(
@@ -193,7 +205,7 @@ function createFile($filepath = NULL, $contents = NULL, $scheme = NULL) {
    * @return string
    *   File URI.
    */
-  function createUri($filepath = NULL, $contents = NULL, $scheme = NULL) {
+  public function createUri($filepath = NULL, $contents = NULL, $scheme = NULL) {
     if (!isset($filepath)) {
       // Prefix with non-latin characters to ensure that all file-related
       // tests work with international filenames.
diff --git a/core/modules/file/src/Tests/FilePrivateTest.php b/core/modules/file/src/Tests/FilePrivateTest.php
index d1561cc..2016275 100644
--- a/core/modules/file/src/Tests/FilePrivateTest.php
+++ b/core/modules/file/src/Tests/FilePrivateTest.php
@@ -33,7 +33,7 @@ protected function setUp() {
   /**
    * Tests file access for file uploaded to a private node.
    */
-  function testPrivateFile() {
+  public function testPrivateFile() {
     $type_name = 'article';
     $field_name = strtolower($this->randomMachineName());
     $this->createFileField($field_name, 'node', $type_name, array('uri_scheme' => 'private'));
@@ -55,7 +55,7 @@ function testPrivateFile() {
     $this->assertResponse(403, 'Confirmed that access is denied for the file without the needed permission.');
 
     // Test with the field that should deny access through field access.
-    $this->drupalLogin($this->admin_user);
+    $this->drupalLogin($this->adminUser);
     $nid = $this->uploadNodeFile($test_file, $no_access_field_name, $type_name, TRUE, array('private' => TRUE));
     \Drupal::entityManager()->getStorage('node')->resetCache(array($nid));
     $node = Node::load($nid);
diff --git a/core/modules/file/src/Tests/FileTokenReplaceTest.php b/core/modules/file/src/Tests/FileTokenReplaceTest.php
index 36fe888..8f564db 100644
--- a/core/modules/file/src/Tests/FileTokenReplaceTest.php
+++ b/core/modules/file/src/Tests/FileTokenReplaceTest.php
@@ -19,7 +19,7 @@ class FileTokenReplaceTest extends FileFieldTestBase {
   /**
    * Creates a file, then tests the tokens generated from it.
    */
-  function testFileTokenReplacement() {
+  public function testFileTokenReplacement() {
     $token_service = \Drupal::token();
     $language_interface = \Drupal::languageManager()->getCurrentLanguage();
 
@@ -52,7 +52,7 @@ function testFileTokenReplacement() {
     $tests['[file:created:short]'] = format_date($file->getCreatedTime(), 'short', '', NULL, $language_interface->id);
     $tests['[file:changed]'] = format_date($file->getChangedTime(), 'medium', '', NULL, $language_interface->id);
     $tests['[file:changed:short]'] = format_date($file->getChangedTime(), 'short', '', NULL, $language_interface->id);
-    $tests['[file:owner]'] = String::checkPlain(user_format_name($this->admin_user));
+    $tests['[file:owner]'] = String::checkPlain(user_format_name($this->adminUser));
     $tests['[file:owner:uid]'] = $file->getOwnerId();
 
     // Test to make sure that we generated something for each token.
diff --git a/core/modules/file/src/Tests/LoadTest.php b/core/modules/file/src/Tests/LoadTest.php
index 7c593cb..58d2d8d 100644
--- a/core/modules/file/src/Tests/LoadTest.php
+++ b/core/modules/file/src/Tests/LoadTest.php
@@ -16,7 +16,7 @@ class LoadTest extends FileManagedUnitTestBase {
   /**
    * Try to load a non-existent file by fid.
    */
-  function testLoadMissingFid() {
+  public function testLoadMissingFid() {
     $this->assertFalse(file_load(-1), 'Try to load an invalid fid fails.');
     $this->assertFileHooksCalled(array());
   }
@@ -24,7 +24,7 @@ function testLoadMissingFid() {
   /**
    * Try to load a non-existent file by URI.
    */
-  function testLoadMissingFilepath() {
+  public function testLoadMissingFilepath() {
     $files = entity_load_multiple_by_properties('file', array('uri' => 'foobar://misc/druplicon.png'));
     $this->assertFalse(reset($files), "Try to load a file that doesn't exist in the database fails.");
     $this->assertFileHooksCalled(array());
@@ -33,7 +33,7 @@ function testLoadMissingFilepath() {
   /**
    * Try to load a non-existent file by status.
    */
-  function testLoadInvalidStatus() {
+  public function testLoadInvalidStatus() {
     $files = entity_load_multiple_by_properties('file', array('status' => -99));
     $this->assertFalse(reset($files), 'Trying to load a file with an invalid status fails.');
     $this->assertFileHooksCalled(array());
@@ -42,7 +42,7 @@ function testLoadInvalidStatus() {
   /**
    * Load a single file and ensure that the correct values are returned.
    */
-  function testSingleValues() {
+  public function testSingleValues() {
     // Create a new file entity from scratch so we know the values.
     $file = $this->createFile('druplicon.txt', NULL, 'public');
 
@@ -60,7 +60,7 @@ function testSingleValues() {
   /**
    * This will test loading file data from the database.
    */
-  function testMultiple() {
+  public function testMultiple() {
     // Create a new file entity.
     $file = $this->createFile('druplicon.txt', NULL, 'public');
 
diff --git a/core/modules/file/src/Tests/MoveTest.php b/core/modules/file/src/Tests/MoveTest.php
index 9b1bfc2..f0198d5 100644
--- a/core/modules/file/src/Tests/MoveTest.php
+++ b/core/modules/file/src/Tests/MoveTest.php
@@ -16,7 +16,7 @@ class MoveTest extends FileManagedUnitTestBase {
   /**
    * Move a normal file.
    */
-  function testNormal() {
+  public function testNormal() {
     $contents = $this->randomMachineName(10);
     $source = $this->createFile(NULL, $contents);
     $desired_filepath = 'public://' . $this->randomMachineName();
@@ -46,7 +46,7 @@ function testNormal() {
   /**
    * Test renaming when moving onto a file that already exists.
    */
-  function testExistingRename() {
+  public function testExistingRename() {
     // Setup a file to overwrite.
     $contents = $this->randomMachineName(10);
     $source = $this->createFile(NULL, $contents);
@@ -81,7 +81,7 @@ function testExistingRename() {
   /**
    * Test replacement when moving onto a file that already exists.
    */
-  function testExistingReplace() {
+  public function testExistingReplace() {
     // Setup a file to overwrite.
     $contents = $this->randomMachineName(10);
     $source = $this->createFile(NULL, $contents);
@@ -113,7 +113,7 @@ function testExistingReplace() {
   /**
    * Test replacement when moving onto itself.
    */
-  function testExistingReplaceSelf() {
+  public function testExistingReplaceSelf() {
     // Setup a file to overwrite.
     $contents = $this->randomMachineName(10);
     $source = $this->createFile(NULL, $contents);
@@ -133,10 +133,11 @@ function testExistingReplaceSelf() {
   }
 
   /**
-   * Test that moving onto an existing file fails when FILE_EXISTS_ERROR is
-   * specified.
+   * Test that moving onto an existing file fails when.
+   *
+   * FILE_EXISTS_ERROR is specified.
    */
-  function testExistingError() {
+  public function testExistingError() {
     $contents = $this->randomMachineName(10);
     $source = $this->createFile();
     $target = $this->createFile(NULL, $contents);
diff --git a/core/modules/file/src/Tests/RemoteFileSaveUploadTest.php b/core/modules/file/src/Tests/RemoteFileSaveUploadTest.php
index 81f4340..31749cc 100644
--- a/core/modules/file/src/Tests/RemoteFileSaveUploadTest.php
+++ b/core/modules/file/src/Tests/RemoteFileSaveUploadTest.php
@@ -21,7 +21,10 @@ class RemoteFileSaveUploadTest extends SaveUploadTest {
    */
   public static $modules = array('file_test');
 
-  protected function setUp() {
+  /**
+   * {@inheritdoc}
+   */
+  public function setUp() {
     parent::setUp();
     \Drupal::config('system.file')->set('default_scheme', 'dummy-remote')->save();
   }
diff --git a/core/modules/file/src/Tests/SaveDataTest.php b/core/modules/file/src/Tests/SaveDataTest.php
index 8368e0b..3e7622f 100644
--- a/core/modules/file/src/Tests/SaveDataTest.php
+++ b/core/modules/file/src/Tests/SaveDataTest.php
@@ -16,7 +16,7 @@ class SaveDataTest extends FileManagedUnitTestBase {
   /**
    * Test the file_save_data() function when no filename is provided.
    */
-  function testWithoutFilename() {
+  public function testWithoutFilename() {
     $contents = $this->randomMachineName(8);
 
     $result = file_save_data($contents);
@@ -38,7 +38,7 @@ function testWithoutFilename() {
   /**
    * Test the file_save_data() function when a filename is provided.
    */
-  function testWithFilename() {
+  public function testWithFilename() {
     $contents = $this->randomMachineName(8);
 
     // Using filename with non-latin characters.
@@ -63,7 +63,7 @@ function testWithFilename() {
   /**
    * Test file_save_data() when renaming around an existing file.
    */
-  function testExistingRename() {
+  public function testExistingRename() {
     // Setup a file to overwrite.
     $existing = $this->createFile();
     $contents = $this->randomMachineName(8);
@@ -91,7 +91,7 @@ function testExistingRename() {
   /**
    * Test file_save_data() when replacing an existing file.
    */
-  function testExistingReplace() {
+  public function testExistingReplace() {
     // Setup a file to overwrite.
     $existing = $this->createFile();
     $contents = $this->randomMachineName(8);
@@ -118,7 +118,7 @@ function testExistingReplace() {
   /**
    * Test that file_save_data() fails overwriting an existing file.
    */
-  function testExistingError() {
+  public function testExistingError() {
     $contents = $this->randomMachineName(8);
     $existing = $this->createFile(NULL, $contents);
 
diff --git a/core/modules/file/src/Tests/SaveTest.php b/core/modules/file/src/Tests/SaveTest.php
index ee6c1a3..63d0509 100644
--- a/core/modules/file/src/Tests/SaveTest.php
+++ b/core/modules/file/src/Tests/SaveTest.php
@@ -15,7 +15,10 @@
  * @group file
  */
 class SaveTest extends FileManagedUnitTestBase {
-  function testFileSave() {
+  /**
+   * Tests the saving of a file.
+   */
+  public function testFileSave() {
     // Create a new file entity.
     $file = entity_create('file', array(
       'uid' => 1,
@@ -57,8 +60,9 @@ function testFileSave() {
     $this->assertEqual($loaded_file->isPermanent(), $file->isPermanent(), 'Status was saved correctly.');
     $this->assertEqual($loaded_file->langcode->value, 'en', 'Langcode was saved correctly.');
 
-    // Try to insert a second file with the same name apart from case insensitivity
-    // to ensure the 'uri' index allows for filenames with different cases.
+    // Try to insert a second file with the same name apart from case
+    // insensitivity to ensure the 'uri' index allows for filenames
+    // with different cases.
     $file = entity_create('file', array(
       'uid' => 1,
       'filename' => 'DRUPLICON.txt',
diff --git a/core/modules/file/src/Tests/SaveUploadTest.php b/core/modules/file/src/Tests/SaveUploadTest.php
index 30e681d..bb762a5 100644
--- a/core/modules/file/src/Tests/SaveUploadTest.php
+++ b/core/modules/file/src/Tests/SaveUploadTest.php
@@ -28,7 +28,7 @@ class SaveUploadTest extends FileManagedTestBase {
    */
   protected $maxFidBefore;
 
-  protected function setUp() {
+  public function setUp() {
     parent::setUp();
     $account = $this->drupalCreateUser();
     $this->drupalLogin($account);
@@ -62,7 +62,7 @@ protected function setUp() {
   /**
    * Test the file_save_upload() function.
    */
-  function testNormal() {
+  public function testNormal() {
     $max_fid_after = db_query('SELECT MAX(fid) AS fid FROM {file_managed}')->fetchField();
     $this->assertTrue($max_fid_after > $this->maxFidBefore, 'A new file was created.');
     $file1 = file_load($max_fid_after);
@@ -111,7 +111,7 @@ function testNormal() {
   /**
    * Test extension handling.
    */
-  function testHandleExtension() {
+  public function testHandleExtension() {
     // The file being tested is a .gif which is in the default safe list
     // of extensions to allow when the extension validator isn't used. This is
     // implicitly tested at the testNormal() test. Here we tell
@@ -172,7 +172,7 @@ function testHandleExtension() {
   /**
    * Test dangerous file handling.
    */
-  function testHandleDangerousFile() {
+  public function testHandleDangerousFile() {
     $config = \Drupal::config('system.file');
     // Allow the .php extension and make sure it gets renamed to .txt for
     // safety. Also check to make sure its MIME type was changed.
@@ -215,7 +215,7 @@ function testHandleDangerousFile() {
   /**
    * Test file munge handling.
    */
-  function testHandleFileMunge() {
+  public function testHandleFileMunge() {
     // Ensure insecure uploads are disabled for this test.
     \Drupal::config('system.file')->set('allow_insecure_uploads', 0)->save();
     $this->image = file_move($this->image, $this->image->getFileUri() . '.foo.' . $this->image_extension);
@@ -264,10 +264,10 @@ function testHandleFileMunge() {
   /**
    * Test renaming when uploading over a file that already exists.
    */
-  function testExistingRename() {
+  public function testExistingRename() {
     $edit = array(
       'file_test_replace' => FILE_EXISTS_RENAME,
-      'files[file_test_upload]' => drupal_realpath($this->image->getFileUri())
+      'files[file_test_upload]' => drupal_realpath($this->image->getFileUri()),
     );
     $this->drupalPostForm('file-test/upload', $edit, t('Submit'));
     $this->assertResponse(200, 'Received a 200 response for posted test file.');
@@ -280,10 +280,10 @@ function testExistingRename() {
   /**
    * Test replacement when uploading over a file that already exists.
    */
-  function testExistingReplace() {
+  public function testExistingReplace() {
     $edit = array(
       'file_test_replace' => FILE_EXISTS_REPLACE,
-      'files[file_test_upload]' => drupal_realpath($this->image->getFileUri())
+      'files[file_test_upload]' => drupal_realpath($this->image->getFileUri()),
     );
     $this->drupalPostForm('file-test/upload', $edit, t('Submit'));
     $this->assertResponse(200, 'Received a 200 response for posted test file.');
@@ -296,10 +296,10 @@ function testExistingReplace() {
   /**
    * Test for failure when uploading over a file that already exists.
    */
-  function testExistingError() {
+  public function testExistingError() {
     $edit = array(
       'file_test_replace' => FILE_EXISTS_ERROR,
-      'files[file_test_upload]' => drupal_realpath($this->image->getFileUri())
+      'files[file_test_upload]' => drupal_realpath($this->image->getFileUri()),
     );
     $this->drupalPostForm('file-test/upload', $edit, t('Submit'));
     $this->assertResponse(200, 'Received a 200 response for posted test file.');
@@ -312,7 +312,7 @@ function testExistingError() {
   /**
    * Test for no failures when not uploading a file.
    */
-  function testNoUpload() {
+  public function testNoUpload() {
     $this->drupalPostForm('file-test/upload', array(), t('Submit'));
     $this->assertNoRaw(t('Epic upload FAIL!'), 'Failure message not found.');
   }
diff --git a/core/modules/file/src/Tests/SpaceUsedTest.php b/core/modules/file/src/Tests/SpaceUsedTest.php
index b9ad13f..6c5b124 100644
--- a/core/modules/file/src/Tests/SpaceUsedTest.php
+++ b/core/modules/file/src/Tests/SpaceUsedTest.php
@@ -13,7 +13,7 @@
  * @group file
  */
 class SpaceUsedTest extends FileManagedUnitTestBase {
-  protected function setUp() {
+  public function setUp() {
     parent::setUp();
 
     // Create records for a couple of users with different sizes.
@@ -56,14 +56,14 @@ protected function createFileWithSize($uri, $size, $uid, $status = FILE_STATUS_P
   /**
    * Test different users with the default status.
    */
-  function testFileSpaceUsed() {
+  public function testFileSpaceUsed() {
     $file = $this->container->get('entity.manager')->getStorage('file');
     // Test different users with default status.
     $this->assertEqual($file->spaceUsed(2), 70);
     $this->assertEqual($file->spaceUsed(3), 300);
     $this->assertEqual($file->spaceUsed(), 370);
 
-    // Test the status fields
+    // Test the status fields.
     $this->assertEqual($file->spaceUsed(NULL, 0), 4);
     $this->assertEqual($file->spaceUsed(NULL, FILE_STATUS_PERMANENT), 370);
 
diff --git a/core/modules/file/src/Tests/UsageTest.php b/core/modules/file/src/Tests/UsageTest.php
index d251bec..7f137a8 100644
--- a/core/modules/file/src/Tests/UsageTest.php
+++ b/core/modules/file/src/Tests/UsageTest.php
@@ -16,7 +16,7 @@ class UsageTest extends FileManagedUnitTestBase {
   /**
    * Tests \Drupal\file\FileUsage\DatabaseFileUsageBackend::listUsage().
    */
-  function testGetUsage() {
+  public function testGetUsage() {
     $file = $this->createFile();
     db_insert('file_usage')
       ->fields(array(
@@ -24,7 +24,7 @@ function testGetUsage() {
         'module' => 'testing',
         'type' => 'foo',
         'id' => 1,
-        'count' => 1
+        'count' => 1,
       ))
       ->execute();
     db_insert('file_usage')
@@ -33,7 +33,7 @@ function testGetUsage() {
         'module' => 'testing',
         'type' => 'bar',
         'id' => 2,
-        'count' => 2
+        'count' => 2,
       ))
       ->execute();
 
@@ -49,7 +49,7 @@ function testGetUsage() {
   /**
    * Tests \Drupal\file\FileUsage\DatabaseFileUsageBackend::add().
    */
-  function testAddUsage() {
+  public function testAddUsage() {
     $file = $this->createFile();
     $file_usage = $this->container->get('file.usage');
     $file_usage->add($file, 'testing', 'foo', 1);
@@ -75,7 +75,7 @@ function testAddUsage() {
   /**
    * Tests \Drupal\file\FileUsage\DatabaseFileUsageBackend::delete().
    */
-  function testRemoveUsage() {
+  public function testRemoveUsage() {
     $file = $this->createFile();
     $file_usage = $this->container->get('file.usage');
     db_insert('file_usage')
@@ -122,7 +122,7 @@ function testRemoveUsage() {
    * We are using UPDATE statements because using the API would set the
    * timestamp.
    */
-  function createTempFiles() {
+  private function createTempFiles() {
     // Temporary file that is old.
     $temp_old = file_save_data('');
     db_update('file_managed')
@@ -159,7 +159,7 @@ function createTempFiles() {
   /**
    * Ensure that temporary files are removed by default.
    */
-  function testTempFileCleanupDefault() {
+  public function testTempFileCleanupDefault() {
     list($temp_old, $temp_new, $perm_old, $perm_new) = $this->createTempFiles();
 
     // Run cron and then ensure that only the old, temp file was deleted.
@@ -173,7 +173,7 @@ function testTempFileCleanupDefault() {
   /**
    * Ensure that temporary files are kept as configured.
    */
-  function testTempFileNoCleanup() {
+  public function testTempFileNoCleanup() {
     list($temp_old, $temp_new, $perm_old, $perm_new) = $this->createTempFiles();
 
     // Set the max age to 0, meaning no temporary files will be deleted.
@@ -192,7 +192,7 @@ function testTempFileNoCleanup() {
   /**
    * Ensure that temporary files are kept as configured.
    */
-  function testTempFileCustomCleanup() {
+  public function testTempFileCustomCleanup() {
     list($temp_old, $temp_new, $perm_old, $perm_new) = $this->createTempFiles();
 
     // Set the max age to older than default.
diff --git a/core/modules/file/src/Tests/ValidateTest.php b/core/modules/file/src/Tests/ValidateTest.php
index 943a830..bc83dc6 100644
--- a/core/modules/file/src/Tests/ValidateTest.php
+++ b/core/modules/file/src/Tests/ValidateTest.php
@@ -16,7 +16,7 @@ class ValidateTest extends FileManagedUnitTestBase {
   /**
    * Test that the validators passed into are checked.
    */
-  function testCallerValidation() {
+  public function testCallerValidation() {
     $file = $this->createFile();
 
     // Empty validators.
@@ -35,7 +35,8 @@ function testCallerValidation() {
     file_test_reset();
     file_test_set_return('validate', array('Epic fail'));
     $failing = array('file_test_validator' => array(array('Failed', 'Badly')));
-    $this->assertEqual(file_validate($file, $failing), array('Failed', 'Badly', 'Epic fail'), 'Validating returns errors.');
+    $this->assertEqual(file_validate($file, $failing), array(
+      'Failed', 'Badly', 'Epic fail'), 'Validating returns errors.');
     $this->assertFileHooksCalled(array('validate'));
   }
 }
diff --git a/core/modules/file/src/Tests/ValidatorTest.php b/core/modules/file/src/Tests/ValidatorTest.php
index 4b00a94..21aff71 100644
--- a/core/modules/file/src/Tests/ValidatorTest.php
+++ b/core/modules/file/src/Tests/ValidatorTest.php
@@ -22,24 +22,27 @@ class ValidatorTest extends FileManagedUnitTestBase {
   /**
    * @var \Drupal\file\Entity\File
    */
-  protected $non_image;
+  protected $nonImage;
 
-  protected function setUp() {
+  /**
+   * {@inheritdoc}
+   */
+  public function setUp() {
     parent::setUp();
 
     $this->image = entity_create('file');
     $this->image->setFileUri('core/misc/druplicon.png');
     $this->image->setFilename(drupal_basename($this->image->getFileUri()));
 
-    $this->non_image = entity_create('file');
-    $this->non_image->setFileUri('core/assets/vendor/jquery/jquery.js');
-    $this->non_image->setFilename(drupal_basename($this->non_image->getFileUri()));
+    $this->nonImage = entity_create('file');
+    $this->nonImage->setFileUri('core/assets/vendor/jquery/jquery.js');
+    $this->nonImage->setFilename(drupal_basename($this->nonImage->getFileUri()));
   }
 
   /**
    * Test the file_validate_extensions() function.
    */
-  function testFileValidateExtensions() {
+  public function testFileValidateExtensions() {
     $file = entity_create('file', array('filename' => 'asdf.txt'));
     $errors = file_validate_extensions($file, 'asdf txt pork');
     $this->assertEqual(count($errors), 0, 'Valid extension accepted.', 'File');
@@ -50,27 +53,28 @@ function testFileValidateExtensions() {
   }
 
   /**
-   *  This ensures a specific file is actually an image.
+   * This ensures a specific file is actually an image.
    */
-  function testFileValidateIsImage() {
+  public function testFileValidateIsImage() {
     $this->assertTrue(file_exists($this->image->getFileUri()), 'The image being tested exists.', 'File');
     $errors = file_validate_is_image($this->image);
     $this->assertEqual(count($errors), 0, 'No error reported for our image file.', 'File');
 
-    $this->assertTrue(file_exists($this->non_image->getFileUri()), 'The non-image being tested exists.', 'File');
-    $errors = file_validate_is_image($this->non_image);
+    $this->assertTrue(file_exists($this->nonImage->getFileUri()), 'The non-image being tested exists.', 'File');
+    $errors = file_validate_is_image($this->nonImage);
     $this->assertEqual(count($errors), 1, 'An error reported for our non-image file.', 'File');
   }
 
   /**
-   *  This ensures the resolution of a specific file is within bounds.
-   *  The image will be resized if it's too large.
+   * This ensures the resolution of a specific file is within bounds.
+   *
+   * The image will be re-sized if it's too large.
    */
-  function testFileValidateImageResolution() {
+  public function testFileValidateImageResolution() {
     // Non-images.
-    $errors = file_validate_image_resolution($this->non_image);
+    $errors = file_validate_image_resolution($this->nonImage);
     $this->assertEqual(count($errors), 0, 'Should not get any errors for a non-image file.', 'File');
-    $errors = file_validate_image_resolution($this->non_image, '50x50', '100x100');
+    $errors = file_validate_image_resolution($this->nonImage, '50x50', '100x100');
     $this->assertEqual(count($errors), 0, 'Do not check the resolution on non files.', 'File');
 
     // Minimum size.
@@ -105,16 +109,16 @@ function testFileValidateImageResolution() {
       drupal_unlink('temporary://druplicon.png');
     }
     else {
-      // TODO: should check that the error is returned if no toolkit is available.
+      // TODO: check that an error is returned if no toolkit is available.
       $errors = file_validate_image_resolution($this->image, '5x10');
       $this->assertEqual(count($errors), 1, 'Oversize images that cannot be scaled get an error.', 'File');
     }
   }
 
   /**
-   *  This will ensure the filename length is valid.
+   * This will ensure the filename length is valid.
    */
-  function testFileValidateNameLength() {
+  public function testFileValidateNameLength() {
     // Create a new file entity.
     $file = entity_create('file');
 
@@ -139,7 +143,7 @@ function testFileValidateNameLength() {
   /**
    * Test file_validate_size().
    */
-  function testFileValidateSize() {
+  public function testFileValidateSize() {
     // Create a file with a size of 1000 bytes, and quotas of only 1 byte.
     $file = entity_create('file', array('filesize' => 1000));
     $errors = file_validate_size($file, 0, 0);
diff --git a/core/modules/file/tests/file_module_test/src/Form/FileModuleTestForm.php b/core/modules/file/tests/file_module_test/src/Form/FileModuleTestForm.php
index 0529090..648cbb2 100644
--- a/core/modules/file/tests/file_module_test/src/Form/FileModuleTestForm.php
+++ b/core/modules/file/tests/file_module_test/src/Form/FileModuleTestForm.php
@@ -16,6 +16,8 @@
 class FileModuleTestForm extends FormBase {
 
   /**
+   * Returns file module test form.
+   *
    * {@inheritdoc}
    */
   public function getFormId() {
@@ -35,7 +37,7 @@ public function getFormId() {
    *   (optional) If the form should use #extended. Defaults to TRUE.
    * @param bool $multiple
    *   (optional) If the form should use #multiple. Defaults to FALSE.
-   * @param array $default_fids
+   * @param string $default_fids
    *   (optional) Any default file IDs to use.
    */
   public function buildForm(array $form, FormStateInterface $form_state, $tree = TRUE, $extended = TRUE, $multiple = FALSE, $default_fids = NULL) {
diff --git a/core/modules/file/tests/file_test/file_test.module b/core/modules/file/tests/file_test/file_test.module
index b1bdeb3..41d579f 100644
--- a/core/modules/file/tests/file_test/file_test.module
+++ b/core/modules/file/tests/file_test/file_test.module
@@ -43,7 +43,7 @@ function file_test_stream_wrappers() {
  * @see file_test_reset()
  */
 function file_test_reset() {
-  // Keep track of calls to these hooks
+  // Keep track of calls to these hooks.
   $results = array(
     'load' => array(),
     'validate' => array(),
@@ -68,11 +68,11 @@ function file_test_reset() {
  * Get the arguments passed to invocation of a given hook since
  * file_test_reset() was last called.
  *
- * @param $op
+ * @param string $op
  *   One of the hook_file_* operations: 'load', 'validate', 'download',
  *   'insert', 'update', 'copy', 'move', 'delete'.
  *
- * @return
+ * @return array
  *   Array of the parameters passed to each call.
  *
  * @see _file_test_log_call()
@@ -86,7 +86,7 @@ function file_test_get_calls($op) {
 /**
  * Get an array with the calls for all hooks.
  *
- * @return
+ * @return array
  *   An array keyed by hook name ('load', 'validate', 'download', 'insert',
  *   'update', 'copy', 'move', 'delete') with values being arrays of parameters
  *   passed to each call.
@@ -98,16 +98,16 @@ function file_test_get_all_calls() {
 /**
  * Store the values passed to a hook invocation.
  *
- * @param $op
+ * @param string $op
  *   One of the hook_file_* operations: 'load', 'validate', 'download',
  *   'insert', 'update', 'copy', 'move', 'delete'.
- * @param $args
+ * @param array $args
  *   Values passed to hook.
  *
  * @see file_test_get_calls()
  * @see file_test_reset()
  */
-function _file_test_log_call($op, $args) {
+function _file_test_log_call($op, array $args) {
   if (\Drupal::state()->get('file_test.count_hook_invocations', TRUE)) {
     $results = \Drupal::state()->get('file_test.results') ?: array();
     $results[$op][] = $args;
@@ -118,10 +118,10 @@ function _file_test_log_call($op, $args) {
 /**
  * Load the appropriate return value.
  *
- * @param $op
+ * @param string $op
  *   One of the hook_file_[validate,download] operations.
  *
- * @return
+ * @return string
  *   Value set by file_test_set_return().
  *
  * @see file_test_set_return()
@@ -135,9 +135,9 @@ function _file_test_get_return($op) {
 /**
  * Assign a return value for a given operation.
  *
- * @param $op
+ * @param string $op
  *   One of the hook_file_[validate,download] operations.
- * @param $value
+ * @param string $value
  *   Value for the hook to return.
  *
  * @see _file_test_get_return()
@@ -150,7 +150,7 @@ function file_test_set_return($op, $value) {
 }
 
 /**
- * Implements hook_ENTITY_TYPE_load() for file entities.
+ * Implements hook_ENTITY_TYPE_load().
  */
 function file_test_file_load($files) {
   foreach ($files as $file) {
@@ -178,14 +178,14 @@ function file_test_file_download($uri) {
 }
 
 /**
- * Implements hook_ENTITY_TYPE_insert() for file entities.
+ * Implements hook_ENTITY_TYPE_insert().
  */
 function file_test_file_insert(File $file) {
   _file_test_log_call('insert', array($file->id()));
 }
 
 /**
- * Implements hook_ENTITY_TYPE_update() for file entities.
+ * Implements hook_ENTITY_TYPE_update().
  */
 function file_test_file_update(File $file) {
   _file_test_log_call('update', array($file->id()));
@@ -206,7 +206,7 @@ function file_test_file_move(File $file, File $source) {
 }
 
 /**
- * Implements hook_ENTITY_TYPE_predelete() for file entities.
+ * Implements hook_ENTITY_TYPE_predelete().
  */
 function file_test_file_predelete(File $file) {
   _file_test_log_call('delete', array($file->id()));
@@ -335,9 +335,10 @@ function file_test_validator(File $file, $errors) {
  * When the function is called with no $filepath parameter, the results are
  * returned.
  *
- * @param $filepath
- *   File path
- * @return
+ * @param string $filepath
+ *   File path.
+ *
+ * @return array
  *   If $filepath is NULL, an array of all previous $filepath parameters
  */
 function file_test_file_scan_callback($filepath = NULL) {
diff --git a/core/modules/file/tests/file_test/src/DummyReadOnlyStreamWrapper.php b/core/modules/file/tests/file_test/src/DummyReadOnlyStreamWrapper.php
index d230bc5..0c1690a 100644
--- a/core/modules/file/tests/file_test/src/DummyReadOnlyStreamWrapper.php
+++ b/core/modules/file/tests/file_test/src/DummyReadOnlyStreamWrapper.php
@@ -15,7 +15,7 @@
  * Dummy stream wrapper implementation (dummy-readonly://).
  */
 class DummyReadOnlyStreamWrapper extends LocalReadOnlyStream {
-  function getDirectoryPath() {
+  public function getDirectoryPath() {
     return conf_path() . '/files';
   }
 
@@ -24,7 +24,7 @@ function getDirectoryPath() {
    *
    * Return a dummy path for testing.
    */
-  function getInternalUri() {
+  public function getInternalUri() {
     return '/dummy/example.txt';
   }
 
@@ -33,7 +33,7 @@ function getInternalUri() {
    *
    * Return the HTML URI of a public file.
    */
-  function getExternalUrl() {
+  public function getExternalUrl() {
     return '/dummy/example.txt';
   }
 }
diff --git a/core/modules/file/tests/file_test/src/DummyRemoteStreamWrapper.php b/core/modules/file/tests/file_test/src/DummyRemoteStreamWrapper.php
index 2741196..ad91a3f 100644
--- a/core/modules/file/tests/file_test/src/DummyRemoteStreamWrapper.php
+++ b/core/modules/file/tests/file_test/src/DummyRemoteStreamWrapper.php
@@ -17,7 +17,7 @@
  * Basically just the public scheme but not returning a local file for realpath.
  */
 class DummyRemoteStreamWrapper extends PublicStream {
-  function realpath() {
+  public function realpath() {
     return FALSE;
   }
 }
diff --git a/core/modules/file/tests/file_test/src/DummyStreamWrapper.php b/core/modules/file/tests/file_test/src/DummyStreamWrapper.php
index cbea40f..6d6e31d 100644
--- a/core/modules/file/tests/file_test/src/DummyStreamWrapper.php
+++ b/core/modules/file/tests/file_test/src/DummyStreamWrapper.php
@@ -15,7 +15,7 @@
  * Dummy stream wrapper implementation (dummy://).
  */
 class DummyStreamWrapper extends LocalStream {
-  function getDirectoryPath() {
+  public function getDirectoryPath() {
     return conf_path() . '/files';
   }
 
@@ -24,7 +24,7 @@ function getDirectoryPath() {
    *
    * Return a dummy path for testing.
    */
-  function getInternalUri() {
+  public function getInternalUri() {
     return '/dummy/example.txt';
   }
 
@@ -33,7 +33,7 @@ function getInternalUri() {
    *
    * Return the HTML URI of a public file.
    */
-  function getExternalUrl() {
+  public function getExternalUrl() {
     return '/dummy/example.txt';
   }
 }
diff --git a/core/modules/syslog/src/Tests/SyslogTest.php b/core/modules/syslog/src/Tests/SyslogTest.php
index 6d479ac..3cb4b30 100644
--- a/core/modules/syslog/src/Tests/SyslogTest.php
+++ b/core/modules/syslog/src/Tests/SyslogTest.php
@@ -37,7 +37,8 @@ function testSettings() {
 
       $this->drupalGet('admin/config/development/logging');
       if ($this->parse()) {
-        $field = $this->xpath('//option[@value=:value]', array(':value' => LOG_LOCAL6)); // Should be one field.
+        // Should be one field.
+        $field = $this->xpath('//option[@value=:value]', array(':value' => LOG_LOCAL6));
         $this->assertTrue($field[0]['selected'] == 'selected', 'Facility value saved.');
       }
     }
