diff --git a/README.txt b/README.txt
index 6e9c5c7..7985859 100644
--- a/README.txt
+++ b/README.txt
@@ -188,4 +188,4 @@ Support
 If you experience a problem with fivestar or have a problem, file a
 request or issue on the fivestar queue at
 http://drupal.org/project/issues/fivestar. DO NOT POST IN THE FORUMS. Posting in
-the issue queues is a direct line of communication with the module authors.
\ No newline at end of file
+the issue queues is a direct line of communication with the module authors.
diff --git a/assets/css/fivestar-admin.css b/assets/css/fivestar-admin.css
index dc41652..e57bc0a 100644
--- a/assets/css/fivestar-admin.css
+++ b/assets/css/fivestar-admin.css
@@ -29,7 +29,8 @@ div.fivestar-widgets div.form-item {
   float: left; /* RTL */
   width: 12em;
 }
-.color-form .form-text, .color-form .form-select {
+.color-form .form-text,
+.color-form .form-select {
   float: left; /* RTL */
 }
 .color-form .form-text {
diff --git a/assets/css/fivestar-rtl.css b/assets/css/fivestar-rtl.css
index 623d513..e42c10b 100644
--- a/assets/css/fivestar-rtl.css
+++ b/assets/css/fivestar-rtl.css
@@ -47,6 +47,7 @@ div.fivestar-widget .cancel a {
 div.fivestar-widget div.on a {
   background-position: right -16px;
 }
-div.fivestar-widget div.hover a, div.rating div a:hover {
+div.fivestar-widget div.hover a,
+div.rating div a:hover {
   background-position: right -32px;
 }
diff --git a/assets/css/fivestar.css b/assets/css/fivestar.css
index cc1f4f6..2ef5b9d 100644
--- a/assets/css/fivestar.css
+++ b/assets/css/fivestar.css
@@ -66,24 +66,28 @@ div.fivestar-widget {
   display: block;
 }
 
-div.fivestar-widget .cancel, div.fivestar-widget .star {
+div.fivestar-widget .cancel,
+div.fivestar-widget .star {
   float: left; /* RTL */
   width: 17px;
   height: 15px;
   overflow: hidden;
   text-indent: -999em;
 }
-div.fivestar-widget .cancel, div.fivestar-widget .cancel a {
+div.fivestar-widget .cancel,
+div.fivestar-widget .cancel a {
   background: url(../../widgets/default/delete.gif) no-repeat 0 -16px; /* RTL */
   text-decoration: none;
 }
 
-div.fivestar-widget .star, div.fivestar-widget .star a {
+div.fivestar-widget .star,
+div.fivestar-widget .star a {
   background: url(../../widgets/default/star.gif) no-repeat 0 0; /* RTL */
   text-decoration: none;
 }
 
-div.fivestar-widget .cancel a, div.fivestar-widget .star a {
+div.fivestar-widget .cancel a,
+div.fivestar-widget .star a {
   display: block;
   width: 100%;
   height: 100%;
@@ -94,7 +98,8 @@ div.fivestar-widget .cancel a, div.fivestar-widget .star a {
 div.fivestar-widget div.on a {
   background-position: 0 -16px; /* RTL */
 }
-div.fivestar-widget div.hover a, div.rating div a:hover {
+div.fivestar-widget div.hover a,
+div.rating div a:hover {
   background-position: 0 -32px; /* RTL */
 }
 form.fivestar-widget div.description {
diff --git a/fivestar.api.php b/fivestar.api.php
index d5334ac..f23243e 100644
--- a/fivestar.api.php
+++ b/fivestar.api.php
@@ -5,7 +5,6 @@
  * Provides API documentation for the fivestar module.
  */
 
-
 /**
  * Implementation of hook_fivestar_widgets().
  *
@@ -21,10 +20,10 @@
  */
 function hook_fivestar_widgets() {
   // Letting fivestar know about my Cool and Awesome Stars.
-  $widgets = array(
+  $widgets = [
     'path/to/my/awesome/fivestar/css.css' => 'Awesome Stars',
     'path/to/my/cool/fivestar/css.css' => 'Cool Stars',
-  );
+  ];
 
   return $widgets;
 }
@@ -84,15 +83,15 @@ function hook_fivestar_target_info($field, $instance) {
   $entity_type = $instance['entity_type'];
   $bundle = $instance['bundle'];
 
-  $options = array(
+  $options = [
     // Declase a new Target Type.
     // This will allow users to vote on a Node and have the vote cast against the
     // node's author instead of the actual node.
-    'example_node_author' => array(
+    'example_node_author' => [
       'title' => t('Node Author'),
-      'callback' => '_example_target_node_author'
-    ),
-  );
+      'callback' => '_example_target_node_author',
+    ],
+  ];
 
   return $options;
 }
@@ -123,10 +122,10 @@ function hook_fivestar_target_info($field, $instance) {
  * @see hook_fivestar_target_info()
  */
 function _example_target_node_author($entity, $field, $instance, $langcode) {
-  $target = array(
+  $target = [
     'entity_id' => 2,
     'entity_type' => 'user',
-  );
+  ];
 
   return $target;
 }
diff --git a/fivestar.module b/fivestar.module
index 4dd10e3..a495df4 100644
--- a/fivestar.module
+++ b/fivestar.module
@@ -9,16 +9,12 @@ include_once dirname(__FILE__) . '/includes/fivestar.field.inc';
 
 use Drupal\Component\Utility\Unicode;
 use Drupal\Core\Routing\RouteMatchInterface;
-use Drupal\Core\Url;
-use Drupal\Core\Field\BaseFieldDefinition;
-
-
 /**
  * Implementation of hook_help().
  */
 function fivestar_help($route_name, RouteMatchInterface $route_match) {
   switch ($route_name) {
-      case 'help.page.fivestar':
+    case 'help.page.fivestar':
       $output = '<h3>' . t('About') . '</h3>';
       $output .= '<p>' . t('The Fivestar voting module is a very simple rating module that provides the possibility to rate items with stars or similar items. This gives you the possibilities to rate various items or even to create online forms for evaluations and assessments with different questions to be answered. For more information, see the <a href=":online">online documentation for the Fivestar module</a>.', [':online' => 'https://www.drupal.org/documentation/modules/fivestar']) . '</p>';
       $output .= '<h3>' . t('Uses') . '</h3>';
@@ -36,20 +32,20 @@ function fivestar_help($route_name, RouteMatchInterface $route_match) {
  * Implements hook_microdata_suggestions().
  */
 function fivestar_microdata_suggestions() {
-  $mappings = array();
+  $mappings = [];
 
-  // Add the review mapping for Schema.org
-  $mappings['fields']['fivestar']['schema.org'] = array(
-    '#itemprop' => array('aggregateRating'),
+  // Add the review mapping for Schema.org.
+  $mappings['fields']['fivestar']['schema.org'] = [
+    '#itemprop' => ['aggregateRating'],
     '#is_item' => TRUE,
-    '#itemtype' => array('http://schema.org/AggregateRating'),
-    'average_rating' => array(
-      '#itemprop' => array('ratingValue'),
-    ),
-    'rating_count' => array(
-      '#itemprop' => array('ratingCount'),
-    ),
-  );
+    '#itemtype' => ['http://schema.org/AggregateRating'],
+    'average_rating' => [
+      '#itemprop' => ['ratingValue'],
+    ],
+    'rating_count' => [
+      '#itemprop' => ['ratingCount'],
+    ],
+  ];
 
   return $mappings;
 }
@@ -58,84 +54,87 @@ function fivestar_microdata_suggestions() {
  * Implementation of hook_theme().
  */
 function fivestar_theme() {
-  return array(
+  return [
     // Fivestar theme functions.
-    'fivestar' => array(
+    'fivestar' => [
       'function' => 'theme_fivestar',
       'render element' => 'element',
       'file' => 'includes/fivestar.theme.inc',
-    ),
-    'fivestar_select' => array(
+    ],
+    'fivestar_select' => [
       'function' => 'theme_fivestar_select',
       'render element' => 'element',
       'file' => 'includes/fivestar.theme.inc',
-    ),
-    'fivestar_static' => array(
+    ],
+    'fivestar_static' => [
       'function' => 'theme_fivestar_static',
-      'variables' => array('rating' => NULL, 'stars' => 5, 'tag' => 'vote', 'widget' => array('name' => 'default', 'css' => '')),
+      'variables' => ['rating' => NULL, 'stars' => 5, 'tag' => 'vote', 'widget' => ['name' => 'default', 'css' => '']],
       'file' => 'includes/fivestar.theme.inc',
-    ),
-    'fivestar_static_element' => array(
+    ],
+    'fivestar_static_element' => [
       'function' => 'theme_fivestar_static_element',
-      'variables' => array('star_display' => NULL, 'title' => NULL, 'description' => NULL),
+      'variables' => ['star_display' => NULL, 'title' => NULL, 'description' => NULL],
       'file' => 'includes/fivestar.theme.inc',
-    ),
-    'fivestar_summary' => array(
+    ],
+    'fivestar_summary' => [
       'function' => 'theme_fivestar_summary',
-      'variables' => array('user_rating' => NULL, 'average_rating' => NULL, 'votes' => 0, 'stars' => 5, 'microdata' => array()),
+      'variables' => ['user_rating' => NULL, 'average_rating' => NULL, 'votes' => 0, 'stars' => 5, 'microdata' => []],
       'file' => 'includes/fivestar.theme.inc',
-    ),
+    ],
     // fivestar.admin.inc.
-    'fivestar_preview' => array(
+    'fivestar_preview' => [
       'function' => 'theme_fivestar_preview',
-      'variables' => array('style' => NULL, 'text' => NULL, 'stars' => NULL, 'unvote' => NULL, 'title' => NULL),
+      'variables' => ['style' => NULL, 'text' => NULL, 'stars' => NULL, 'unvote' => NULL, 'title' => NULL],
       'file' => 'includes/fivestar.theme.inc',
-    ),
-    'fivestar_preview_widget' => array(
+    ],
+    'fivestar_preview_widget' => [
       'function' => 'theme_fivestar_preview_widget',
-      'variables' => array('css' => NULL, 'name' => NULL),
+      'variables' => ['css' => NULL, 'name' => NULL],
       'file' => 'includes/fivestar.theme.inc',
-    ),
-    'fivestar_preview_wrapper' => array(
+    ],
+    'fivestar_preview_wrapper' => [
       'function' => 'theme_fivestar_preview_wrapper',
-      'variables' => array('content' => NULL, 'type' => 'direct'),
+      'variables' => ['content' => NULL, 'type' => 'direct'],
       'file' => 'includes/fivestar.theme.inc',
-    ),
-//    'fivestar_settings_form' => array(
-//      'function' => 'theme_fivestar_settings_form',
-//      'render element' => 'form',
-//      'file' => 'includes/fivestar.theme.inc',
-//    ),
-//    'fivestar_color_form' => array(
-//      'function' => 'theme_fivestar_color_form',
-//      'render element' => 'form',
-//      'file' => 'includes/fivestar.theme.inc',
-//    ),
-    'fivestar_formatter_default' => array(
+    ],
+    // 'fivestar_settings_form' => array(
+    //      'function' => 'theme_fivestar_settings_form',
+    //      'render element' => 'form',
+    //      'file' => 'includes/fivestar.theme.inc',
+    //    ),
+    //    'fivestar_color_form' => array(
+    //      'function' => 'theme_fivestar_color_form',
+    //      'render element' => 'form',
+    //      'file' => 'includes/fivestar.theme.inc',
+    //    ),.
+    'fivestar_formatter_default' => [
       'function' => 'theme_fivestar_formatter_default',
       'render element' => 'element',
       'file' => 'includes/fivestar.theme.inc',
-    ),
-    'fivestar_formatter_rating' => array(
+    ],
+    'fivestar_formatter_rating' => [
       'function' => 'theme_fivestar_formatter_rating',
       'render element' => 'element',
       'file' => 'includes/fivestar.theme.inc',
-    ),
-    'fivestar_formatter_percentage' => array(
+    ],
+    'fivestar_formatter_percentage' => [
       'function' => 'theme_fivestar_formatter_percentage',
       'render element' => 'element',
       'file' => 'includes/fivestar.theme.inc',
-    ),
-    'fivestar_output_widget' => array(
+    ],
+    'fivestar_output_widget' => [
       'function' => 'theme_fivestar_output_widget',
       'render element' => 'element',
       'file' => 'includes/fivestar.theme.inc',
-    ),
-  );
+    ],
+  ];
 }
 
+/**
+ *
+ */
 function _fivestar_variables() {
-  return array('fivestar', 'fivestar_unvote', 'fivestar_style', 'fivestar_stars', 'fivestar_comment', 'fivestar_position', 'fivestar_position_teaser', 'fivestar_labels_enable', 'fivestar_labels', 'fivestar_text', 'fivestar_title', 'fivestar_feedback');
+  return ['fivestar', 'fivestar_unvote', 'fivestar_style', 'fivestar_stars', 'fivestar_comment', 'fivestar_position', 'fivestar_position_teaser', 'fivestar_labels_enable', 'fivestar_labels', 'fivestar_text', 'fivestar_title', 'fivestar_feedback'];
 }
 
 /**
@@ -148,7 +147,7 @@ function _fivestar_cast_vote($entity_type, $id, $value, $tag = NULL, $uid = NULL
   $uid = isset($uid) ? $uid : $user->uid;
   // Bail out if the user's trying to vote on an invalid object.
   if (!$skip_validation && !fivestar_validate_target($entity_type, $id, $tag, $uid)) {
-    return array();
+    return [];
   }
   // Sanity-check the incoming values.
   if (is_numeric($id) && is_numeric($value)) {
@@ -157,11 +156,10 @@ function _fivestar_cast_vote($entity_type, $id, $value, $tag = NULL, $uid = NULL
     }
 
     // Get the user's current vote.
-    $criteria = array('entity_type' => $entity_type, 'entity_id' => $id, 'tag' => $tag, 'uid' => $uid);
+    $criteria = ['entity_type' => $entity_type, 'entity_id' => $id, 'tag' => $tag, 'uid' => $uid];
     // Get the unique identifier for the user (IP Address if anonymous).
-
     if ($vote_source != NULL) {
-      $user_criteria = array('vote_source' => $vote_source);
+      $user_criteria = ['vote_source' => $vote_source];
       $limit = 1;
     }
     else {
@@ -174,7 +172,7 @@ function _fivestar_cast_vote($entity_type, $id, $value, $tag = NULL, $uid = NULL
       votingapi_delete_votes($user_votes);
     }
     else {
-      $votes = $criteria += array('value' => $value);
+      $votes = $criteria += ['value' => $value];
       votingapi_set_votes($votes);
     }
 
@@ -199,6 +197,7 @@ function _fivestar_cast_vote($entity_type, $id, $value, $tag = NULL, $uid = NULL
  *   The VotingAPI tag for which to retrieve votes.
  * @param $uid
  *   Optional. A user ID for which to retrieve votes.
+ *
  * @return
  *   An array of the following keys:
  *   - average: An array of VotingAPI results, including the average 'value'.
@@ -212,28 +211,28 @@ function fivestar_get_votes_multiple($entity_type, $ids, $tag = 'vote', $uid = N
     $uid = $user->uid;
   }
 
-  $criteria = array(
+  $criteria = [
     'entity_type' => $entity_type,
     'entity_id' => $ids,
     'value_type' => 'percent',
     'tag' => $tag,
-  );
+  ];
 
-  $votes = array();
+  $votes = [];
 
   // Initialize defaults.
-  foreach($ids as $id) {
-    $votes[$entity_type][$id] = array(
-      'average' => array(),
-      'count' => array(),
-      'user' => array(),
-    );
+  foreach ($ids as $id) {
+    $votes[$entity_type][$id] = [
+      'average' => [],
+      'count' => [],
+      'user' => [],
+    ];
   }
 
   $results = votingapi_select_results($criteria);
-  $user_votes = array();
-  if(!empty($results)) {
-    foreach(votingapi_select_votes($criteria += array('uid' => $uid)) as $uv) {
+  $user_votes = [];
+  if (!empty($results)) {
+    foreach (votingapi_select_votes($criteria += ['uid' => $uid]) as $uv) {
       $user_votes[$uv['entity_type']][$uv['entity_id']] = $uv;
     }
   }
@@ -245,25 +244,28 @@ function fivestar_get_votes_multiple($entity_type, $ids, $tag = 'vote', $uid = N
     if ($result['function'] == 'count') {
       $votes[$result['entity_type']][$result['entity_id']]['count'] = $result;
     }
-	  if ($uid) {
-	    if (!empty($user_votes[$result['entity_type']][$result['entity_id']])) {
+    if ($uid) {
+      if (!empty($user_votes[$result['entity_type']][$result['entity_id']])) {
         $votes[$result['entity_type']][$result['entity_id']]['user'] = $user_votes[$result['entity_type']][$result['entity_id']];
         $votes[$result['entity_type']][$result['entity_id']]['user']['function'] = 'user';
-	    }
-	  }
-	  else {
-	    // If the user is anonymous, we never bother loading their existing votes.
-	    // Not only would it be hit-or-miss, it would break page caching. Safer to always
-	    // show the 'fresh' version to anon users.
-      $votes[$result['entity_type']][$result['entity_id']]['user'] = array('value' => 0);
-	  }
+      }
+    }
+    else {
+      // If the user is anonymous, we never bother loading their existing votes.
+      // Not only would it be hit-or-miss, it would break page caching. Safer to always
+      // show the 'fresh' version to anon users.
+      $votes[$result['entity_type']][$result['entity_id']]['user'] = ['value' => 0];
+    }
   }
 
   return $votes;
 }
 
+/**
+ *
+ */
 function fivestar_get_votes($entity_type, $id, $tag = 'vote', $uid = NULL) {
-  $multiple = fivestar_get_votes_multiple($entity_type, array($id), $tag, $uid);
+  $multiple = fivestar_get_votes_multiple($entity_type, [$id], $tag, $uid);
   return $multiple[$entity_type][$id];
 }
 
@@ -279,7 +281,7 @@ function fivestar_get_votes($entity_type, $id, $tag = 'vote', $uid = NULL) {
  * @param $uid
  *   The user trying to cast the vote.
  *
- * @return boolean
+ * @return bool
  */
 function fivestar_validate_target($entity_type, $id, $tag, $uid = NULL) {
   if (!isset($uid)) {
@@ -322,13 +324,13 @@ function fivestar_validate_target($entity_type, $id, $tag, $uid = NULL) {
  */
 function fivestar_fivestar_access($entity_type, $id, $tag, $uid) {
   // Check to see if there is a field instance on this entity.
-  $fields = field_read_fields(array('module' => 'fivestar'));
+  $fields = field_read_fields(['module' => 'fivestar']);
   foreach ($fields as $field) {
     if ($field['settings']['axis'] == $tag) {
-      $params = array(
+      $params = [
         'entity_type' => $entity_type,
         'field_name' => $field['field_name'],
-      );
+      ];
       $instance = field_read_instances($params);
       if (!empty($instance)) {
         return TRUE;
@@ -347,9 +349,9 @@ function fivestar_fivestar_access($entity_type, $id, $tag, $uid) {
  * suggestion by ChristianAdamski in issue 1289832-3.
  */
 function fivestar_form_comment_form_alter(&$form, &$form_state, $form_id) {
-  $fivestar_field_keys = array();
+  $fivestar_field_keys = [];
   if (isset($form['comment_output_below'])) {
-    foreach($form['comment_output_below'] as $key => $value) {
+    foreach ($form['comment_output_below'] as $key => $value) {
       if (is_array($value) && !empty($value['#field_type']) && $value['#field_type'] == 'fivestar') {
         $fivestar_field_keys[] = $key;
       }
@@ -444,16 +446,16 @@ function fivestar_fivestar_widgets() {
  *     to "vote".
  */
 function fivestar_custom_widget($form, &$form_state, $values, $settings) {
-  $form = array(
-    '#attributes' => array(
-      'class' => array('fivestar-widget')
-    ),
-  );
+  $form = [
+    '#attributes' => [
+      'class' => ['fivestar-widget'],
+    ],
+  ];
   $form['#submit'][] = 'fivestar_form_submit';
 
   $form_state['settings'] = $settings;
 
-  $form['vote'] = array(
+  $form['vote'] = [
     '#type' => 'fivestar',
     '#stars' => $settings['stars'],
     '#auto_submit' => isset($settings['autosubmit']) ? $settings['autosubmit'] : TRUE,
@@ -461,17 +463,17 @@ function fivestar_custom_widget($form, &$form_state, $values, $settings) {
     '#allow_revote' => $settings['allow_revote'],
     '#allow_ownvote' => $settings['allow_ownvote'],
     '#required' => isset($settings['required']) ? $settings['required'] : FALSE,
-    '#widget' => isset($settings['widget']) ? $settings['widget'] : array('name' => 'default', 'css' => 'default'),
+    '#widget' => isset($settings['widget']) ? $settings['widget'] : ['name' => 'default', 'css' => 'default'],
     '#values' => $values,
     '#settings' => $settings,
     '#description' => $settings['description'],
-  );
+  ];
 
-  $form['fivestar_submit'] = array(
+  $form['fivestar_submit'] = [
     '#type' => 'submit',
     '#value' => t('Rate'),
-    '#attributes' => array('class' => array('fivestar-submit')),
-  );
+    '#attributes' => ['class' => ['fivestar-submit']],
+  ];
 
   return $form;
 }
@@ -494,18 +496,18 @@ function fivestar_form_submit($form, &$form_state) {
 }
 
 /**
- * AJAX submit handler for fivestar_custom_widget
+ * AJAX submit handler for fivestar_custom_widget.
  */
 function fivestar_ajax_submit($form, $form_state) {
   if (!empty($form_state['settings']['content_id'])) {
     $entity_manager = \Drupal::entityTypeManager();
-    $entity = $entity_manager->getStorage($form_state['settings']['entity_type'])->load(array($form_state['settings']['entity_id']));
+    $entity = $entity_manager->getStorage($form_state['settings']['entity_type'])->load([$form_state['settings']['entity_id']]);
     $entity = reset($entity);
     _fivestar_update_field_value($form_state['settings']['content_type'], $entity, $form_state['settings']['field_name'], $form_state['settings']['langcode'], $form_state['values']['vote']);
     $votes = _fivestar_cast_vote($form_state['settings']['content_type'], $form_state['settings']['content_id'], $form_state['values']['vote'], $form_state['settings']['tag']);
   }
 
-  $values = array();
+  $values = [];
   $values['user'] = isset($votes['user']['value']) ? $votes['user']['value'] : 0;
   $values['average'] = isset($votes['average']['value']) ? $votes['average']['value'] : 0;
   $values['count'] = isset($votes['count']['value']) ? $votes['count']['value'] : 0;
@@ -518,24 +520,23 @@ function fivestar_ajax_submit($form, $form_state) {
   // TODO: Look into all this, I honestly don't like it and it's a bit weird.
   $form['vote']['vote']['#description'] = isset($new_element['vote']['#description']) ? $new_element['vote']['#description'] : '';
 
-  return array(
+  return [
     '#type' => 'ajax',
-    '#commands' => array(
-      array(
+    '#commands' => [
+      [
         'command' => 'fivestarUpdate',
         'data' => drupal_render($form['vote']),
-      ),
-    ),
-  );
+      ],
+    ],
+  ];
 }
 
-
 /**
  * An #element_validate function for "fivestar" elements.
  */
 function fivestar_validate($element, &$form_state) {
   if ($element['#required'] && (empty($element['#value']) || $element['#value'] == '-')) {
-    form_error($element, t('@name field is required.', array('@name' => $element['#title'])));
+    form_error($element, t('@name field is required.', ['@name' => $element['#title']]));
   }
 }
 
@@ -545,19 +546,22 @@ function fivestar_validate($element, &$form_state) {
 function fivestar_votingapi_metadata_alter(&$data) {
   foreach (fivestar_get_tags() as $tag) {
     // Add several custom tags that are being used by fivestar.
-    $data['tags'][$tag] = array(
+    $data['tags'][$tag] = [
       'name' => t($tag),
-      'description' => t('@tag used by fivestar.', array('@tag' => $tag)),
+      'description' => t('@tag used by fivestar.', ['@tag' => $tag]),
       'module' => 'fivestar',
-    );
+    ];
   }
 }
 
+/**
+ *
+ */
 function fivestar_get_tags() {
   $tags_txt = \Drupal::config('fivestar.settings')->get('tags', 'vote');
   $tags_exploded = explode(',', $tags_txt);
 
-  $tags = array();
+  $tags = [];
   $got_vote = FALSE;
   foreach ($tags_exploded as $tag) {
     $tag_trimmed = trim($tag);
@@ -575,30 +579,29 @@ function fivestar_get_tags() {
   return $tags;
 }
 
-
 /**
  * Implements hook_fivestar_target_info().
  */
 function fivestar_fivestar_target_info($field, $instance) {
   $entity_type = $instance['entity_type'];
   $bundle = $instance['bundle'];
-  $options = array(
-    'none' => array(
+  $options = [
+    'none' => [
       'title' => t('None'),
-    ),
-  );
+    ],
+  ];
   $module_handler = \Drupal::moduleHandler();
   // Add node_referrence support.
   if ($module_handler->moduleExists('node_reference')) {
-    $field_names = array_keys(field_read_fields(array('module' => 'node_reference')));
+    $field_names = array_keys(field_read_fields(['module' => 'node_reference']));
     if (!empty($field_names)) {
-      $field_instances = field_read_instances(array('entity_type' => $entity_type, 'bundle' => $bundle, 'field_name' => $field_names));
+      $field_instances = field_read_instances(['entity_type' => $entity_type, 'bundle' => $bundle, 'field_name' => $field_names]);
       if (!empty($field_instances)) {
         foreach ($field_instances as $field_instance) {
-          $options[$field_instance['field_name']] = array(
-            'title' => t('Node reference: @field', array('@field' => $field_instance['field_name'])),
-            'callback' => '_fivestar_target_node_reference'
-          );
+          $options[$field_instance['field_name']] = [
+            'title' => t('Node reference: @field', ['@field' => $field_instance['field_name']]),
+            'callback' => '_fivestar_target_node_reference',
+          ];
         }
       }
     }
@@ -606,15 +609,15 @@ function fivestar_fivestar_target_info($field, $instance) {
 
   // Add entityreference support.
   if ($module_handler->moduleExists('entityreference')) {
-    $field_names = array_keys(field_read_fields(array('module' => 'entityreference')));
+    $field_names = array_keys(field_read_fields(['module' => 'entityreference']));
     if (!empty($field_names)) {
-      $field_instances = field_read_instances(array('entity_type' => $entity_type, 'bundle' => $bundle, 'field_name' => $field_names));
+      $field_instances = field_read_instances(['entity_type' => $entity_type, 'bundle' => $bundle, 'field_name' => $field_names]);
       if (!empty($field_instances)) {
         foreach ($field_instances as $field_instance) {
-          $options[$field_instance['field_name']] = array(
-            'title' => t('Entity reference: @field', array('@field' => $field_instance['field_name'])),
-            'callback' => '_fivestar_target_entityreference'
-          );
+          $options[$field_instance['field_name']] = [
+            'title' => t('Entity reference: @field', ['@field' => $field_instance['field_name']]),
+            'callback' => '_fivestar_target_entityreference',
+          ];
         }
       }
     }
@@ -622,15 +625,15 @@ function fivestar_fivestar_target_info($field, $instance) {
 
   // Add user reference support.
   if ($module_handler->moduleExists('user_reference')) {
-    $field_names = array_keys(field_read_fields(array('module' => 'user_reference')));
+    $field_names = array_keys(field_read_fields(['module' => 'user_reference']));
     if (!empty($field_names)) {
-      $field_instances = field_read_instances(array('entity_type' => $entity_type, 'bundle' => $bundle, 'field_name' => $field_names));
+      $field_instances = field_read_instances(['entity_type' => $entity_type, 'bundle' => $bundle, 'field_name' => $field_names]);
       if (!empty($field_instances)) {
         foreach ($field_instances as $field_instance) {
-          $options[$field_instance['field_name']] = array(
-            'title' => t('User reference: @field', array('@field' => $field_instance['field_name'])),
-            'callback' => '_fivestar_target_user_reference'
-          );
+          $options[$field_instance['field_name']] = [
+            'title' => t('User reference: @field', ['@field' => $field_instance['field_name']]),
+            'callback' => '_fivestar_target_user_reference',
+          ];
         }
       }
     }
@@ -638,10 +641,10 @@ function fivestar_fivestar_target_info($field, $instance) {
 
   // Add comment module support.
   if ($instance['entity_type'] == 'comment') {
-    $options['parent_node'] = array(
+    $options['parent_node'] = [
       'title' => t('Parent Node'),
-      'callback' => '_fivestar_target_comment_parent_node'
-    );
+      'callback' => '_fivestar_target_comment_parent_node',
+    ];
   }
 
   return $options;
@@ -653,7 +656,7 @@ function fivestar_fivestar_target_info($field, $instance) {
  *   array('entity_type', 'entity_id').
  */
 function _fivestar_target_node_reference($entity, $field, $instance, $langcode) {
-  $target = array();
+  $target = [];
 
   $node_reference = $instance['settings']['target'];
   if (isset($entity->{$node_reference}[$langcode][0]) && is_numeric($entity->{$node_reference}[$langcode][0]['nid'])) {
@@ -668,7 +671,7 @@ function _fivestar_target_node_reference($entity, $field, $instance, $langcode)
  * @return (array) array('entity_type', 'entity_id')
  */
 function _fivestar_target_entityreference($entity, $field, $instance, $langcode) {
-  $target = array();
+  $target = [];
 
   $entityreference = $instance['settings']['target'];
 
@@ -689,7 +692,7 @@ function _fivestar_target_entityreference($entity, $field, $instance, $langcode)
  *   array('entity_type', 'entity_id').
  */
 function _fivestar_target_user_reference($entity, $field, $instance, $langcode) {
-  $target = array();
+  $target = [];
 
   $user_reference = $instance['settings']['target'];
   if (isset($entity->{$user_reference}[$langcode][0]) && is_numeric($entity->{$user_reference}[$langcode][0]['uid'])) {
@@ -700,11 +703,14 @@ function _fivestar_target_user_reference($entity, $field, $instance, $langcode)
   return $target;
 }
 
+/**
+ *
+ */
 function _fivestar_target_comment_parent_node($entity, $field, $instance, $langcode) {
-  return array(
+  return [
     'entity_id' => $entity->nid,
     'entity_type' => 'node',
-  );
+  ];
 }
 
 /**
diff --git a/includes/fivestar.field.inc b/includes/fivestar.field.inc
index f05c0b5..ca41e45 100644
--- a/includes/fivestar.field.inc
+++ b/includes/fivestar.field.inc
@@ -2,33 +2,33 @@
 
 /**
  * @file
- * Provides CCK integration for fivestar module
+ * Provides CCK integration for fivestar module.
  */
 
+use Drupal\Core\Render\Element;
 /**
  * Implementation of hook_field_info().
  */
 function fivestar_field_info() {
-  return array(
-    'fivestar' => array(
+  return [
+    'fivestar' => [
       'label' => t('Fivestar Rating'),
       'description' => t('Store a rating for this piece of content.'),
       'default_widget' => 'exposed',
       'default_formatter' => 'fivestar_formatter_default',
-      'settings' => array(
+      'settings' => [
         'axis' => 'vote',
-      ),
-      'instance_settings' => array(
+      ],
+      'instance_settings' => [
         'stars' => 5,
-      ),
+      ],
       'property_type' => 'fivestar',
-      'property_callbacks' => array('fivestar_property_info_callback'),
+      'property_callbacks' => ['fivestar_property_info_callback'],
       'microdata' => TRUE,
-    ),
-  );
+    ],
+  ];
 }
 
-
 /**
  * Implementation of hook_field_insert().
  */
@@ -50,6 +50,9 @@ function fivestar_field_delete($entity_type, $entity, $field, $instance, $langco
   _fivestar_field_helper($entity_type, $entity, $field, $instance, $langcode, $items, 'delete');
 }
 
+/**
+ *
+ */
 function _fivestar_field_helper($entity_type, $entity, $field, $instance, $langcode, &$items, $op = '') {
   foreach ($items as $delta => $item) {
     if ((isset($entity->status) && !$entity->status) || $op == 'delete') {
@@ -84,7 +87,6 @@ function _fivestar_field_helper($entity_type, $entity, $field, $instance, $langc
   }
 }
 
-
 /**
  * Helper function to store a rating into the field storage.
  */
@@ -106,37 +108,37 @@ function fivestar_field_is_empty($item, $field) {
  * Implementation of hook_field_widget_info().
  */
 function fivestar_field_widget_info() {
-  return array(
-    'exposed' => array(
+  return [
+    'exposed' => [
       'label' => t('Stars (rated while viewing)'),
-      'field types' => array('fivestar'),
-      'behaviors' => array('multiple values' => FIELD_BEHAVIOR_NONE),
-    ),
-    'stars' => array(
+      'field types' => ['fivestar'],
+      'behaviors' => ['multiple values' => FIELD_BEHAVIOR_NONE],
+    ],
+    'stars' => [
       'label' => t('Stars (rated while editing)'),
-      'field types' => array('fivestar'),
-      'behaviors' => array('multiple values' => FIELD_BEHAVIOR_NONE),
-      'settings' => array(
-        'widget' => array(
+      'field types' => ['fivestar'],
+      'behaviors' => ['multiple values' => FIELD_BEHAVIOR_NONE],
+      'settings' => [
+        'widget' => [
           'fivestar_widget' => 'default',
-        )
-      )
-    ),
-    'fivestar_select' => array(
+        ],
+      ],
+    ],
+    'fivestar_select' => [
       'label' => t('Select list (rated while editing)'),
-      'field types' => array('fivestar'),
-      'behaviors' => array('multiple values' => FIELD_BEHAVIOR_NONE),
-    ),
-  );
+      'field types' => ['fivestar'],
+      'behaviors' => ['multiple values' => FIELD_BEHAVIOR_NONE],
+    ],
+  ];
 }
 
 /**
  * Implementation of hook_field_widget_settings_form().
  */
 function fivestar_field_widget_settings_form($field, $instance) {
-  $form = array();
+  $form = [];
   if ($instance['widget']['type'] == 'stars') {
-    $form['widget'] = array(
+    $form['widget'] = [
       '#tree' => TRUE,
       '#type' => 'fieldset',
       '#title' => t('Star display options'),
@@ -144,30 +146,33 @@ function fivestar_field_widget_settings_form($field, $instance) {
       '#weight' => -2,
       '#collapsible' => TRUE,
       '#collapsed' => TRUE,
-    );
+    ];
 
     $widgets = module_invoke_all('fivestar_widgets');
 
-    $form['widget']['fivestar_widget'] = array(
+    $form['widget']['fivestar_widget'] = [
       '#type' => 'radios',
-      '#options' => array('default' => t('Default')) + $widgets,
+      '#options' => ['default' => t('Default')] + $widgets,
       '#default_value' => isset($instance['widget']['settings']['widget']['fivestar_widget']) ? $instance['widget']['settings']['widget']['fivestar_widget'] : 'default',
-      '#attributes' => array('class' => array('fivestar-widgets', 'clearfix')),
-      '#pre_render' => array('fivestar_previews_expand'),
-      '#attached' => array('css' => array(drupal_get_path('module', 'fivestar') . '/css/fivestar-admin.css')),
-    );
+      '#attributes' => ['class' => ['fivestar-widgets', 'clearfix']],
+      '#pre_render' => ['fivestar_previews_expand'],
+      '#attached' => ['css' => [drupal_get_path('module', 'fivestar') . '/css/fivestar-admin.css']],
+    ];
   }
 
   return $form;
 }
 
+/**
+ *
+ */
 function fivestar_previews_expand($element) {
-  foreach (\Drupal\Core\Render\Element::children($element) as $css) {
-    $vars = array(
+  foreach (Element::children($element) as $css) {
+    $vars = [
       '#type' => 'fivestar_preview_widget',
       '#css' => $css,
       '#name' => strtolower($element[$css]['#title']),
-    );
+    ];
     $element[$css]['#description'] = \Drupal::service('renderer')->render($vars);
   }
   return $element;
@@ -180,7 +185,7 @@ function fivestar_field_widget_form(&$form, &$form_state, $field, $instance, $la
   $element['#tree'] = TRUE;
   $i18n = function_exists('i18n_field_translate_property');
   if ($instance['widget']['type'] == 'fivestar_select' || ($instance['widget']['type'] == 'stars' && isset($form['#title']) && $form['#title'] == 'Default value')) {
-    $options = array(0 => t('No stars'));
+    $options = [0 => t('No stars')];
     if (empty($instance['settings']['stars'])) {
       $instance['settings']['stars'] = 5;
     }
@@ -188,31 +193,31 @@ function fivestar_field_widget_form(&$form, &$form_state, $field, $instance, $la
       $percentage = ceil($i * 100 / $instance['settings']['stars']);
       $options[$percentage] = format_plural($i, '1 star', '@count stars');
     }
-    $element['rating'] = array(
+    $element['rating'] = [
       '#type' => 'select',
       '#title' => isset($instance['label']) ? (($i18n) ? i18n_field_translate_property($instance, 'label') : t($instance['label'])) : FALSE,
       '#options' => $options,
       '#default_value' => isset($items[$delta]['rating']) ? $items[$delta]['rating'] : NULL,
       '#description' => isset($instance['description']) ? (($i18n) ? i18n_field_translate_property($instance, 'description') : t($instance['description'])) : FALSE,
       '#required' => isset($instance['required']) ? $instance['required'] : FALSE,
-    );
+    ];
   }
 
   elseif ($instance['widget']['type'] == 'stars') {
     $widgets = module_invoke_all('fivestar_widgets');
     $active = isset($instance['widget']['settings']['widget']['fivestar_widget']) ? $instance['widget']['settings']['widget']['fivestar_widget'] : 'default';
-    $widget = array(
+    $widget = [
       'name' => isset($widgets[$active]) ? strtolower($widgets[$active]) : 'default',
       'css' => $active,
-    );
+    ];
 
-    $values = array(
+    $values = [
       'user' => 0,
       'average' => 0,
       'count' => 0,
-    );
+    ];
 
-    $settings = array(
+    $settings = [
       'stars' => $instance['settings']['stars'],
       'allow_clear' => !empty($instance['settings']['allow_clear']) ? $instance['settings']['allow_clear'] : FALSE,
       'allow_revote' => !empty($instance['settings']['allow_revote']) ? $instance['settings']['allow_revote'] : FALSE,
@@ -220,10 +225,10 @@ function fivestar_field_widget_form(&$form, &$form_state, $field, $instance, $la
       'style' => 'user',
       'text' => 'none',
       'widget' => $widget,
-    );
+    ];
 
-    $element['rating'] = array(
-      '#type'=> 'fivestar',
+    $element['rating'] = [
+      '#type' => 'fivestar',
       '#title' => isset($instance['label']) ? (($i18n) ? i18n_field_translate_property($instance, 'label') : t($instance['label'])) : FALSE,
       '#stars' => isset($instance['settings']['stars']) ? $instance['settings']['stars'] : 5,
       '#allow_clear' => isset($instance['settings']['allow_clear']) ? $instance['settings']['allow_clear'] : FALSE,
@@ -235,41 +240,41 @@ function fivestar_field_widget_form(&$form, &$form_state, $field, $instance, $la
       '#values' => $values,
       '#description' => isset($instance['description']) ? (($i18n) ? i18n_field_translate_property($instance, 'description') : t($instance['description'])) : FALSE,
       '#required' => isset($instance['required']) ? $instance['required'] : FALSE,
-    );
+    ];
   }
 
-  return array($element);
+  return [$element];
 }
 
 /**
  * Implementation of hook_field_formatter_info().
  */
 function fivestar_field_formatter_info() {
-  return array(
-    'fivestar_formatter_default' => array(
+  return [
+    'fivestar_formatter_default' => [
       'label' => t('As Stars'),
-      'field types' => array('fivestar'),
-      'settings' =>  array(
+      'field types' => ['fivestar'],
+      'settings' => [
         // Note: Do not set to widget to 'default' by
         // default. "Stars (rated while editing)" should
         // default to whatever was selected as a widget
         // setting. Let hook_field_formatter_view() handle
         // defaults for instances that aren't set to anything.
-        'widget' => array('fivestar_widget' => NULL),
+        'widget' => ['fivestar_widget' => NULL],
         'style' => 'average',
         'text' => 'average',
         'expose' => TRUE,
-      ),
-    ),
-    'fivestar_formatter_rating' => array(
+      ],
+    ],
+    'fivestar_formatter_rating' => [
       'label' => t('Rating (i.e. 4.2/5)'),
-      'field types' => array('fivestar'),
-    ),
-    'fivestar_formatter_percentage' => array(
+      'field types' => ['fivestar'],
+    ],
+    'fivestar_formatter_percentage' => [
       'label' => t('Percentage (i.e. 92)'),
-      'field types' => array('fivestar'),
-    ),
-  );
+      'field types' => ['fivestar'],
+    ],
+  ];
 }
 
 /**
@@ -283,7 +288,7 @@ function fivestar_field_formatter_settings_form($field, $instance, $view_mode, $
     return;
   }
 
-  $element['widget'] = array(
+  $element['widget'] = [
     '#tree' => TRUE,
     '#type' => 'fieldset',
     '#title' => t('Star display options'),
@@ -291,51 +296,51 @@ function fivestar_field_formatter_settings_form($field, $instance, $view_mode, $
     '#weight' => -2,
     '#collapsible' => TRUE,
     '#collapsed' => TRUE,
-  );
+  ];
 
   $widgets = module_invoke_all('fivestar_widgets');
 
-  $element['widget']['fivestar_widget'] = array(
+  $element['widget']['fivestar_widget'] = [
     '#type' => 'radios',
-    '#options' => array('default' => t('Default')) + $widgets,
+    '#options' => ['default' => t('Default')] + $widgets,
     '#default_value' => isset($settings['widget']['fivestar_widget']) ? $settings['widget']['fivestar_widget'] : 'default',
-    '#attributes' => array('class' => array('fivestar-widgets', 'clearfix')),
-    '#pre_render' => array('fivestar_previews_expand'),
-    '#attached' => array('css' => array(drupal_get_path('module', 'fivestar') . '/css/fivestar-admin.css')),
-  );
+    '#attributes' => ['class' => ['fivestar-widgets', 'clearfix']],
+    '#pre_render' => ['fivestar_previews_expand'],
+    '#attached' => ['css' => [drupal_get_path('module', 'fivestar') . '/css/fivestar-admin.css']],
+  ];
 
   if ($instance['widget']['type'] == 'exposed') {
-    $element['expose'] = array(
+    $element['expose'] = [
       '#type' => 'checkbox',
       '#title' => t('Allow voting on the entity.'),
       '#default_value' => $settings['expose'],
-      '#return_value' => 1
-    );
+      '#return_value' => 1,
+    ];
   }
 
-  $element['style'] = array(
+  $element['style'] = [
     '#type' => 'select',
     '#title' => t('Value to display as stars'),
     '#default_value' => $settings['style'],
-    '#options' => array(
+    '#options' => [
       'average' => t('Average vote'),
       'user'    => t("User's vote"),
       'smart'   => t("User's vote if available, average otherwise"),
       'dual'    => t("Both user's and average vote"),
-    ),
-  );
-  $element['text'] = array(
+    ],
+  ];
+  $element['text'] = [
     '#type' => 'select',
     '#title' => t('Text to display under the stars'),
     '#default_value' => $settings['text'],
-    '#options' => array(
+    '#options' => [
       'none'    => t('No text'),
       'average' => t('Average vote'),
       'user'    => t("User's vote"),
       'smart'   => t("User's vote if available, average otherwise"),
       'dual'    => t("Both user's and average vote"),
-    ),
-  );
+    ],
+  ];
 
   return $element;
 }
@@ -354,18 +359,20 @@ function fivestar_field_formatter_settings_summary($field, $instance, $view_mode
   $widgets = module_invoke_all('fivestar_widgets');
 
   if ($instance['widget']['type'] == 'exposed') {
-    $summary = t("Style: @widget, Exposed: @expose, Stars display: @style, Text display: @text", array(
+    $summary = t("Style: @widget, Exposed: @expose, Stars display: @style, Text display: @text", [
       '@widget' => isset($widgets[$settings['widget']['fivestar_widget']]) ? strtolower($widgets[$settings['widget']['fivestar_widget']]) : t('default'),
       '@expose' => ($settings['expose']) ? 'yes' : 'no',
       '@style' => strtolower($settings['style']),
-      '@text' => strtolower($settings['text'])));
+      '@text' => strtolower($settings['text']),
+    ]);
     return $summary;
   }
 
-  $summary = t("Style: @widget, Stars display: @style, Text display: @text", array(
+  $summary = t("Style: @widget, Stars display: @style, Text display: @text", [
     '@widget' => isset($widgets[$settings['widget']['fivestar_widget']]) ? $widgets[$settings['widget']['fivestar_widget']] : t('default'),
     '@style' => strtolower($settings['style']),
-    '@text' => strtolower($settings['text'])));
+    '@text' => strtolower($settings['text']),
+  ]);
 
   return $summary;
 }
@@ -380,15 +387,15 @@ function fivestar_field_formatter_settings_summary($field, $instance, $view_mode
  * fivestar theme function.
  *
  * @param $items
- *  Array. Generated by fivestar_field_prepare_view(). This array contains
- *  processed voting info.
+ *   Array. Generated by fivestar_field_prepare_view(). This array contains
+ *   processed voting info.
  *
- * @return $element
- *  Renderable array. This array will always be $element[0], with only one
- *  top level item, because Fivestar does not offer multi-value fields.
+ * @return element
+ *   Renderable array. This array will always be $element[0], with only one
+ *   top level item, because Fivestar does not offer multi-value fields.
  */
 function fivestar_field_formatter_view($entity_type, $entity, $field, $instance, $langcode, $items, $display) {
-  $element = array();
+  $element = [];
   $settings = $display['settings'];
   $widgets = module_invoke_all('fivestar_widgets');
   $widget = _fivestar_get_widget($widgets, $display, $instance);
@@ -400,7 +407,7 @@ function fivestar_field_formatter_view($entity_type, $entity, $field, $instance,
   // fivestar_custom_widget form, and let it take care of the rest.
   // Note: Stars will only be displayed in a form in the following circumstance:
   // - Fivestar widget selected is "Stars (rated while viewing)"
-  // - Fivestar display setting = "exposed"
+  // - Fivestar display setting = "exposed".
   $is_form = ($instance['widget']['type'] == 'exposed'
               && user_access('rate content')
               && $display['type'] == 'fivestar_formatter_default'
@@ -412,14 +419,14 @@ function fivestar_field_formatter_view($entity_type, $entity, $field, $instance,
     list($id, $vid, $bundle) = entity_extract_ids($entity_type, $entity);
     $settings = _fivestar_custom_widget_settings($entity_type, $instance, $display, $id, $tag, $widget);
     // Store entity and field data for later reuse.
-    $settings += array(
+    $settings += [
       'entity_id' => $id,
       'entity_type' => $entity_type,
       'field_name' => $instance['field_name'],
       'langcode' => $langcode,
-    );
+    ];
     // If microdata module is enabled, attach the microdata attributes.
-    $settings['microdata'] = \Drupal::moduleHandler()->moduleExists('microdata') ? $entity->microdata[$field['field_name']] : array();
+    $settings['microdata'] = \Drupal::moduleHandler()->moduleExists('microdata') ? $entity->microdata[$field['field_name']] : [];
 
     $element[0] = drupal_get_form('fivestar_custom_widget', $values, $settings);
     // Our work here is done.
@@ -427,21 +434,21 @@ function fivestar_field_formatter_view($entity_type, $entity, $field, $instance,
   }
 
   // No stars will be displayed in a form. Build a renderable array.
-  $element[0] = array(
+  $element[0] = [
     // Add a container div around this field with the clearfix class on it.
-    '#attributes' => array('class' => array('clearfix')),
-    '#theme_wrappers' => array('container'),
-  );
+    '#attributes' => ['class' => ['clearfix']],
+    '#theme_wrappers' => ['container'],
+  ];
 
   // Determine if we are going to display stars, rating or percentage.
   $formatter = $display['type'];
   if ($formatter == 'fivestar_formatter_percentage' || $formatter == 'fivestar_formatter_rating') {
-    $element[0]['user'] = array(
+    $element[0]['user'] = [
       '#theme' => $formatter,
       '#instance_settings' => $instance['settings'],
       '#display_settings' => $settings,
       '#item' => $values,
-    );
+    ];
     // No stars to display. Our work here is done.
     return $element;
   }
@@ -455,23 +462,23 @@ function fivestar_field_formatter_view($entity_type, $entity, $field, $instance,
   $show_average_stars = ($style == 'average' || $style == 'dual' || ($style == 'smart' && empty($values['user'])));
   $show_user_stars = ($style == 'user' || $style == 'dual' || ($style == 'smart' && !empty($values['user'])));
   if ($show_user_stars) {
-    $element[0]['user'] = array(
+    $element[0]['user'] = [
       '#theme' => $display['type'],
       '#rating' => $values['user'],
       '#instance_settings' => $instance['settings'],
       '#display_settings' => $settings,
       '#widget' => $widget,
-    );
+    ];
     $element[0]['#attributes']['class'][] = 'fivestar-user-stars';
   }
   if ($show_average_stars) {
-    $element[0]['average'] = array(
+    $element[0]['average'] = [
       '#theme' => $display['type'],
       '#rating' => $values['average'],
       '#instance_settings' => $instance['settings'],
       '#display_settings' => $settings,
       '#widget' => $widget,
-    );
+    ];
     $element[0]['#attributes']['class'][] = 'fivestar-average-stars';
   }
   if ($style === 'smart') {
@@ -483,23 +490,23 @@ function fivestar_field_formatter_view($entity_type, $entity, $field, $instance,
 
   // Determine which text is to be displayed.
   $text = $display['settings']['text'];
-  $summary_options = array(
+  $summary_options = [
     'stars' => $instance['settings']['stars'],
     'votes' => NULL,
-  );
+  ];
 
- $summary_options['microdata'] = _fivestar_get_microdata_property_info($entity_type, $entity, $field, $instance);
+  $summary_options['microdata'] = _fivestar_get_microdata_property_info($entity_type, $entity, $field, $instance);
 
   // If we're displaying both user and average ratings, add a description to
   // both the 'user' and 'average' elements.
   if ($style === 'dual') {
-    $element[0]['user']['#description'] = theme('fivestar_summary', array(
+    $element[0]['user']['#description'] = theme('fivestar_summary', [
       'user_rating' => $values['user'],
-    ) + $summary_options);
-    $element[0]['average']['#description'] = theme('fivestar_summary', array(
+    ] + $summary_options);
+    $element[0]['average']['#description'] = theme('fivestar_summary', [
       'average_rating' => $values['average'],
       'votes' => $values['count'],
-    ) + $summary_options);
+    ] + $summary_options);
   }
   // If we're only creating one element (either 'user' or 'average'), prepare
   // the correct description, and place it on that element.
@@ -537,12 +544,12 @@ function fivestar_field_formatter_view($entity_type, $entity, $field, $instance,
  *
  * @params
  *
- * @return $settings
- *  Array. @see fivestar_custom_widget().
+ * @return settings
+ *   Array. @see fivestar_custom_widget().
  */
 function _fivestar_custom_widget_settings($entity_type, $instance, $display, $id, $tag, $widget) {
   $settings = $display['settings'];
-  $settings = array(
+  $settings = [
     'stars' => (!empty($instance['settings']['stars'])) ? $instance['settings']['stars'] : 5,
     'allow_clear' => (!empty($instance['settings']['allow_clear'])) ? $instance['settings']['allow_clear'] : 0,
     'allow_revote' => (!empty($instance['settings']['allow_revote'])) ? $instance['settings']['allow_revote'] : 0,
@@ -555,32 +562,32 @@ function _fivestar_custom_widget_settings($entity_type, $instance, $display, $id
     'autosubmit' => TRUE,
     'title' => FALSE,
     'labels_enable' => FALSE,
-    'labels' => array(),
+    'labels' => [],
     'widget' => $widget,
     'description' => $instance['description'],
-  );
+  ];
 
   return $settings;
 }
 
 /**
  * @param $widgets
- *  Array, $widgets = module_invoke_all('fivestar_widgets');
- *  $widgets = array('path/to/css' => 'Widget Name', 'path/to/more/css' => 'Widget 2');
+ *   Array, $widgets = module_invoke_all('fivestar_widgets');
+ *   $widgets = array('path/to/css' => 'Widget Name', 'path/to/more/css' => 'Widget 2');
  *
  * @param $display
- *  Array. This is the $display parameter passed to fivestar_field_formatter_view().
+ *   Array. This is the $display parameter passed to fivestar_field_formatter_view().
  *
  * @param $instance
- *  Array. This is the $instance parameter passed to fivestar_field_formatter_view().
+ *   Array. This is the $instance parameter passed to fivestar_field_formatter_view().
  *
- * @return $widget
- *  Array. $widget = array('name' => 'my widget', 'css' => 'sites/all/mymodule/mywidget.css');
+ * @return widget
+ *   Array. $widget = array('name' => 'my widget', 'css' => 'sites/all/mymodule/mywidget.css');
  */
 function _fivestar_get_widget($widgets, $display, $instance) {
   // If the type doesn't required widgets lets get out of here.
   // TODO: Implement this WAY better.
-  if (in_array($display['type'], array('fivestar_formatter_rating', 'fivestar_formatter_percentage'))) {
+  if (in_array($display['type'], ['fivestar_formatter_rating', 'fivestar_formatter_percentage'])) {
     return FALSE;
   }
 
@@ -598,15 +605,15 @@ function _fivestar_get_widget($widgets, $display, $instance) {
     }
     elseif ($type == 'stars') {
       // Stars rated while editing, that is, $type = stars,
-      // falls back on whatever the user selected to be displayed on node/add and node/%/edit
+      // falls back on whatever the user selected to be displayed on node/add and node/%/edit.
       $fivestar_widget = $instance['widget']['settings']['widget']['fivestar_widget'];
     }
   }
 
-  $widget = array(
+  $widget = [
     'name' => isset($widgets[$fivestar_widget]) ? strtolower($widgets[$fivestar_widget]) : 'default',
     'css' => $fivestar_widget,
-  );
+  ];
 
   return $widget;
 }
@@ -616,7 +623,7 @@ function _fivestar_get_widget($widgets, $display, $instance) {
  */
 function fivestar_field_prepare_view($entity_type, $entities, $field, $instances, $langcode, &$items) {
   // TODO: Clean this function up!
-  $exposed_widgets = array();
+  $exposed_widgets = [];
   foreach ($entities as $id => $entity) {
     // Ensure the items aren't processed twice.
     if (!isset($items[$id][0]['count'])) {
@@ -636,18 +643,18 @@ function fivestar_field_prepare_view($entity_type, $entities, $field, $instances
           $values['user'] = 0;
           $values['average'] = 0;
         }
-        $items[$id] = array($values);
+        $items[$id] = [$values];
       }
     }
-    if(!empty($exposed_widgets)) {
+    if (!empty($exposed_widgets)) {
       $votes = fivestar_get_votes_multiple($entity_type, $exposed_widgets, $field['settings']['axis']);
-      foreach($votes[$entity_type] as $id => $vote) {
+      foreach ($votes[$entity_type] as $id => $vote) {
         // Populating the $items[$id] array even for items with no value forces
         // the render system to output a widget.
         $values['user'] = isset($vote['user']['value']) ? $vote['user']['value'] : 0;
         $values['average'] = isset($vote['average']['value']) ? $vote['average']['value'] : 0;
         $values['count'] = isset($vote['count']['value']) ? $vote['count']['value'] : 0;
-        $items[$id] = array($values);
+        $items[$id] = [$values];
       }
     }
   }
@@ -667,23 +674,23 @@ function fivestar_property_info_callback(&$info, $entity_type, $field, $instance
   $name = $field['field_name'];
   $property = &$info[$entity_type]['bundles'][$instance['bundle']]['properties'][$name];
 
-  $property['property info'] = array(
-    'average_rating' => array(
+  $property['property info'] = [
+    'average_rating' => [
       'label' => t('Average Rating'),
       'type' => 'text',
       'microdata' => TRUE,
-    ),
-    'user_rating' => array(
+    ],
+    'user_rating' => [
       'label' => t('User\'s Rating'),
       'type' => 'text',
       'microdata' => TRUE,
-    ),
-    'rating_count' => array(
+    ],
+    'rating_count' => [
       'label' => t('Rating count'),
       'type' => 'text',
       'microdata' => TRUE,
-    ),
-  );
+    ],
+  ];
 }
 
 /**
@@ -698,22 +705,22 @@ function _fivestar_get_microdata_property_info($entity_type, $entity, $field, $i
   // If microdata is not enabled, add empty arrays for each property so we
   // don't have to check later in the theme functions.
   else {
-    $microdata = array(
-      '#attributes' => array(),
-    );
+    $microdata = [
+      '#attributes' => [],
+    ];
     // If Entity API is enabled, we can use that to get the properties.
     // Otherwise, replicate the Entity API logic for getting the properties.
     if (\Drupal::moduleHandler()->moduleExists('entity')) {
       $entity_info = entity_get_all_property_info($entity_type);
     }
     else {
-      $info = array();
-      $info[$entity_type]['bundles'][$instance['bundle']]['properties'][$field['field_name']] = array();
+      $info = [];
+      $info[$entity_type]['bundles'][$instance['bundle']]['properties'][$field['field_name']] = [];
       fivestar_property_info_callback($info, $entity_type, $field, $instance, 'fivestar');
       $entity_info = $info[$entity_type]['bundles'][$instance['bundle']]['properties'];
     }
     foreach ($entity_info[$field['field_name']]['property info'] as $property_name => $property) {
-      $microdata[$property_name]['#attributes'] = array();
+      $microdata[$property_name]['#attributes'] = [];
     }
   }
 
diff --git a/includes/fivestar.migrate.inc b/includes/fivestar.migrate.inc
index c8c2479..b7714bf 100644
--- a/includes/fivestar.migrate.inc
+++ b/includes/fivestar.migrate.inc
@@ -1,4 +1,5 @@
 <?php
+
 /**
  * @file
  * Base integration with the Migrate API class.
@@ -8,10 +9,10 @@
  * Implements hook_migrate_api().
  */
 function fivestar_migrate_api() {
-  $api = array(
+  $api = [
     'api' => 2,
-    'field handlers' => array('MigrateFivestarFieldHandler'),
-  );
+    'field handlers' => ['MigrateFivestarFieldHandler'],
+  ];
   return $api;
 }
 
@@ -20,19 +21,28 @@ function fivestar_migrate_api() {
  */
 class MigrateFivestarFieldHandler extends MigrateFieldHandler {
 
+  /**
+   *
+   */
   public function __construct() {
-    $this->registerTypes(array('fivestar'));
+    $this->registerTypes(['fivestar']);
   }
 
+  /**
+   *
+   */
   public function fields($type, $parent_field, $migration = NULL) {
-    $fields = array(
+    $fields = [
       'target' => t('Ratings: The target of the rating.'),
-    );
+    ];
     return $fields;
   }
 
+  /**
+   *
+   */
   public function prepare($entity, array $field_info, array $instance, array $values) {
-    $arguments = array();
+    $arguments = [];
     if (isset($values['arguments'])) {
       $arguments = array_filter($values['arguments']);
       unset($values['arguments']);
@@ -41,9 +51,10 @@ class MigrateFivestarFieldHandler extends MigrateFieldHandler {
 
     // Setup the standard Field API array for saving.
     foreach (array_values($values) as $delta => $value) {
-      $return[$language][$delta] = array('rating' => $value) + array_intersect_key($arguments, $field_info['columns']);
+      $return[$language][$delta] = ['rating' => $value] + array_intersect_key($arguments, $field_info['columns']);
     }
 
     return isset($return) ? $return : NULL;
   }
+
 }
diff --git a/includes/fivestar.theme.inc b/includes/fivestar.theme.inc
index 54e7545..a6e2e11 100644
--- a/includes/fivestar.theme.inc
+++ b/includes/fivestar.theme.inc
@@ -2,59 +2,62 @@
 
 /**
  * @file
- * Provides the theming functions for fivestar
+ * Provides the theming functions for fivestar.
  */
 
+use Drupal\Core\Render\Element\RenderElement;
+use Drupal\Core\Render\Element;
+use Drupal\Core\Form\FormState;
 /**
  * Show a preview of a widget using a custom CSS file.
  */
 function theme_fivestar_preview_widget($variables) {
-  $form = array(
-    '#post' => array(),
+  $form = [
+    '#post' => [],
     '#programmed' => FALSE,
     '#tree' => FALSE,
-    '#parents' => array(),
-    '#array_parents' => array(),
+    '#parents' => [],
+    '#array_parents' => [],
     '#required' => FALSE,
-    '#attributes' => array(),
+    '#attributes' => [],
     '#title_display' => 'before',
-  );
+  ];
   $complete_form = [];
-  $form_state = new \Drupal\Core\Form\FormState();
+  $form_state = new FormState();
   $buidler = \Drupal::formBuilder();
   $form_state->setValues([]);
   $form_state->setProcessInput(FALSE);
   $form_state->setCompleteForm($complete_form);
-  $form['vote'] = array(
+  $form['vote'] = [
     '#type' => 'fivestar',
     '#stars' => 5,
     '#auto_submit' => FALSE,
     '#allow_clear' => TRUE,
     '#allow_revote' => TRUE,
     '#allow_ownvote' => TRUE,
-    '#widget' => array(
+    '#widget' => [
       'name' => isset($variables['name']) ? $variables['name'] : 'default',
       'css' => isset($variables['css']) && $variables['css'] != 'default' ? $variables['css'] : FALSE,
-    ),
-  );
+    ],
+  ];
 
-  // Attach necessary JS settings
-  $settings = array(
+  // Attach necessary JS settings.
+  $settings = [
     'titleUser' => t('Your rating') . ': ',
     'titleAverage' => t('Average') . ': ',
     'feedbackSavingVote' => t('Saving your vote...'),
     'feedbackVoteSaved' => t('Your vote has been saved.'),
     'feedbackDeletingVote' => t('Deleting your vote...'),
     'feedbackVoteDeleted' => t('Your vote has been deleted.'),
-  );
-  $form['#attached'][] = array(
-    'js' => array(
-      array(
+  ];
+  $form['#attached'][] = [
+    'js' => [
+      [
         'type' => 'setting',
-        'data' => $settings
-      )
-    )
-  );
+        'data' => $settings,
+      ],
+    ],
+  ];
 
   $buidler->doBuildForm('fivestar_preview', $form, $form_state);
   $output = $form;
@@ -64,14 +67,17 @@ function theme_fivestar_preview_widget($variables) {
   return \Drupal::service('renderer')->render($output);
 }
 
+/**
+ *
+ */
 function theme_fivestar_preview($variables) {
   extract($variables, EXTR_SKIP);
-  $values = array(
+  $values = [
     'average' => 50,
     'user' => 80,
     'count' => 20,
-  );
-  $settings = array(
+  ];
+  $settings = [
     'stars' => $stars,
     'allow_clear' => $unvote,
     'allow_revote' => $revote,
@@ -81,21 +87,24 @@ function theme_fivestar_preview($variables) {
     'title' => $title,
     'autosubmit' => FALSE,
     'tag' => 'vote',
-  );
+  ];
 
   $form = drupal_get_form('fivestar_custom_widget', $values, $settings);
   $form = drupal_render($form);
   // This regex is sadly necessary because having duplicate form_tokens or
   // form_id elements can cause the content type form to choke. Forms inside of
   // forms is also frowned upon, so this removes the wrapping form tag as well.
-  $form = str_replace(array('<form', '</form>'), array(
+  $form = str_replace(['<form', '</form>'], [
     '<div',
-    '</div>'
-  ), $form);
+    '</div>',
+  ], $form);
   $form = preg_replace('/( method=".*?")|( action=".*?")|(<input.*?name="(form_token|form_id|destination|form_build_id)".*?\/>)/', '', $form);
   return $form;
 }
 
+/**
+ *
+ */
 function theme_fivestar_preview_wrapper($variables) {
   return '<div class="fivestar-preview fivestar-preview-' . $variables['type'] . '">' . $variables['content'] . '</div>';
 }
@@ -114,22 +123,22 @@ function theme_fivestar_formatter_default($variables) {
     $element['#instance_settings']['stars'] = 5;
   }
 
-  // Add CSS and JS
+  // Add CSS and JS.
   $path = drupal_get_path('module', 'fivestar');
   drupal_add_js($path . '/js/fivestar.js');
   drupal_add_css($path . '/css/fivestar.css');
 
-  $variables = array(
+  $variables = [
     'rating' => $element['#rating'],
     'stars' => $element['#instance_settings']['stars'],
     'widget' => $element['#widget'],
-  );
+  ];
   $star_display = theme('fivestar_static', $variables);
-  return theme('fivestar_static_element', array(
+  return theme('fivestar_static_element', [
     'description' => $element['#description'],
     'star_display' => $star_display,
-    'is_form' => FALSE
-  ));
+    'is_form' => FALSE,
+  ]);
 }
 
 /**
@@ -170,7 +179,7 @@ function theme_fivestar_formatter_percentage($variables) {
 function theme_fivestar($variables) {
   $element = $variables['element'];
 
-  return theme('form_element', array('element' => $element));
+  return theme('form_element', ['element' => $element]);
 }
 
 /**
@@ -181,8 +190,8 @@ function theme_fivestar_select($variables) {
   $element = $variables['element'];
   unset($element['#theme']);
   return \Drupal::service('renderer')->render($element);
-  \Drupal\Core\Render\Element::setAttributes($element, ['id', 'name', 'size']);
-  \Drupal\Core\Render\Element\RenderElement::setAttributes($element, array('form-select'));
+  Element::setAttributes($element, ['id', 'name', 'size']);
+  RenderElement::setAttributes($element, ['form-select']);
   $variables['#attributes'] = $element['#attributes'];
   $variables['#options'] = form_select_options($element);
   $variables['#theme'] = 'select';
@@ -197,6 +206,7 @@ function theme_fivestar_select($variables) {
  *   The total number of stars this rating is out of.
  * @param $tag
  *   Allows multiple ratings per node.
+ *
  * @return
  *   A themed HTML string representing the star widget.
  */
@@ -261,6 +271,7 @@ function theme_fivestar_static($variables) {
  *   The total number of votes.
  * @param $stars
  *   The number of stars being displayed.
+ *
  * @return
  *   A themed HTML string representing the star widget.
  */
@@ -274,7 +285,7 @@ function theme_fivestar_summary($variables) {
   if (isset($user_rating)) {
     $div_class = isset($votes) ? 'user-count' : 'user';
     $user_stars = round(($user_rating * $stars) / 100, 1);
-    $output .= '<span class="user-rating">' . t('Your rating: <span>!stars</span>', array('!stars' => $user_rating ? $user_stars : t('None'))) . '</span>';
+    $output .= '<span class="user-rating">' . t('Your rating: <span>!stars</span>', ['!stars' => $user_rating ? $user_stars : t('None')]) . '</span>';
   }
   if (isset($user_rating) && isset($average_rating)) {
     $output .= ' ';
@@ -292,7 +303,7 @@ function theme_fivestar_summary($variables) {
       $average_rating_microdata = drupal_attributes($microdata['average_rating']['#attributes']);
     }
     $output .= '<span class="average-rating">' . t('Average: !stars',
-        array('!stars' => "<span $average_rating_microdata>$average_stars</span>")) . '</span>';
+        ['!stars' => "<span $average_rating_microdata>$average_stars</span>"]) . '</span>';
   }
 
   if (isset($votes)) {
@@ -308,9 +319,9 @@ function theme_fivestar_summary($variables) {
       }
       // We don't directly substitute $votes (i.e. use '@count') in format_plural,
       // because it has a span around it which is not translatable.
-      $votes_str = format_plural($votes, '!cnt vote', '!cnt votes', array(
-        '!cnt' => '<span ' . $rating_count_microdata . '>' . intval($votes) . '</span>'
-      ));
+      $votes_str = format_plural($votes, '!cnt vote', '!cnt votes', [
+        '!cnt' => '<span ' . $rating_count_microdata . '>' . intval($votes) . '</span>',
+      ]);
       if (isset($user_rating) || isset($average_rating)) {
         $output .= ' <span class="total-votes">(' . $votes_str . ')</span>';
       }
@@ -320,7 +331,6 @@ function theme_fivestar_summary($variables) {
     }
   }
 
-
   $output = '<div class="fivestar-summary fivestar-summary-' . $div_class . '">' . $output . '</div>';
   return $output;
 }
@@ -336,35 +346,34 @@ function theme_fivestar_static_element($variables) {
   else {
     $output .= '<div class="fivestar-static-form-item">';
   }
-  $element = array(
+  $element = [
     '#type' => 'item',
     '#title' => $variables['title'],
     '#description' => $variables['description'],
     '#children' => $variables['star_display'],
-  );
+  ];
 
-  $output .= theme('form_element', array('element' => $element));
+  $output .= theme('form_element', ['element' => $element]);
   $output .= '</div>';
   return $output;
 }
 
-
 /**
  * Show a preview of a widget using a custom CSS file.
  */
 function theme_fivestar_output_widget($variables) {
-  $form = array(
-    '#post' => array(),
+  $form = [
+    '#post' => [],
     '#programmed' => FALSE,
     '#tree' => FALSE,
-    '#parents' => array(),
-    '#array_parents' => array(),
+    '#parents' => [],
+    '#array_parents' => [],
     '#required' => FALSE,
-    '#attributes' => array(),
+    '#attributes' => [],
     '#title_display' => 'before',
-  );
+  ];
   $complete_form = [];
-  $form_state = new \Drupal\Core\Form\FormState();
+  $form_state = new FormState();
   $buidler = \Drupal::formBuilder();
   $form_state->setValues([]);
   $form_state->setProcessInput(FALSE);
@@ -388,4 +397,4 @@ function theme_fivestar_output_widget($variables) {
   $output['#suffix'] = '</div>';
 
   return \Drupal::service('renderer')->render($output);
-}
\ No newline at end of file
+}
diff --git a/src/Element/Fivestar.php b/src/Element/Fivestar.php
index 86e8c3b..ecf6e5c 100644
--- a/src/Element/Fivestar.php
+++ b/src/Element/Fivestar.php
@@ -22,40 +22,40 @@ class Fivestar extends FormElement {
    */
   public function getInfo() {
     $class = get_class($this);
-    return array(
+    return [
       '#input' => TRUE,
       '#stars' => 5,
       '#allow_clear' => FALSE,
       '#allow_revote' => FALSE,
       '#allow_ownvote' => FALSE,
       '#auto_submit' => FALSE,
-      '#process' => array(array($class, 'process')),
-      '#theme_wrappers' => array('form_element'),
-      '#widget' => array(
+      '#process' => [[$class, 'process']],
+      '#theme_wrappers' => ['form_element'],
+      '#widget' => [
         'name' => 'default',
         'css' => 'default',
-      ),
-      '#values' => array(
+      ],
+      '#values' => [
         'user' => 0,
         'average' => 0,
         'count' => 0,
-      ),
-      '#settings' => array(
+      ],
+      '#settings' => [
         'style' => 'user',
         'text' => 'none',
-      ),
-    );
+      ],
+    ];
   }
 
   /**
-   *  Process callback for fivestar element
+   * Process callback for fivestar element.
    */
   public static function process(&$element, FormStateInterface $form_state, &$complete_form) {
-    if (!self::isVoteAllowed($element)){
+    if (!self::isVoteAllowed($element)) {
       $element['#input'] = FALSE;
     }
 
-    // Add CSS and JS
+    // Add CSS and JS.
     $element['#attached']['library'][] = 'fivestar/fivestar.base';
     $settings = $element['#settings'];
     $values = $element['#values'];
@@ -65,23 +65,24 @@ class Fivestar extends FormElement {
     if (isset($element['#settings']['entity_id']) && isset($element['#settings']['entity_type'])) {
       $entity_id = $element['#settings']['entity_id'];
       $entity_manager = \Drupal::entityTypeManager();
-      $entity = $entity_manager->getStorage($element['#settings']['entity_type'])->load(array($entity_id));
+      $entity = $entity_manager->getStorage($element['#settings']['entity_type'])->load([$entity_id]);
       $entity = $entity[$entity_id];
       $title = $entity->title;
-    } elseif (isset($complete_form['#node'])) {
+    }
+    elseif (isset($complete_form['#node'])) {
       $title = $complete_form['#node']->title;
     }
-    $options = array('-' => t('Select rating'));
+    $options = ['-' => t('Select rating')];
     for ($i = 1; $i <= $element['#stars']; $i++) {
-      $this_value = ceil($i * 100/$element['#stars']);
-      $options[$this_value] = t('Give @title @star/@count', array('@title' => $title, '@star' => $i, '@count' => $element['#stars']));
+      $this_value = ceil($i * 100 / $element['#stars']);
+      $options[$this_value] = t('Give @title @star/@count', ['@title' => $title, '@star' => $i, '@count' => $element['#stars']]);
     }
     // Display clear button only if enabled.
     if ($element['#allow_clear'] == TRUE) {
       $options[0] = t('Cancel rating');
     }
 
-    $element['vote'] = array(
+    $element['vote'] = [
       '#type' => 'select',
       '#options' => $options,
       '#required' => $element['#required'],
@@ -89,7 +90,7 @@ class Fivestar extends FormElement {
       '#theme' => self::isVoteAllowed($element) ? 'select' /*'fivestar_select'*/ : 'fivestar_static',
       '#default_value' => self::getElementDefaultValue($element),
       '#weight' => -2,
-    );
+    ];
 
     if (isset($element['#parents'])) {
       $element['vote']['#parents'] = $element['#parents'];
@@ -97,49 +98,53 @@ class Fivestar extends FormElement {
 
     switch ($settings['text']) {
       case 'user':
-        $description = array(
+        $description = [
           '#type' => 'fivestar_summary',
           '#user_rating' => $values['user'],
           '#votes' => $settings['style'] == 'dual' ? NULL : $values['count'],
           '#stars' => $settings['stars'],
           '#microdata' => $settings['microdata'],
-        );
+        ];
         $element['vote']['#description'] = $description;
         $class[] = 'fivestar-user-text';
         break;
+
       case 'average':
-        $description = array(
+        $description = [
           '#type' => 'fivestar_summary',
           '#average_rating' => $values['average'],
           '#votes' => $values['count'],
           '#stars' => $settings['stars'],
           '#microdata' => $settings['microdata'],
-        );
+        ];
         $element['vote']['#description'] = $settings['style'] == 'dual' ? NULL : $description;
         $class[] = 'fivestar-average-text';
         break;
+
       case 'smart':
-        $element['vote']['#description'] = ($settings['style'] == 'dual' && !$values['user']) ? NULL : theme('fivestar_summary', array(
+        $element['vote']['#description'] = ($settings['style'] == 'dual' && !$values['user']) ? NULL : theme('fivestar_summary', [
           'user_rating' => $values['user'],
           'average_rating' => $values['user'] ? NULL : $values['average'],
           'votes' => $settings['style'] == 'dual' ? NULL : $values['count'],
           'stars' => $settings['stars'],
           'microdata' => $settings['microdata'],
-        ));
+        ]);
         $class[] = 'fivestar-smart-text';
         $class[] = $values['user'] ? 'fivestar-user-text' : 'fivestar-average-text';
         break;
+
       case 'dual':
-        $element['vote']['#description'] = array(
+        $element['vote']['#description'] = [
           '#type' => 'fivestar_summary',
           '#user_rating' => $values['user'],
           '#average_rating' => $settings['style'] == 'dual' ? NULL : $values['average'],
           '#votes' => $settings['style'] == 'dual' ? NULL : $values['count'],
           '#stars' => $settings['stars'],
           '#microdata' => $settings['microdata'],
-        );
+        ];
         $class[] = ' fivestar-combo-text';
         break;
+
       case 'none':
         $element['vote']['#description'] = NULL;
         break;
@@ -149,43 +154,46 @@ class Fivestar extends FormElement {
       case 'average':
         $class[] = 'fivestar-average-stars';
         break;
+
       case 'user':
         $class[] = 'fivestar-user-stars';
         break;
+
       case 'smart':
         $class[] = 'fivestar-smart-stars ' . ($values['user'] ? 'fivestar-user-stars' : 'fivestar-average-stars');
         break;
+
       case 'dual':
         $class[] = 'fivestar-combo-stars';
-        $static_average = array(
+        $static_average = [
           '#type' => 'fivestar_static',
           '#rating' => $values['average'],
           '#stars' => $settings['stars'],
           '#tag' => $settings['tag'],
           '#widget' => $settings['widget'],
-        );
+        ];
         if ($settings['text'] != 'none') {
-          $static_description = array(
+          $static_description = [
             '#type' => 'fivestar_summary',
             '#average_rating' => $settings['text'] == 'user' ? NULL : (isset($values['average']) ? $values['average'] : 0),
             '#votes' => isset($values['count']) ? $values['count'] : 0,
             '#stars' => $settings['stars'],
-          );
+          ];
         }
         else {
           $static_description = '&nbsp;';
         }
-        $element_static = array(
+        $element_static = [
           '#type' => 'fivestar_static_element',
           '#star_display' => $static_average,
           '#title' => '',
           '#description' => $static_description,
-        );
-        $element['average'] = array(
+        ];
+        $element['average'] = [
           '#type' => 'markup',
           '#markup' => $element_static,
           '#weight' => -1,
-        );
+        ];
         break;
     }
     $class[] = 'fivestar-form-item';
@@ -193,45 +201,44 @@ class Fivestar extends FormElement {
     if ($element['#widget']['name'] != 'default') {
       $element['#attached']['library'][] = "fivestar/fivestar.{$element['#widget']['name']}";
     }
-    $element['#prefix'] = '<div ' . new Attribute(array('class' => $class)) . '>';
+    $element['#prefix'] = '<div ' . new Attribute(['class' => $class]) . '>';
     $element['#suffix'] = '</div>';
 
     // Add AJAX handling if necessary.
     if (!empty($element['#auto_submit'])) {
-      $element['vote']['#ajax'] = array(
+      $element['vote']['#ajax'] = [
         'callback' => 'fivestar_ajax_submit',
-      );
+      ];
       $element['vote']['#attached']['library'][] = "fivestar/fivestar.ajax";
     }
 
     if (empty($element['#input'])) {
-      $static_stars = array(
+      $static_stars = [
         '#type' => 'fivestar_static',
         '#rating' => $element['vote']['#default_value'],
         '#stars' => $settings['stars'],
         '#tag' => $settings['tag'],
         '#widget' => $settings['widget'],
-      );
+      ];
 
-      $element_static = array(
+      $element_static = [
         '#type' => 'fivestar_static_element',
         '#star_display' => $static_stars,
         '#title' => '',
         '#description' => $element['vote']['#description'],
-      );
-      $element['vote'] = array(
+      ];
+      $element['vote'] = [
         '#type' => 'markup',
         '#markup' => $element_static,
-      );
+      ];
     }
 
     // Add validation function that considers a 0 value as empty.
-    $element['#element_validate'] = array('fivestar_validate');
+    $element['#element_validate'] = ['fivestar_validate'];
 
     return $element;
   }
 
-
   /**
    * Determines if a user can vote on content.
    *
@@ -254,7 +261,6 @@ class Fivestar extends FormElement {
         ->condition('user_id', isset($element['#settings']['content_id']) ? $element['#settings']['content_id'] : NULL)
         ->execute();
       // $votes = Drupal::entityManager()->getStorage('vote')->loadMultiple($vote_ids);
-
       $can_revote = !$vote_ids;
     }
     if (!$can_revote) {
@@ -269,14 +275,13 @@ class Fivestar extends FormElement {
       return TRUE;
     }
     $entity_id = $element['#settings']['entity_id'];
-    $entity = entity_load($element['#settings']['entity_type'], array($entity_id));
+    $entity = entity_load($element['#settings']['entity_type'], [$entity_id]);
     $entity = $entity[$entity_id];
     $uid1 = $entity->uid;
     $uid2 = $user->uid;
     return $entity->uid != $user->uid;
   }
 
-
   /**
    * Provides the correct default value for a fivestar element.
    *
@@ -295,23 +300,27 @@ class Fivestar extends FormElement {
         case 'average':
           $default_value = $element['#values']['average'];
           break;
+
         case 'user':
           $default_value = $element['#values']['user'];
           break;
+
         case 'smart':
           $default_value = (!empty($element['#values']['user']) ? $element['#values']['user'] : $element['#values']['average']);
           break;
+
         case 'dual':
           $default_value = $element['#values']['user'];
           break;
+
         default:
           $default_value = $element['#values']['average'];
       }
     }
 
     for ($i = 0; $i <= $element['#stars']; $i++) {
-      $this_value = ceil($i * 100/$element['#stars']);
-      $next_value = ceil(($i+1) * 100/$element['#stars']);
+      $this_value = ceil($i * 100 / $element['#stars']);
+      $next_value = ceil(($i + 1) * 100 / $element['#stars']);
 
       // Round up the default value to the next exact star value if needed.
       if ($this_value < $default_value && $next_value > $default_value) {
diff --git a/src/Plugin/Field/FieldFormatter/FiveStarFormatterBase.php b/src/Plugin/Field/FieldFormatter/FiveStarFormatterBase.php
index ddc14f9..ae17c0a 100644
--- a/src/Plugin/Field/FieldFormatter/FiveStarFormatterBase.php
+++ b/src/Plugin/Field/FieldFormatter/FiveStarFormatterBase.php
@@ -5,7 +5,9 @@ namespace Drupal\fivestar\Plugin\Field\FieldFormatter;
 use Drupal\Core\Field\FormatterBase;
 use Drupal\Core\Render\Element;
 
-
+/**
+ *
+ */
 abstract class FiveStarFormatterBase extends FormatterBase {
 
   /**
diff --git a/src/Plugin/Field/FieldFormatter/PercentageFormatter.php b/src/Plugin/Field/FieldFormatter/PercentageFormatter.php
index d150732..329c001 100644
--- a/src/Plugin/Field/FieldFormatter/PercentageFormatter.php
+++ b/src/Plugin/Field/FieldFormatter/PercentageFormatter.php
@@ -1,6 +1,7 @@
 <?php
 
 namespace Drupal\fivestar\Plugin\Field\FieldFormatter;
+
 use Drupal\Core\Field\FieldItemListInterface;
 
 /**
@@ -16,10 +17,13 @@ use Drupal\Core\Field\FieldItemListInterface;
  * )
  */
 class PercentageFormatter extends FiveStarFormatterBase {
+
+  /**
+   *
+   */
   public function viewElements(FieldItemListInterface $items, $langcode) {
     // TODO: Implement viewElements() method.
     return [];
   }
 
-
 }
diff --git a/src/Plugin/Field/FieldFormatter/RatingFormatter.php b/src/Plugin/Field/FieldFormatter/RatingFormatter.php
index c321eef..8d0101c 100644
--- a/src/Plugin/Field/FieldFormatter/RatingFormatter.php
+++ b/src/Plugin/Field/FieldFormatter/RatingFormatter.php
@@ -1,6 +1,7 @@
 <?php
 
 namespace Drupal\fivestar\Plugin\Field\FieldFormatter;
+
 use Drupal\Core\Field\FieldItemListInterface;
 
 /**
@@ -17,6 +18,9 @@ use Drupal\Core\Field\FieldItemListInterface;
  */
 class RatingFormatter extends FiveStarFormatterBase {
 
+  /**
+   *
+   */
   public function viewElements(FieldItemListInterface $items, $langcode) {
     // TODO: Implement viewElements() method.
     return [];
diff --git a/src/Plugin/Field/FieldFormatter/StarsFormatter.php b/src/Plugin/Field/FieldFormatter/StarsFormatter.php
index 7f5c103..088353c 100644
--- a/src/Plugin/Field/FieldFormatter/StarsFormatter.php
+++ b/src/Plugin/Field/FieldFormatter/StarsFormatter.php
@@ -29,6 +29,9 @@ class StarsFormatter extends FiveStarFormatterBase {
     ] + parent::defaultSettings();
   }
 
+  /**
+   *
+   */
   public function viewElements(FieldItemListInterface $items, $langcode) {
     $elements = [];
     $widgets = $this->getAllWidget();
@@ -41,11 +44,11 @@ class StarsFormatter extends FiveStarFormatterBase {
         'css' => $active,
       ];
       $settings = $item->getFieldDefinition()->getSettings();
-      $values = array(
+      $values = [
         'user' => 0,
         'average' => 0,
         'count' => 0,
-      );
+      ];
 
       $elements[$delta] = [
         '#theme' => 'fivestar_output_widget',
diff --git a/src/Plugin/Field/FieldType/FivestarItem.php b/src/Plugin/Field/FieldType/FivestarItem.php
index b806c85..c22ab00 100644
--- a/src/Plugin/Field/FieldType/FivestarItem.php
+++ b/src/Plugin/Field/FieldType/FivestarItem.php
@@ -2,7 +2,6 @@
 
 namespace Drupal\fivestar\Plugin\Field\FieldType;
 
-use Drupal\Component\Utility\Html;
 use Drupal\Core\Field\FieldItemBase;
 use Drupal\Core\Field\FieldStorageDefinitionInterface;
 use Drupal\Core\Language\Language;
@@ -32,21 +31,21 @@ class FivestarItem extends FieldItemBase {
    * {@inheritdoc}
    */
   public static function schema(FieldStorageDefinitionInterface $field_definition) {
-    return array(
-      'columns' => array(
-        'rating' => array(
+    return [
+      'columns' => [
+        'rating' => [
           'type' => 'int',
           'unsigned' => TRUE,
           'not null' => FALSE,
-          'sortable' => TRUE
-        ),
-        'target' => array(
+          'sortable' => TRUE,
+        ],
+        'target' => [
           'type' => 'int',
           'unsigned' => TRUE,
-          'not null' => FALSE
-        ),
-      ),
-    );
+          'not null' => FALSE,
+        ],
+      ],
+    ];
   }
 
   /**
@@ -63,20 +62,23 @@ class FivestarItem extends FieldItemBase {
    * @return array
    */
   public static function defaultFieldSettings() {
-    return array(
+    return [
       'stars' => 5,
       'allow_clear' => FALSE,
       'allow_revote' => TRUE,
       'allow_ownvote' => TRUE,
       'rated_while' => 'viewing',
       'target' => '',
-    ) + parent::defaultFieldSettings();
+    ] + parent::defaultFieldSettings();
   }
 
+  /**
+   *
+   */
   public static function defaultStorageSettings() {
-    return array(
+    return [
       'voting_tag' => 'vote',
-    ) + parent::defaultStorageSettings();
+    ] + parent::defaultStorageSettings();
   }
 
   /**
@@ -84,7 +86,7 @@ class FivestarItem extends FieldItemBase {
    */
   public function storageSettingsForm(array &$form, FormStateInterface $form_state, $has_data) {
     $element = [];
-    $element['voting_tag'] = array(
+    $element['voting_tag'] = [
       '#type' => 'select',
       '#required' => TRUE,
       '#title' => 'Voting Tag',
@@ -92,7 +94,7 @@ class FivestarItem extends FieldItemBase {
       '#description' => $this->t('The tag this rating will affect. Enter a property on which that this rating will affect, such as <em>quality</em>, <em>satisfaction</em>, <em>overall</em>, etc.'),
       '#default_value' => $this->getSetting('voting_tag'),
       '#disabled' => $has_data,
-    );
+    ];
 
     return $element;
   }
@@ -101,35 +103,35 @@ class FivestarItem extends FieldItemBase {
    * {@inheritdoc}
    */
   public function fieldSettingsForm(array $form, FormStateInterface $form_state) {
-    $element = array();
+    $element = [];
 
-    $element['stars'] = array(
+    $element['stars'] = [
       '#type' => 'select',
       '#title' => $this->t('Number of stars'),
       '#options' => array_combine(range(1, 10), range(1, 10)),
       '#default_value' => $this->getSetting('stars'),
-    );
+    ];
 
-    $element['allow_clear'] = array(
+    $element['allow_clear'] = [
       '#type' => 'checkbox',
       '#title' => $this->t('Allow users to cancel their ratings.'),
       '#default_value' => $this->getSetting('allow_clear'),
       '#return_value' => 1,
-    );
+    ];
 
-    $element['allow_revote'] = array(
+    $element['allow_revote'] = [
       '#type' => 'checkbox',
       '#title' => $this->t('Allow users to re-vote on already voted content.'),
       '#default_value' => $this->getSetting('allow_revote'),
       '#return_value' => 1,
-    );
+    ];
 
-    $element['allow_ownvote'] = array(
+    $element['allow_ownvote'] = [
       '#type' => 'checkbox',
       '#title' => $this->t('Allow users to vote on their own content.'),
       '#default_value' => $this->getSetting('allow_ownvote'),
       '#return_value' => 1,
-    );
+    ];
 
     $element['rated_while'] = [
       '#type' => 'radios',
@@ -141,20 +143,19 @@ class FivestarItem extends FieldItemBase {
       ],
     ];
 
-
     // FIXME: Vijay
-    // $options = $this->fivestar_get_targets($field, $instance);
-    $options = array();
-    $element['target'] = array(
+    // $options = $this->fivestar_get_targets($field, $instance);.
+    $options = [];
+    $element['target'] = [
       '#title' => $this->t('Voting target'),
       '#type' => 'select',
       // FIXME: Vijay
-      // '#default_value' => (isset($settings['target']) && $instance['widget']['type'] != 'exposed') ? $settings['target'] : 'none',
+      // '#default_value' => (isset($settings['target']) && $instance['widget']['type'] != 'exposed') ? $settings['target'] : 'none',.
       '#options' => $options,
       '#description' => $this->t('The voting target will make the value of this field cast a vote on another node. Use node reference fields module to create advanced reviews. Use the Parent Node Target when using fivestar with comments. More information available on the <a href="http://drupal.org/handbook/modules/fivestar">Fivestar handbook page</a>.'),
       // FIXME: Vijay
-      // '#access' => (count($options) > 1 && $instance['widget']['type'] != 'exposed'),
-    );
+      // '#access' => (count($options) > 1 && $instance['widget']['type'] != 'exposed'),.
+    ];
 
     return $element;
   }
@@ -174,16 +175,18 @@ class FivestarItem extends FieldItemBase {
    * {@inheritdoc}
    */
   public function postSave($update) {
-//    $this->fieldOperations();
+    // $this->fieldOperations();
   }
 
+  /**
+   *
+   */
   protected function fieldOperations($op = NULL) {
     $entity = $this->getEntity();
     $entity_type = $entity->getEntityType();
     $langcode = $this->getLangcode();
     // FIXME: Vijay
-    // return;
-
+    // return;.
     foreach ($items as $delta => $item) {
       if ((isset($entity->status) && !$entity->status) || $op == 'delete') {
         $rating = 0;
@@ -192,7 +195,7 @@ class FivestarItem extends FieldItemBase {
         $rating = (isset($items[$delta]['rating'])) ? $items[$delta]['rating'] : 0;
       }
       // FIXME: Vijay
-      // $target = $this->_fivestar_field_target($entity, $field, $instance, $langcode);
+      // $target = $this->_fivestar_field_target($entity, $field, $instance, $langcode);.
       if (!empty($target)) {
         if ($entity_type == 'comment' && $op == 'delete') {
           $target['vote_source'] = $entity->hostname;
@@ -202,7 +205,7 @@ class FivestarItem extends FieldItemBase {
         }
         // FIXME: Vijay
         // _fivestar_cast_vote($target['entity_type'], $target['entity_id'], $rating, $field['settings']['axis'], $entity->uid, TRUE, $target['vote_source']);
-        // votingapi_recalculate_results($target['entity_type'], $target['entity_id']);
+        // votingapi_recalculate_results($target['entity_type'], $target['entity_id']);.
       }
       // The original callback is only called for a single updated field, but the Field API
       // then updates all fields of the entity. For an update, the Field API first deletes
@@ -223,13 +226,13 @@ class FivestarItem extends FieldItemBase {
    * {@inheritdoc}
    */
   public function delete() {
-//    $this->fieldOperations('delete');
+    // $this->fieldOperations('delete');.
   }
 
   /**
    * Helper function to find the id that should be rated when a field is changed.
    */
-  function _fivestar_field_target($entity, $field, $instance, $langcode) {
+  public function _fivestar_field_target($entity, $field, $instance, $langcode) {
     if ($instance['widget']['type'] == 'exposed') {
       return NULL;
     }
@@ -237,19 +240,21 @@ class FivestarItem extends FieldItemBase {
       $target = $this->fivestar_get_targets($field, $instance, $instance['settings']['target'], $entity, $langcode);
     }
     else {
-      $target = array(
+      $target = [
         'entity_id' => $entity->id(),
         'entity_type' => $instance['entity_type'],
-      );
+      ];
     }
     return $target;
   }
 
-
-  function fivestar_get_targets($field, $instance, $key = FALSE, $entity = FALSE, $langcode = Language::LANGCODE_NOT_SPECIFIED) {
-    $options = array();
+  /**
+   *
+   */
+  public function fivestar_get_targets($field, $instance, $key = FALSE, $entity = FALSE, $langcode = Language::LANGCODE_NOT_SPECIFIED) {
+    $options = [];
     $targets = \Drupal::moduleHandler()
-      ->invokeAll('fivestar_target_info', array($field, $instance));
+      ->invokeAll('fivestar_target_info', [$field, $instance]);
     if ($key == FALSE) {
       foreach ($targets as $target => $info) {
         $options[$target] = $info['title'];
diff --git a/src/Plugin/Field/FieldWidget/FiveStartWidgetBase.php b/src/Plugin/Field/FieldWidget/FiveStartWidgetBase.php
index c6bdb71..4759575 100644
--- a/src/Plugin/Field/FieldWidget/FiveStartWidgetBase.php
+++ b/src/Plugin/Field/FieldWidget/FiveStartWidgetBase.php
@@ -5,7 +5,8 @@ namespace Drupal\fivestar\Plugin\Field\FieldWidget;
 use Drupal\Core\Field\WidgetBase;
 
 /**
- * Class FiveStartWidgetBase
+ * Class FiveStartWidgetBase.
+ *
  * @package Drupal\fivestar\Plugin\Field\FieldWidget
  */
 abstract class FiveStartWidgetBase extends WidgetBase {
diff --git a/src/Plugin/Field/FieldWidget/SelectWidget.php b/src/Plugin/Field/FieldWidget/SelectWidget.php
index 62703ff..5c130ca 100644
--- a/src/Plugin/Field/FieldWidget/SelectWidget.php
+++ b/src/Plugin/Field/FieldWidget/SelectWidget.php
@@ -2,8 +2,6 @@
 
 namespace Drupal\fivestar\Plugin\Field\FieldWidget;
 
-use Drupal\Component\Utility\SafeMarkup;
-use Drupal\Component\Utility\Html;
 use Drupal\Core\Field\FieldItemListInterface;
 use Drupal\Core\Form\FormStateInterface;
 
@@ -32,7 +30,7 @@ class SelectWidget extends FiveStartWidgetBase {
       $this_value = ceil($i * 100 / $settings['stars']);
       $options[$this_value] = $this->t('Give @star/@count', [
         '@star' => $i,
-        '@count' => $settings['stars']
+        '@count' => $settings['stars'],
       ]);
     }
 
@@ -40,14 +38,14 @@ class SelectWidget extends FiveStartWidgetBase {
       '#type' => 'item',
     ];
 
-    $element['rating'] = array(
+    $element['rating'] = [
       '#type' => 'select',
       '#empty_option' => $this->t('Select rating:'),
       '#empty_value' => '-',
       '#options' => $options,
       '#required' => $items[$delta]->getFieldDefinition()->isRequired(),
       '#default_value' => isset($items[$delta]->rating) ? $items[$delta]->rating : 0,
-    );
+    ];
 
     return $element;
   }
diff --git a/src/Plugin/Field/FieldWidget/StarsWidget.php b/src/Plugin/Field/FieldWidget/StarsWidget.php
index 7861df9..ef17c6e 100644
--- a/src/Plugin/Field/FieldWidget/StarsWidget.php
+++ b/src/Plugin/Field/FieldWidget/StarsWidget.php
@@ -2,7 +2,6 @@
 
 namespace Drupal\fivestar\Plugin\Field\FieldWidget;
 
-use Drupal\Component\Utility\Html;
 use Drupal\Core\Field\FieldItemListInterface;
 use Drupal\Core\Form\FormStateInterface;
 use Drupal\Core\Render\Element;
@@ -20,6 +19,7 @@ use Drupal\Component\Utility\Unicode;
  * )
  */
 class StarsWidget extends FiveStartWidgetBase {
+
   /**
    * {@inheritdoc}
    */
@@ -45,6 +45,9 @@ class StarsWidget extends FiveStartWidgetBase {
     return $elements;
   }
 
+  /**
+   *
+   */
   public function previewsExpand(array $element) {
     foreach (Element::children($element) as $css) {
       $vars = [
@@ -64,19 +67,19 @@ class StarsWidget extends FiveStartWidgetBase {
   public function formElement(FieldItemListInterface $items, $delta, array $element, array &$form, FormStateInterface $form_state) {
     $widgets = $this->getAllWidget();
     $active = $this->getSetting('fivestar_widget');
-    $widget = array(
+    $widget = [
       'name' => isset($widgets[$active]) ? Unicode::strtolower($widgets[$active]) : 'default',
       'css' => $active,
-    );
+    ];
 
-    $values = array(
+    $values = [
       'user' => 0,
       'average' => 0,
       'count' => 0,
-    );
+    ];
 
     $settings = $items[$delta]->getFieldDefinition()
-        ->getSettings() + [
+      ->getSettings() + [
         'text' => 'none',
         'style' => 'user',
       ];
@@ -85,7 +88,7 @@ class StarsWidget extends FiveStartWidgetBase {
       '#type' => 'item',
     ];
 
-    $element['rating'] = array(
+    $element['rating'] = [
       '#type' => 'fivestar',
       '#stars' => $settings['stars'],
       '#allow_clear' => $settings['allow_clear'],
@@ -95,7 +98,7 @@ class StarsWidget extends FiveStartWidgetBase {
       '#widget' => $widget,
       '#settings' => $settings,
       '#values' => $values,
-    );
+    ];
     return $element;
   }
 
diff --git a/test/fivestar.base.test b/test/fivestar.base.test
index fb95f3b..95cee23 100644
--- a/test/fivestar.base.test
+++ b/test/fivestar.base.test
@@ -1,25 +1,36 @@
 <?php
+
 /**
  * @file
  * Based test file for the Fivestar module.
  */
 
+/**
+ *
+ */
 class FivestarBaseTestCase extends AJAXTestCase {
   // Using testing profile.
-  // @see http://groups.drupal.org/node/217189
+  /**
+   * @see http://groups.drupal.org/node/217189
+   */
   protected $profile = 'testing';
 
-  // Set up our basic users.
+  /**
+   * Set up our basic users.
+   */
   protected $admin_user;
   protected $voter;
-  
+
+  /**
+   *
+   */
   public function setUp() {
-    parent::setUp(array('fivestar', 'dblog'));
+    parent::setUp(['fivestar', 'dblog']);
 
-    $type = $this->drupalCreateContentType(array('type' => 'test_node_type', 'name' => 'test_node_type'));
-    $this->admin_user = $this->drupalCreateUser(array('create test_node_type content', 'rate content'));
-    $this->voter_user = $this->drupalCreateUser(array('rate content'));
- }
+    $type = $this->drupalCreateContentType(['type' => 'test_node_type', 'name' => 'test_node_type']);
+    $this->admin_user = $this->drupalCreateUser(['create test_node_type content', 'rate content']);
+    $this->voter_user = $this->drupalCreateUser(['rate content']);
+  }
 
   /**
    * Add a fivestar field to a content type.
@@ -27,41 +38,42 @@ class FivestarBaseTestCase extends AJAXTestCase {
    * @param $options
    *   An associative array of options for the field and instance.
    */
-  public function createFivestarField($options = array()) {
-    $options = $options + array(
+  public function createFivestarField($options = []) {
+    $options = $options + [
       'content_type' => 'test_node_type',
       'widget_type' => 'stars',
-      'display' => array(),
-    );
-    $field = array(
+      'display' => [],
+    ];
+    $field = [
       'field_name' => 'fivestar_test',
       'type' => 'fivestar',
       'cardinality' => 1,
-      'settings' => array(
+      'settings' => [
         'axis' => 'vote',
-      ),
-    );
-    $instance = array(
+      ],
+    ];
+    $instance = [
       'entity_type' => 'node',
       'field_name' => 'fivestar_test',
       'label' => 'Fivestar test field',
       'bundle' => $options['content_type'],
-      'widget' => array(
+      'widget' => [
         'type' => $options['widget_type'],
-        'settings' => array(
-          'widget' => array(
+        'settings' => [
+          'widget' => [
             'fivestar_widget' => 'default',
-          ),
-        ),
-      ),
-      'settings' => array(
+          ],
+        ],
+      ],
+      'settings' => [
         'axis' => 'vote',
         'stars' => '5',
-      ),
+      ],
       'display' => $options['display'],
-    );
+    ];
 
     field_create_field($field);
     field_create_instance($instance);
   }
+
 }
diff --git a/test/fivestar.field.test b/test/fivestar.field.test
index f183ed9..593ae6a 100644
--- a/test/fivestar.field.test
+++ b/test/fivestar.field.test
@@ -1,17 +1,24 @@
 <?php
+
 /**
  * @file
  * Simpletests for the Fivestar module.
  */
 
+/**
+ *
+ */
 class FivestarTestCase extends FivestarBaseTestCase {
 
+  /**
+   *
+   */
   public static function getInfo() {
-    return array(
+    return [
       'name' => 'Fivestar widgets',
       'description' => 'Make sure fivestar widgets can be created and used.',
       'group' => 'Fivestar',
-    );
+    ];
   }
 
   /**
@@ -20,16 +27,17 @@ class FivestarTestCase extends FivestarBaseTestCase {
   public function testAuthorRating() {
     $this->drupalLogin($this->admin_user);
     // Add an author-rated fivestar field to the test_node_type content type.
-    $this->createFivestarField(array('widget_type' => 'stars'));
+    $this->createFivestarField(['widget_type' => 'stars']);
     // Load the instance settings so we can set allow_ownvote.
     $instance = field_read_instance('node', 'fivestar_test', 'test_node_type');
     $instance['settings']['allow_ownvote'] = 1;
     field_update_instance($instance);
     // Save an test_node_typee node with a two-star rating.
-    $edit = array(
+    $edit = [
       'title' => $this->randomString(),
-      'fivestar_test[und][0][rating]' => '40' // Equals a rating of 2 stars.
-    );
+    // Equals a rating of 2 stars.
+      'fivestar_test[und][0][rating]' => '40',
+    ];
     $this->drupalPost('node/add/test_node_type', $edit, t('Save'));
     // Make sure the two-star rating shows on the node view.
     $result = $this->xpath("//div[contains(@class, 'field-name-fivestar-test')]//div[contains(@class,'star-first')]/span");
@@ -40,16 +48,16 @@ class FivestarTestCase extends FivestarBaseTestCase {
    * Test that users can rate content with exposed widgets.
    */
   public function testViewerRating() {
-    $this->createFivestarField(array('widget_type' => 'exposed'));
+    $this->createFivestarField(['widget_type' => 'exposed']);
     // Add an test_node_type to rate.
-    $node = $this->drupalCreateNode(array('type' => 'test_node_type'));
+    $node = $this->drupalCreateNode(['type' => 'test_node_type']);
     $this->drupalGet('node/' . $node->nid);
     $this->drupalLogin($this->voter_user);
 
     // Rate the test_node_type.
-    $edit = array(
+    $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.');
 
@@ -89,21 +97,21 @@ class FivestarTestCase extends FivestarBaseTestCase {
    */
   public function testViewerNonRating() {
     // Add an exposed field, with the Exposed display settings set to FALSE.
-    $this->createFivestarField(array(
+    $this->createFivestarField([
       'widget_type' => 'exposed',
-      'display' => array(
-        'default' => array(
+      'display' => [
+        'default' => [
           'type' => 'fivestar_formatter_default',
-          'settings' => array(
+          'settings' => [
             'style' => 'average',
             'text' => 'average',
             'expose' => FALSE,
-          ),
-        ),
-      ),
-    ));
+          ],
+        ],
+      ],
+    ]);
     // Add an test_node_type to test static widget.
-    $node = $this->drupalCreateNode(array('type' => 'test_node_type'));
+    $node = $this->drupalCreateNode(['type' => 'test_node_type']);
     // Rate the test_node_type.
     $this->drupalLogin($this->voter_user);
     $this->drupalGet('node/' . $node->nid);
@@ -116,20 +124,20 @@ class FivestarTestCase extends FivestarBaseTestCase {
    */
   public function testViewerRatingAjax() {
     // Add a viewer-rated fivestar field to the test_node_type content type.
-    $this->createFivestarField(array('widget_type' => 'exposed'));
+    $this->createFivestarField(['widget_type' => 'exposed']);
     // Add an test_node_type to rate.
-    $node = $this->drupalCreateNode(array('type' => 'test_node_type'));
+    $node = $this->drupalCreateNode(['type' => 'test_node_type']);
     // Rate the test_node_type.
     $this->drupalLogin($this->voter_user);
-    $edit = array(
+    $edit = [
       'vote' => '60',
-    );
+    ];
     $commands = $this->drupalPostAJAX('node/' . $node->nid, $edit, "vote",
-      NULL, array(), array(), "fivestar-custom-widget");
-    $expected = array(
+      NULL, [], [], "fivestar-custom-widget");
+    $expected = [
       'command' => 'fivestarUpdate',
       // TODO: we should text the data being returned.
-    );
+    ];
     $this->assertCommand($commands, $expected, "The fivestarUpdate AJAX command was returned.");
   }
 
@@ -140,22 +148,22 @@ class FivestarTestCase extends FivestarBaseTestCase {
   public function testExposedWidgetDisplay() {
     // Lets add an exposed widget but display the static widget.
     // It's simpler to compare the display type using the static widget.
-    $this->createFivestarField(array(
+    $this->createFivestarField([
       'widget_type' => 'exposed',
-      'display' => array(
-        'default' => array(
+      'display' => [
+        'default' => [
           'type' => 'fivestar_formatter_default',
-          'settings' => array(
+          'settings' => [
             'style' => 'average',
             'text' => 'average',
             'expose' => FALSE,
-          ),
-        ),
-      ),
-    ));
+          ],
+        ],
+      ],
+    ]);
     $instance = field_read_instance('node', 'fivestar_test', 'test_node_type');
     // Add an test_node_type to test widget against.
-    $node = $this->drupalCreateNode(array('type' => 'test_node_type'));
+    $node = $this->drupalCreateNode(['type' => 'test_node_type']);
 
     // Test the Default Widget.
     $this->drupalGet('node/' . $node->nid);
@@ -168,7 +176,8 @@ 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.', array('@name' => $name)));
+      $this->assertEqual($result[0][0], '0', t('The @name fivestar widget is properly display.', ['@name' => $name]));
     }
   }
+
 }
diff --git a/widgets/basic/basic-rtl.css b/widgets/basic/basic-rtl.css
index a9f5de6..7205a5d 100755
--- a/widgets/basic/basic-rtl.css
+++ b/widgets/basic/basic-rtl.css
@@ -8,4 +8,4 @@
 .fivestar-basic div.fivestar-widget div.hover a,
 .fivestar-basic div.rating div a:hover {
   background-position: right -32px;
-}
\ No newline at end of file
+}
diff --git a/widgets/basic/basic.css b/widgets/basic/basic.css
index 093e8ae..c17fd8f 100755
--- a/widgets/basic/basic.css
+++ b/widgets/basic/basic.css
@@ -24,4 +24,4 @@
 .fivestar-basic div.fivestar-widget div.hover a,
 .fivestar-basic div.rating div a:hover {
   background-image: url(star.png);
-}
\ No newline at end of file
+}
diff --git a/widgets/craft/craft.css b/widgets/craft/craft.css
index 3204d92..974a8aa 100644
--- a/widgets/craft/craft.css
+++ b/widgets/craft/craft.css
@@ -150,4 +150,4 @@ div.rating div a:hover {
   width: 9px;
   height: 31px;
   background-position: 0 -31px;
-}
\ No newline at end of file
+}
diff --git a/widgets/drupal/drupal.txt b/widgets/drupal/drupal.txt
index ed1dbdd..3edb829 100644
--- a/widgets/drupal/drupal.txt
+++ b/widgets/drupal/drupal.txt
@@ -28,4 +28,4 @@ div.fivestar-widget div.on a {
 }
 div.fivestar-widget div.hover a, div.rating div a:hover {
   background-position: 0 -32px;
-}
\ No newline at end of file
+}
diff --git a/widgets/flames/flames-rtl.css b/widgets/flames/flames-rtl.css
index 22297a8..225139f 100755
--- a/widgets/flames/flames-rtl.css
+++ b/widgets/flames/flames-rtl.css
@@ -16,4 +16,4 @@
 .fivestar-flames div.fivestar-widget div.hover a,
 .fivestar-flames div.rating div a:hover {
   background-position: right -52px;
-}
\ No newline at end of file
+}
diff --git a/widgets/flames/flames.css b/widgets/flames/flames.css
index ab52da1..fa39778 100644
--- a/widgets/flames/flames.css
+++ b/widgets/flames/flames.css
@@ -35,4 +35,4 @@
 .fivestar-flames div.fivestar-widget div.hover a,
 .fivestar-flames div.rating div a:hover {
   background-position: 0 -52px;
-}
\ No newline at end of file
+}
diff --git a/widgets/hearts/hearts.css b/widgets/hearts/hearts.css
index d24161c..1806c18 100644
--- a/widgets/hearts/hearts.css
+++ b/widgets/hearts/hearts.css
@@ -35,4 +35,4 @@
 .fivestar-hearts div.fivestar-widget div.hover a,
 .fivestar-hearts div.rating div a:hover {
   background-position: 0 -32px;
-}
\ No newline at end of file
+}
diff --git a/widgets/lullabot/lullabot.txt b/widgets/lullabot/lullabot.txt
index 21767db..4228764 100644
--- a/widgets/lullabot/lullabot.txt
+++ b/widgets/lullabot/lullabot.txt
@@ -28,4 +28,4 @@ div.fivestar-widget div.on a {
 }
 div.fivestar-widget div.hover a, div.rating div a:hover {
   background-position: 0 -32px;
-}
\ No newline at end of file
+}
diff --git a/widgets/minimal/minimal.css b/widgets/minimal/minimal.css
index 5850995..4e1ff88 100644
--- a/widgets/minimal/minimal.css
+++ b/widgets/minimal/minimal.css
@@ -35,4 +35,4 @@
 .fivestar-minimal div.fivestar-widget div.hover a,
 .fivestar-minimal div.rating div a:hover {
   background-position: 0 -32px;
-}
\ No newline at end of file
+}
diff --git a/widgets/outline/outline-rtl.css b/widgets/outline/outline-rtl.css
index b08c511..c0edae6 100755
--- a/widgets/outline/outline-rtl.css
+++ b/widgets/outline/outline-rtl.css
@@ -8,4 +8,4 @@
 .fivestar-outline div.fivestar-widget div.hover a,
 .fivestar-outline div.rating div a:hover {
   background-position: right -28px;
-}
\ No newline at end of file
+}
diff --git a/widgets/outline/outline.css b/widgets/outline/outline.css
index f8bda7e..67bc870 100755
--- a/widgets/outline/outline.css
+++ b/widgets/outline/outline.css
@@ -35,4 +35,4 @@
 .fivestar-outline div.fivestar-widget div.hover a,
 .fivestar-outlinediv.rating div a:hover {
   background-position: 0 -28px;
-}
\ No newline at end of file
+}
diff --git a/widgets/small/small.css b/widgets/small/small.css
index 127eb3a..416ef73 100644
--- a/widgets/small/small.css
+++ b/widgets/small/small.css
@@ -35,4 +35,4 @@
 .fivestar-small div.fivestar-widget div.hover a,
 .fivestar-small div.rating div a:hover {
   background-position: 0 -32px;
-}
\ No newline at end of file
+}
