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 @@ 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/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 cd5506d..2ef87a6 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; @@ -101,7 +102,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 095eacd..8056c4a 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\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) { $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 f22563b..5a692a5 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 4e687a3..248e18f 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 d9f6914..49b5f7e 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\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('Reply'); $comment = $this->getEntity($values); diff --git a/core/modules/comment/src/Tests/CommentTestBase.php b/core/modules/comment/src/Tests/CommentTestBase.php index 5acb24a..e811f3c 100644 --- a/core/modules/comment/src/Tests/CommentTestBase.php +++ b/core/modules/comment/src/Tests/CommentTestBase.php @@ -176,10 +176,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) { @@ -273,7 +273,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. @@ -320,7 +320,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() { @@ -334,7 +334,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) { @@ -358,7 +358,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')