diff --git a/src/Form/BaseRatingForm.php b/src/Form/BaseRatingForm.php
index f72d77558cda609e80f1e3c7282c547e94443d08..9a150fd1926119b497f8e6124477cc34581daff3 100644
--- a/src/Form/BaseRatingForm.php
+++ b/src/Form/BaseRatingForm.php
@@ -85,9 +85,9 @@ class BaseRatingForm extends ContentEntityForm {
       '#options' => $options,
       '#attributes' => [
         'autocomplete' => 'off',
-        'data-result-value' => ($this->getResults($result_function)) ? $this->getResults($result_function) : -1,
-        'data-vote-value' => ($entity->getValue()) ? $entity->getValue() : (($this->getResults($result_function)) ? $this->getResults($result_function) : -1),
-        'data-style' => ($settings['style']) ? $settings['style'] : 'default',
+        'data-result-value' => $this->getResults($result_function) ?? -1,
+        'data-vote-value' => (int) $entity->getValue(),
+        'data-style' => $settings['style'] ?? 'default',
       ],
     ];
 
@@ -96,6 +96,7 @@ class BaseRatingForm extends ContentEntityForm {
 
     if (!$settings['show_own_vote']) {
       $form['value']['#attributes']['data-show-own-vote'] = 'false';
+      $form['value']['#attributes']['data-vote-value'] = $this->getResults($result_function) ?? -1;
       $form['value']['#default_value'] = $this->getResults($result_function);
     }
 
@@ -138,7 +139,7 @@ class BaseRatingForm extends ContentEntityForm {
    */
   protected function getResultFunction(FormStateInterface $form_state) {
     $entity = $this->getEntity();
-    return ($form_state->get('resultfunction')) ? $form_state->get('resultfunction') : 'vote_field_average:' . $entity->getVotedEntityType() . '.' . $entity->field_name->value;
+    return $form_state->get('resultfunction') ?? 'vote_field_average:' . $entity->getVotedEntityType() . '.' . $entity->field_name->value;
   }
 
   /**