$form_state->setValue() doesn't save value
If it is a custom variable, you should use $form_state-&gt;set('property_name', 'value') (instead of "$form_state-&gt;setValue(...)").

Example:

public function validateForm(array &amp;$form, FormStateInterface $form_state) {
    parent::validateForm($form, $form_state);

    // Update custom variable (in PHP "null + 1" equals one)
    $form_state-&gt;set('my_variable', $form_state-&gt;get('my_variable') + 1);

    // Below is only required when your "buildForm(...)" depends on the variable
    $form_state-&gt;setRebuild();
}