[TOOLS] Fix all level 0 errors found by PHPStan and move constant definition to bootstrap file

This commit is contained in:
2021-09-06 19:49:03 +01:00
parent 0eb0236feb
commit eb833b62e2
33 changed files with 312 additions and 285 deletions

View File

@@ -22,13 +22,14 @@
namespace Plugin\Poll\Controller;
use App\Core\DB\DB;
use App\Entity\Poll;
use App\Entity\PollResponse;
use App\Core\Form;
use App\Util\Common;
use App\Util\Exception\InvalidFormException;
use App\Util\Exception\NotFoundException;
use App\Util\Exception\RedirectException;
use App\Util\Exception\ServerException;
use Plugin\Poll\Entity\Poll;
use Plugin\Poll\Entity\PollResponse;
use Plugin\Poll\Forms\PollResponseForm;
use Symfony\Component\HttpFoundation\Request;
@@ -62,14 +63,14 @@ class AnswerPoll
{
$user = Common::ensureLoggedIn();
$poll = Poll::getFromId((int) $id);
$poll = Poll::getWithPk((int) $id);
if ($poll == null) {
throw new NotFoundException('Poll does not exist');
}
$question = $poll->getQuestion();
$opts = $poll->getOptionsArr();
$form = PollResponseForm::make($poll, $poll->getNoteId());
$form = Form::create([]); //PollResponseForm::make($poll, $poll->getNoteId());
$form->handleRequest($request);
if ($form->isSubmitted()) {
if ($form->isValid()) {