diff --git a/core/modules/comment/comment.api.php b/core/modules/comment/comment.api.php
index b460a71..785fd92 100644
--- a/core/modules/comment/comment.api.php
+++ b/core/modules/comment/comment.api.php
@@ -1,14 +1,14 @@
 <?php
 
-use Drupal\Core\Entity\EntityInterface;
-use Drupal\comment\CommentInterface;
-use Drupal\Core\Url;
-
 /**
  * @file
  * Hooks provided by the Comment module.
  */
 
+use Drupal\Core\Entity\EntityInterface;
+use Drupal\comment\CommentInterface;
+use Drupal\Core\Url;
+
 /**
  * @addtogroup hooks
  * @{
diff --git a/core/modules/comment/comment.module b/core/modules/comment/comment.module
index 163b13a..78c53fb 100644
--- a/core/modules/comment/comment.module
+++ b/core/modules/comment/comment.module
@@ -247,7 +247,7 @@ function comment_node_view_alter(array &$build, EntityInterface $node, EntityVie
  * @param array $comments
  *   An array of comment objects, keyed by comment ID.
  */
-function comment_prepare_thread(&$comments) {
+function comment_prepare_thread(array &$comments) {
   // A counter that helps track how indented we are.
   $divs = 0;
 
@@ -276,9 +276,9 @@ function comment_prepare_thread(&$comments) {
  *
  * @param \Drupal\comment\CommentInterface $comment
  *   The comment object.
- * @param $view_mode
+ * @param string $view_mode
  *   (optional) View mode, e.g. 'full', 'teaser'... Defaults to 'full'.
- * @param $langcode
+ * @param string|NULL $langcode
  *   (optional) A language code to use for rendering. Defaults to the global
  *   content language of the current request.
  *
@@ -292,11 +292,11 @@ function comment_view(CommentInterface $comment, $view_mode = 'full', $langcode
 /**
  * Constructs render array from an array of loaded comments.
  *
- * @param $comments
+ * @param array $comments
  *   An array of comments as returned by entity_load_multiple().
- * @param $view_mode
- *   View mode, e.g. 'full', 'teaser'...
- * @param $langcode
+ * @param string $view_mode
+ *   (optional) View mode, e.g. 'full', 'teaser', etc. Defaults to 'full'.
+ * @param string|NULL $langcode
  *   (optional) A string indicating the language field values are to be shown
  *   in. If no language is provided the current content language is used.
  *   Defaults to NULL.
@@ -306,7 +306,7 @@ function comment_view(CommentInterface $comment, $view_mode = 'full', $langcode
  *
  * @see drupal_render()
  */
-function comment_view_multiple($comments, $view_mode = 'full', $langcode = NULL) {
+function comment_view_multiple(array $comments, $view_mode = 'full', $langcode = NULL) {
   return entity_view_multiple($comments, $view_mode, $langcode);
 }
 
@@ -684,7 +684,7 @@ function comment_prepare_author(CommentInterface $comment) {
  *   - elements: An associative array containing the comment and entity objects.
  *     Array keys: #comment, #commented_entity.
  */
-function template_preprocess_comment(&$variables) {
+function template_preprocess_comment(array &$variables) {
   /** @var \Drupal\comment\CommentInterface $comment */
   $comment = $variables['elements']['#comment'];
   $commented_entity = $comment->getCommentedEntity();
@@ -807,7 +807,7 @@ function template_preprocess_comment(&$variables) {
  * @todo Rename to template_preprocess_field__comment() once
  *   https://www.drupal.org/node/939462 is resolved.
  */
-function comment_preprocess_field(&$variables) {
+function comment_preprocess_field(array &$variables) {
   $element = $variables['element'];
   if ($element['#field_type'] == 'comment') {
     // Provide contextual information.
diff --git a/core/modules/comment/src/CommentForm.php b/core/modules/comment/src/CommentForm.php
index a9d742b..2e5405a 100644
--- a/core/modules/comment/src/CommentForm.php
+++ b/core/modules/comment/src/CommentForm.php
@@ -305,9 +305,9 @@ public function validate(array $form, FormStateInterface $form_state) {
   /**
    * Form submission handler for the 'preview' action.
    *
-   * @param $form
+   * @param array $form
    *   An associative array containing the structure of the form.
-   * @param $form_state
+   * @param Drupal\Core\Form\FormStateInterface $form_state
    *   The current state of the form.
    */
   public function preview(array &$form, FormStateInterface $form_state) {
diff --git a/core/modules/comment/src/CommentStatistics.php b/core/modules/comment/src/CommentStatistics.php
index f77a2c1..1e13be7 100644
--- a/core/modules/comment/src/CommentStatistics.php
+++ b/core/modules/comment/src/CommentStatistics.php
@@ -68,7 +68,7 @@ public function __construct(Connection $database, AccountInterface $current_user
   /**
    * {@inheritdoc}
    */
-  public function read($entities, $entity_type, $accurate = TRUE) {
+  public function read(array $entities, $entity_type, $accurate = TRUE) {
     $options = $accurate ? array() : array('target' => 'replica');
     $stats =  $this->database->select('comment_entity_statistics', 'ces', $options)
       ->fields('ces')
@@ -96,7 +96,7 @@ public function delete(EntityInterface $entity) {
   /**
    * {@inheritdoc}
    */
-  public function create(FieldableEntityInterface $entity, $fields) {
+  public function create(FieldableEntityInterface $entity, array $fields) {
     $query = $this->database->insert('comment_entity_statistics')
       ->fields(array(
         'entity_id',
diff --git a/core/modules/comment/src/CommentStatisticsInterface.php b/core/modules/comment/src/CommentStatisticsInterface.php
index f73dccd..e5df9ec 100644
--- a/core/modules/comment/src/CommentStatisticsInterface.php
+++ b/core/modules/comment/src/CommentStatisticsInterface.php
@@ -32,14 +32,14 @@ public function getRankingInfo();
    *   Array of entities on which commenting is enabled, keyed by id
    * @param string $entity_type
    *   The entity type of the passed entities.
-   * @param boolean $accurate
+   * @param bool $accurate
    *   (optional) Indicates if results must be completely up to date. If set to
    *   FALSE, a replica database will used if available. Defaults to TRUE.
    *
    * @return object[]
    *   Array of statistics records.
    */
-  public function read($entities, $entity_type, $accurate = TRUE);
+  public function read(array $entities, $entity_type, $accurate = TRUE);
 
   /**
    * Delete comment statistics records for an entity.
@@ -80,6 +80,6 @@ public function getMaximumCount($entity_type);
    * @param array $fields
    *   Array of comment field definitions for the given entity.
    */
-  public function create(FieldableEntityInterface $entity, $fields);
+  public function create(FieldableEntityInterface $entity, array $fields);
 
 }
diff --git a/core/modules/comment/src/Plugin/views/field/Link.php b/core/modules/comment/src/Plugin/views/field/Link.php
index 70c5c0e..43b7960 100644
--- a/core/modules/comment/src/Plugin/views/field/Link.php
+++ b/core/modules/comment/src/Plugin/views/field/Link.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\comment\Plugin\views\field;
 
+use Drupal\Core\Entity\EntityInterface;
 use Drupal\Core\Entity\EntityManagerInterface;
 use Drupal\Core\Form\FormStateInterface;
 use Drupal\views\Plugin\views\field\FieldPluginBase;
@@ -111,7 +112,7 @@ public function render(ResultRow $values) {
    * @return string
    *   Returns a string for the link text.
    */
-  protected function renderLink($data, ResultRow $values) {
+  protected function renderLink(EntityInterface $data, ResultRow $values) {
     $text = !empty($this->options['text']) ? $this->options['text'] : $this->t('View');
     /** @var \Drupal\comment\CommentInterface $comment */
     $comment = $data;
diff --git a/core/modules/comment/src/Plugin/views/field/LinkApprove.php b/core/modules/comment/src/Plugin/views/field/LinkApprove.php
index b249a74..be8cf5e 100644
--- a/core/modules/comment/src/Plugin/views/field/LinkApprove.php
+++ b/core/modules/comment/src/Plugin/views/field/LinkApprove.php
@@ -8,6 +8,7 @@
 namespace Drupal\comment\Plugin\views\field;
 
 use Drupal\comment\CommentInterface;
+use Drupal\Core\Entity\EntityInterface;
 use Drupal\Core\Session\AccountInterface;
 use Drupal\Core\Url;
 use Drupal\views\ResultRow;
@@ -40,7 +41,7 @@ public function access(AccountInterface $account) {
    * @return string
    *   Returns a string for the link text.
    */
-  protected function renderLink($data, ResultRow $values) {
+  protected function renderLink(EntityInterface $data, ResultRow $values) {
     $status = $this->getValue($values, 'status');
 
     // Don't show an approve link on published comment.
diff --git a/core/modules/comment/src/Plugin/views/field/LinkDelete.php b/core/modules/comment/src/Plugin/views/field/LinkDelete.php
index b36c223..02c1be1 100644
--- a/core/modules/comment/src/Plugin/views/field/LinkDelete.php
+++ b/core/modules/comment/src/Plugin/views/field/LinkDelete.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\comment\Plugin\views\field;
 
+use Drupal\Core\Entity\EntityInterface;
 use Drupal\Core\Session\AccountInterface;
 use Drupal\views\ResultRow;
 
@@ -38,7 +39,7 @@ public function access(AccountInterface $account) {
    * @return string
    *   Returns a string for the link text.
    */
-  protected function renderLink($data, ResultRow $values) {
+  protected function renderLink(EntityInterface $data, ResultRow $values) {
     $text = !empty($this->options['text']) ? $this->options['text'] : $this->t('Delete');
     $comment = $this->getEntity($values);
 
diff --git a/core/modules/comment/src/Plugin/views/field/LinkEdit.php b/core/modules/comment/src/Plugin/views/field/LinkEdit.php
index 316c272..a49550b 100644
--- a/core/modules/comment/src/Plugin/views/field/LinkEdit.php
+++ b/core/modules/comment/src/Plugin/views/field/LinkEdit.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\comment\Plugin\views\field;
 
+use Drupal\Core\Entity\EntityInterface;
 use Drupal\Core\Form\FormStateInterface;
 use Drupal\views\ResultRow;
 
@@ -19,6 +20,9 @@
  */
 class LinkEdit extends Link {
 
+  /**
+   * {@inheritdoc}
+   */
   protected function defineOptions() {
     $options = parent::defineOptions();
     $options['destination'] = array('default' => FALSE);
@@ -26,6 +30,9 @@ protected function defineOptions() {
     return $options;
   }
 
+  /**
+   * {@inheritdoc}
+   */
   public function buildOptionsForm(&$form, FormStateInterface $form_state) {
     parent::buildOptionsForm($form, $form_state);
 
@@ -48,7 +55,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) {
    * @return string
    *   Returns a string for the link text.
    */
-  protected function renderLink($data, ResultRow $values) {
+  protected function renderLink(EntityInterface $data, ResultRow $values) {
     parent::renderLink($data, $values);
     // Ensure user has access to edit this comment.
     $comment = $this->getValue($values);
diff --git a/core/modules/comment/src/Plugin/views/field/LinkReply.php b/core/modules/comment/src/Plugin/views/field/LinkReply.php
index 65c7545..d65fdb0 100644
--- a/core/modules/comment/src/Plugin/views/field/LinkReply.php
+++ b/core/modules/comment/src/Plugin/views/field/LinkReply.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\comment\Plugin\views\field;
 
+use Drupal\Core\Entity\EntityInterface;
 use Drupal\Core\Session\AccountInterface;
 use Drupal\Core\Url;
 use Drupal\views\ResultRow;
@@ -39,7 +40,7 @@ public function access(AccountInterface $account) {
    * @return string
    *   Returns a string for the link text.
    */
-  protected function renderLink($data, ResultRow $values) {
+  protected function renderLink(EntityInterface $data, ResultRow $values) {
     $text = !empty($this->options['text']) ? $this->options['text'] : $this->t('Reply');
     $comment = $this->getEntity($values);
 
diff --git a/core/modules/comment/src/Tests/CommentNonNodeTest.php b/core/modules/comment/src/Tests/CommentNonNodeTest.php
index b4fabee..83ae605 100644
--- a/core/modules/comment/src/Tests/CommentNonNodeTest.php
+++ b/core/modules/comment/src/Tests/CommentNonNodeTest.php
@@ -98,13 +98,14 @@ protected function setUp() {
    *
    * @param \Drupal\Core\Entity\EntityInterface|null $entity
    *   Entity to post comment on or NULL to post to the previously loaded page.
-   * @param $comment
+   * @param string $comment
    *   Comment body.
-   * @param $subject
-   *   Comment subject.
-   * @param $contact
-   *   Set to NULL for no contact info, TRUE to ignore success checking, and
-   *   array of values to set contact info.
+   * @param string $subject
+   *   (optional) Comment subject.
+   * @param array|bool|NULL $contact
+   *   (optional) Set to NULL for no contact info, TRUE to ignore success
+   *   checking, or an array of values to set contact info.
+   * @return EntityInterface|null
    */
   function postComment(EntityInterface $entity, $comment, $subject = '', $contact = NULL) {
     $edit = array();
@@ -172,10 +173,10 @@ function postComment(EntityInterface $entity, $comment, $subject = '', $contact
    *
    * @param \Drupal\comment\CommentInterface $comment
    *   The comment object.
-   * @param boolean $reply
+   * @param bool $reply
    *   Boolean indicating whether the comment is a reply to another comment.
    *
-   * @return boolean
+   * @return bool
    *   Boolean indicating whether the comment was found.
    */
   function commentExists(CommentInterface $comment = NULL, $reply = FALSE) {
@@ -196,7 +197,7 @@ function commentExists(CommentInterface $comment = NULL, $reply = FALSE) {
   /**
    * Checks whether the commenter's contact information is displayed.
    *
-   * @return boolean
+   * @return bool
    *   Contact info is available.
    */
   function commentContactInfoAvailable() {
@@ -210,7 +211,7 @@ function commentContactInfoAvailable() {
    *   Comment to perform operation on.
    * @param string $operation
    *   Operation to perform.
-   * @param boolean $aproval
+   * @param bool $approval
    *   Operation is found on approval page.
    */
   function performCommentOperation($comment, $operation, $approval = FALSE) {
@@ -234,7 +235,7 @@ function performCommentOperation($comment, $operation, $approval = FALSE) {
    * @param string $subject
    *   Comment subject to find.
    *
-   * @return integer
+   * @return int
    *   Comment ID.
    */
   function getUnapprovedComment($subject) {
diff --git a/core/modules/comment/src/Tests/CommentPagerTest.php b/core/modules/comment/src/Tests/CommentPagerTest.php
index 2b30502..9b2990c 100644
--- a/core/modules/comment/src/Tests/CommentPagerTest.php
+++ b/core/modules/comment/src/Tests/CommentPagerTest.php
@@ -167,10 +167,11 @@ function testCommentOrderingThreading() {
   /**
    * Asserts that the comments are displayed in the correct order.
    *
-   * @param $comments
-   *   And array of comments.
-   * @param $expected_order
+   * @param array $comments
+   *   An array of comments.
+   * @param array $expected_order
    *   An array of keys from $comments describing the expected order.
+   * @return bool
    */
   function assertCommentOrder(array $comments, array $expected_order) {
     $expected_cids = array();
diff --git a/core/modules/comment/src/Tests/CommentTestBase.php b/core/modules/comment/src/Tests/CommentTestBase.php
index dbb6d56..c1ae858 100644
--- a/core/modules/comment/src/Tests/CommentTestBase.php
+++ b/core/modules/comment/src/Tests/CommentTestBase.php
@@ -178,10 +178,10 @@ public function postComment($entity, $comment, $subject = '', $contact = NULL, $
    *
    * @param \Drupal\comment\CommentInterface $comment
    *   The comment object.
-   * @param boolean $reply
+   * @param bool $reply
    *   Boolean indicating whether the comment is a reply to another comment.
    *
-   * @return boolean
+   * @return bool
    *   Boolean indicating whether the comment was found.
    */
   function commentExists(CommentInterface $comment = NULL, $reply = FALSE) {
@@ -275,7 +275,7 @@ public function setCommentForm($enabled, $field_name = 'comment') {
   /**
    * Sets the value governing restrictions on anonymous comments.
    *
-   * @param integer $level
+   * @param int $level
    *   The level of the contact information allowed for anonymous comments:
    *   - 0: No contact information allowed.
    *   - 1: Contact information allowed but not required.
@@ -322,7 +322,7 @@ public function setCommentSettings($name, $value, $message, $field_name = 'comme
   /**
    * Checks whether the commenter's contact information is displayed.
    *
-   * @return boolean
+   * @return bool
    *   Contact info is available.
    */
   function commentContactInfoAvailable() {
@@ -336,7 +336,7 @@ function commentContactInfoAvailable() {
    *   Comment to perform operation on.
    * @param string $operation
    *   Operation to perform.
-   * @param boolean $aproval
+   * @param bool $approval
    *   Operation is found on approval page.
    */
   function performCommentOperation(CommentInterface $comment, $operation, $approval = FALSE) {
@@ -360,7 +360,7 @@ function performCommentOperation(CommentInterface $comment, $operation, $approva
    * @param string $subject
    *   Comment subject to find.
    *
-   * @return integer
+   * @return int
    *   Comment id.
    */
   function getUnapprovedComment($subject) {
diff --git a/core/modules/comment/src/Tests/CommentThreadingTest.php b/core/modules/comment/src/Tests/CommentThreadingTest.php
index ab0d9b9..5fd8f3c 100644
--- a/core/modules/comment/src/Tests/CommentThreadingTest.php
+++ b/core/modules/comment/src/Tests/CommentThreadingTest.php
@@ -127,7 +127,7 @@ function testCommentThreading() {
   /**
    * Asserts that the link to the specified parent comment is present.
    *
-   * @parm int $cid
+   * @param int $cid
    *   The comment ID to check.
    * @param int $pid
    *   The expected parent comment ID.
diff --git a/core/modules/comment/src/Tests/Views/CommentFieldFilterTest.php b/core/modules/comment/src/Tests/Views/CommentFieldFilterTest.php
index 4fd7d58..ba34ebb 100644
--- a/core/modules/comment/src/Tests/Views/CommentFieldFilterTest.php
+++ b/core/modules/comment/src/Tests/Views/CommentFieldFilterTest.php
@@ -108,7 +108,7 @@ public function testFilters() {
    * @param string $message
    *   Message suffix to display.
    */
-  protected function assertPageCounts($path, $counts, $message) {
+  protected function assertPageCounts($path, array $counts, $message) {
     // Get the text of the page.
     $this->drupalGet($path);
     $text = $this->getTextContent();
diff --git a/core/modules/comment/tests/src/Unit/CommentLinkBuilderTest.php b/core/modules/comment/tests/src/Unit/CommentLinkBuilderTest.php
index 202f6a4..3770084 100644
--- a/core/modules/comment/tests/src/Unit/CommentLinkBuilderTest.php
+++ b/core/modules/comment/tests/src/Unit/CommentLinkBuilderTest.php
@@ -106,7 +106,7 @@ protected function setUp() {
    *
    * @covers ::buildCommentedEntityLinks
    */
-  public function testCommentLinkBuilder(NodeInterface $node, $context, $has_access_comments, $history_exists, $has_post_comments, $is_anonymous, $expected) {
+  public function testCommentLinkBuilder(NodeInterface $node, array $context, $has_access_comments, $history_exists, $has_post_comments, $is_anonymous, array $expected) {
     $this->moduleHandler->expects($this->any())
       ->method('moduleExists')
       ->with('history')
