diff --git a/includes/fivestar.theme.inc b/includes/fivestar.theme.inc
index e1cbda6..0cdf562 100644
--- a/includes/fivestar.theme.inc
+++ b/includes/fivestar.theme.inc
@@ -5,11 +5,13 @@
  * Provides the theming functions for fivestar.
  */
 
-use Drupal\Core\Render\Element;
-use Drupal\Core\Render\Element\RenderElement;
-
 /**
+ * Provides a preview of a Five Star widget.
+ *
+ * @return string
+ *   The rendered HTML output for the preview.
  *
+ * @ingroup theme_functions
  */
 function theme_fivestar_preview($variables) {
   extract($variables, EXTR_SKIP);
diff --git a/src/Plugin/Field/FieldFormatter/PercentageFormatter.php b/src/Plugin/Field/FieldFormatter/PercentageFormatter.php
index 191b1cc..8d89f72 100644
--- a/src/Plugin/Field/FieldFormatter/PercentageFormatter.php
+++ b/src/Plugin/Field/FieldFormatter/PercentageFormatter.php
@@ -33,7 +33,7 @@ class PercentageFormatter extends FivestarFormatterBase {
     $elements = [];
     if (!$items->isEmpty()) {
       /** @var \Drupal\fivestar\Plugin\Field\FieldType\FivestarItem $item */
-      foreach ($items as $delta => $item) {
+      foreach ($items as $item) {
         $value = $item->getValue();
         $rating[] = $value['rating'];
         $users[] = $value['target'];
diff --git a/src/Plugin/Field/FieldFormatter/RatingFormatter.php b/src/Plugin/Field/FieldFormatter/RatingFormatter.php
index 869fd83..b54d34a 100644
--- a/src/Plugin/Field/FieldFormatter/RatingFormatter.php
+++ b/src/Plugin/Field/FieldFormatter/RatingFormatter.php
@@ -33,7 +33,7 @@ class RatingFormatter extends FivestarFormatterBase {
     $elements = [];
     if (!$items->isEmpty()) {
       /** @var \Drupal\fivestar\Plugin\Field\FieldType\FivestarItem $item */
-      foreach ($items as $delta => $item) {
+      foreach ($items as $item) {
         $value = $item->getValue();
         $rating[] = $value['rating'];
         $users[] = $value['target'];
diff --git a/src/Plugin/Field/FieldType/FivestarItem.php b/src/Plugin/Field/FieldType/FivestarItem.php
index 4245d4f..e155b00 100644
--- a/src/Plugin/Field/FieldType/FivestarItem.php
+++ b/src/Plugin/Field/FieldType/FivestarItem.php
@@ -144,8 +144,8 @@ class FivestarItem extends FieldItemBase {
       '#default_value' => $this->getSetting('rated_while'),
       '#title' => $this->t('Select when user can rate the field'),
       '#options' => [
-        'viewing' => 'Rated while viewing',
-        'editing' => 'Rated while editing',
+        'viewing' => $this->t('Rated while viewing'),
+        'editing' => $this->t('Rated while editing'),
       ],
     ];
     $element['enable_voting_target'] = [
@@ -288,9 +288,12 @@ class FivestarItem extends FieldItemBase {
    * Get target entity.
    *
    * @param \Drupal\Core\Entity\FieldableEntityInterface $entity
+   *   The entity.
    * @param array $field_settings
+   *   The field setting.
    *
    * @return \Drupal\Core\Entity\FieldableEntityInterface|null
+   *   The null value.
    */
   public function getTargetEntity(FieldableEntityInterface $entity, array $field_settings) {
     if ($field_settings['enable_voting_target'] !== TRUE) {
@@ -366,7 +369,7 @@ class FivestarItem extends FieldItemBase {
           return $entity->getOwner();
         }
 
-      // Fall through.
+        // Fall through.
       case 'viewing':
       default:
         return \Drupal::currentUser();
diff --git a/src/VoteManager.php b/src/VoteManager.php
index 95c839f..b8434dc 100644
--- a/src/VoteManager.php
+++ b/src/VoteManager.php
@@ -68,11 +68,16 @@ class VoteManager {
    * Add vote.
    *
    * @param \Drupal\Core\Entity\FieldableEntityInterface $entity
+   *   The entity value.
    * @param int $rating
+   *   Rate the user.
    * @param string $vote_type
+   *   Voting type.
    * @param int|null $uid
+   *   User id.
    *
    * @return \Drupal\votingapi\Entity\Vote
+   *   Return the value vote.
    */
   public function addVote(FieldableEntityInterface $entity, $rating, $vote_type = 'vote', $uid = NULL) {
     $uid = is_numeric($uid) ? $uid : $this->currentUser->id();
diff --git a/src/VoteResultManager.php b/src/VoteResultManager.php
index 50bffad..3548571 100644
--- a/src/VoteResultManager.php
+++ b/src/VoteResultManager.php
@@ -31,9 +31,12 @@ class VoteResultManager {
    * Get votes for passed entity based on vote type.
    *
    * @param \Drupal\Core\Entity\FieldableEntityInterface $entity
+   *   Entity value.
    * @param string $vote_type
+   *   Voting type.
    *
    * @return array
+   *   Returning the array value.
    */
   public function getResultsByVoteType(FieldableEntityInterface $entity, $vote_type) {
     $results = $this->getResults($entity);
@@ -48,8 +51,10 @@ class VoteResultManager {
    * Get all votes results for passed entity.
    *
    * @param \Drupal\Core\Entity\FieldableEntityInterface $entity
+   *   Entity value.
    *
    * @return array
+   *   Return array value.
    */
   public function getResults(FieldableEntityInterface $entity) {
     $results = $this->voteResultManager->getResults(
@@ -83,6 +88,7 @@ class VoteResultManager {
    * Recalculate votes results.
    *
    * @param \Drupal\Core\Entity\FieldableEntityInterface $entity
+   *   Entity value.
    */
   public function recalculateResults(FieldableEntityInterface $entity) {
     $this->voteResultManager->recalculateResults(
diff --git a/test/fivestar.base.test b/test/fivestar.base.test
index 95cee23..ab4dc67 100644
--- a/test/fivestar.base.test
+++ b/test/fivestar.base.test
@@ -6,39 +6,63 @@
  */
 
 /**
- *
+ * Provides a base test case for Fivestar module.
  */
 class FivestarBaseTestCase extends AJAXTestCase {
   // Using testing profile.
   /**
+   * Refer.
+   *
    * @see http://groups.drupal.org/node/217189
+   * Reference.
+   */
+
+  /**
+   * FivestarBaseTestCase.
+   *
+   * @var string
    */
   protected $profile = 'testing';
 
   /**
    * Set up our basic users.
    */
-  protected $admin_user;
+  /**
+   * FivestarBaseTestCase.
+   *
+   * @var string
+   */
+  protected $adminUser;
+  /**
+   * FivestarBaseTestCase.
+   *
+   * @var string
+   */
   protected $voter;
 
   /**
-   *
+   * {@inheritdoc}
    */
   public function setUp() {
     parent::setUp(['fivestar', 'dblog']);
 
-    $type = $this->drupalCreateContentType(['type' => 'test_node_type', 'name' => 'test_node_type']);
-    $this->admin_user = $this->drupalCreateUser(['create test_node_type content', 'rate content']);
+    $this->drupalCreateContentType([
+      'type' => 'test_node_type',
+      'name' => 'test_node_type',
+    ]);
+    $this->adminUser = $this->drupalCreateUser(['create test_node_type content',
+      'rate content',
+    ]);
     $this->voter_user = $this->drupalCreateUser(['rate content']);
   }
 
   /**
    * Add a fivestar field to a content type.
    *
-   * @param $options
+   * @param array $options
    *   An associative array of options for the field and instance.
    */
-  public function createFivestarField($options = []) {
+  public function createFivestarField(array $options) {
     $options = $options + [
       'content_type' => 'test_node_type',
       'widget_type' => 'stars',
diff --git a/test/fivestar.field.test b/test/fivestar.field.test
index 547b107..d1bba21 100644
--- a/test/fivestar.field.test
+++ b/test/fivestar.field.test
@@ -5,13 +5,17 @@
  * Simpletests for the Fivestar module.
  */
 
+use Drupal\Core\StringTranslation\StringTranslationTrait;
+
 /**
- *
+ * Provides a base test case for Fivestar module.
  */
 class FivestarTestCase extends FivestarBaseTestCase {
 
+  use StringTranslationTrait;
+
   /**
-   *
+   * {@inheritdoc}
    */
   public static function getInfo() {
     return [
@@ -35,8 +39,8 @@ class FivestarTestCase extends FivestarBaseTestCase {
     $edit = [
       'vote' => '60',
     ];
-    $this->drupalPost('node/' . $node->nid, $edit, t('Rate'));
-    $this->assertNoRaw(t('No votes yet'), 'Visitors can rate content using the exposed widget.');
+    $this->drupalPost('node/' . $node->nid, $edit, $this->t('Rate'));
+    $this->assertNoRaw($this->t('No votes yet'), 'Visitors can rate content using the exposed widget.');
 
     // Load the instance settings so we can change certain settings.
     $instance = field_read_instance('node', 'fivestar_test', 'test_node_type');
@@ -51,13 +55,14 @@ class FivestarTestCase extends FivestarBaseTestCase {
 
     // Lets test to make sure the cancel option is not available if disabled.
     // @see http://drupal.org/node/1269276
-    $this->assertNoRaw(t('Cancel rating'), 'User cannot cancel his vote.');
+    $this->assertNoRaw($this->t('Cancel rating'), 'User cannot cancel his vote.');
     $instance['settings']['allow_clear'] = 1;
     field_update_instance($instance);
     $this->drupalGet('node/' . $node->nid);
-    $this->assertRaw(t('Cancel rating'), 'User can cancel his vote.');
+    $this->assertRaw($this->t('Cancel rating'), 'User can cancel his vote.');
 
-    // Now lets change the field to have exposed off and make sure the value is still there.
+    // Now lets change the field to have exposed off.
+    // And make sure the value is still there.
     // @see http://drupal.org/node/1242082
     $instance['display']['default']['settings']['expose'] = FALSE;
     field_update_instance($instance);
@@ -85,14 +90,13 @@ class FivestarTestCase extends FivestarBaseTestCase {
       NULL, [], [], "fivestar-custom-widget");
     $expected = [
       'command' => 'fivestarUpdate',
-      // TODO: we should text the data being returned.
+      // @todo we should text the data being returned.
     ];
     $this->assertCommand($commands, $expected, "The fivestarUpdate AJAX command was returned.");
   }
 
   /**
-   * Test that we can switch the fivestar widgets around for the exposed
-   * widget type.
+   * Test that we can switch fivestar widgets around for exposed widget type.
    */
   public function testExposedWidgetDisplay() {
     // Lets add an exposed widget but display the static widget.
@@ -125,7 +129,7 @@ class FivestarTestCase extends FivestarBaseTestCase {
       $widget_class = 'fivestar-' . drupal_strtolower($name);
       $this->drupalGet('node/' . $node->nid);
       $result = $this->xpath("//div[contains(@class, '" . $widget_class . "')]//div[contains(@class,'star-first')]/span");
-      $this->assertEqual($result[0][0], '0', t('The @name fivestar widget is properly display.', ['@name' => $name]));
+      $this->assertEqual($result[0][0], '0', $this->t('The @name fivestar widget is properly display.', ['@name' => $name]));
     }
   }
 
