Skip to content

Commit

Permalink
help psalm understand the code
Browse files Browse the repository at this point in the history
  • Loading branch information
m-vo committed Feb 3, 2022
1 parent 6151e00 commit 4f2d675
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/Controller/SurveyFragment.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
use Mvo\ContaoSurvey\Form\SurveyManagerFactory;
use Mvo\ContaoSurvey\Registry;
use Mvo\ContaoSurvey\Repository\SurveyRepository;
use Symfony\Component\Form\SubmitButton;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
Expand Down Expand Up @@ -127,14 +128,20 @@ private function proceedUntilCompleted(SurveyManager $manager): bool
}

// reset (back to the first step)
if ($manager->form['reset']->isClicked()) {
/** @var SubmitButton $resetButton */
$resetButton = $manager->form['reset'];

if ($resetButton->isClicked()) {
$manager->reset();

return false;
}

// back to the previous step
if (isset($manager->form['previous']) && $manager->form['previous']->isClicked() && $manager->previousStep()) {
/** @var SubmitButton|null $backButton */
$backButton = $manager->form['previous'] ?? null;

if ($backButton && $backButton->isClicked() && $manager->previousStep()) {
return false;
}

Expand Down

0 comments on commit 4f2d675

Please sign in to comment.