Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
110 changes: 28 additions & 82 deletions phpstan-baseline.php
Original file line number Diff line number Diff line change
Expand Up @@ -3530,7 +3530,7 @@
'path' => __DIR__ . '/sources/AppBundle/Controller/Admin/Event/Ticket/IndexAction.php',
];
$ignoreErrors[] = [
'message' => '#^Parameter \\#1 \\$eventId of method AppBundle\\\\Event\\\\Model\\\\Repository\\\\VoteRepository\\:\\:getVotesByEvent\\(\\) expects int, int\\|null given\\.$#',
'message' => '#^Parameter \\#1 \\$eventId of method AppBundle\\\\Event\\\\Entity\\\\Repository\\\\VoteRepository\\:\\:getVotesByEvent\\(\\) expects int, int\\|null given\\.$#',
'identifier' => 'argument.type',
'count' => 1,
'path' => __DIR__ . '/sources/AppBundle/Controller/Admin/Event/VotesListeAction.php',
Expand Down Expand Up @@ -4357,12 +4357,6 @@
'count' => 2,
'path' => __DIR__ . '/sources/AppBundle/Controller/Event/Event/ShowAction.php',
];
$ignoreErrors[] = [
'message' => '#^Cannot access offset \'votes\' on mixed\\.$#',
'identifier' => 'offsetAccess.nonOffsetAccessible',
'count' => 2,
'path' => __DIR__ . '/sources/AppBundle/Controller/Event/Event/ShowAction.php',
];
$ignoreErrors[] = [
'message' => '#^Cannot call method getPath\\(\\) on mixed\\.$#',
'identifier' => 'method.nonObject',
Expand Down Expand Up @@ -4700,38 +4694,38 @@
'path' => __DIR__ . '/sources/AppBundle/Controller/Event/Vote/IndexAction.php',
];
$ignoreErrors[] = [
'message' => '#^Parameter \\#3 \\$vote of method AppBundle\\\\Controller\\\\Event\\\\Vote\\\\VoteController\\:\\:createVoteForm\\(\\) expects AppBundle\\\\Event\\\\Model\\\\Vote, mixed given\\.$#',
'message' => '#^Parameter \\#3 \\$vote of method AppBundle\\\\Controller\\\\Event\\\\Vote\\\\VoteController\\:\\:createVoteForm\\(\\) expects AppBundle\\\\Event\\\\Entity\\\\Vote, mixed given\\.$#',
'identifier' => 'argument.type',
'count' => 1,
'path' => __DIR__ . '/sources/AppBundle/Controller/Event/Vote/IndexAction.php',
];
$ignoreErrors[] = [
'message' => '#^Cannot call method setSubmittedOn\\(\\) on mixed\\.$#',
'identifier' => 'method.nonObject',
'message' => '#^Cannot access property \\$submittedOn on mixed\\.$#',
'identifier' => 'property.nonObject',
'count' => 1,
'path' => __DIR__ . '/sources/AppBundle/Controller/Event/Vote/NewAction.php',
];
$ignoreErrors[] = [
'message' => '#^Cannot call method setTalk\\(\\) on mixed\\.$#',
'identifier' => 'method.nonObject',
'message' => '#^Cannot access property \\$talk on mixed\\.$#',
'identifier' => 'property.nonObject',
'count' => 1,
'path' => __DIR__ . '/sources/AppBundle/Controller/Event/Vote/NewAction.php',
];
$ignoreErrors[] = [
'message' => '#^Parameter \\#1 \\$user of method AppBundle\\\\Event\\\\Model\\\\Vote\\:\\:setUser\\(\\) expects int, int\\|null given\\.$#',
'message' => '#^Parameter \\#1 \\$vote of method AppBundle\\\\Event\\\\Entity\\\\Repository\\\\VoteRepository\\:\\:upsert\\(\\) expects AppBundle\\\\Event\\\\Entity\\\\Vote, mixed given\\.$#',
'identifier' => 'argument.type',
'count' => 1,
'path' => __DIR__ . '/sources/AppBundle/Controller/Event/Vote/NewAction.php',
];
$ignoreErrors[] = [
'message' => '#^Parameter \\#1 \\$vote of method AppBundle\\\\Event\\\\Model\\\\Repository\\\\VoteRepository\\:\\:upsert\\(\\) expects AppBundle\\\\Event\\\\Model\\\\Vote, mixed given\\.$#',
'message' => '#^Parameter \\#1 \\$vote of method AppBundle\\\\Notifier\\\\SlackNotifier\\:\\:notifyVote\\(\\) expects AppBundle\\\\Event\\\\Entity\\\\Vote, mixed given\\.$#',
'identifier' => 'argument.type',
'count' => 1,
'path' => __DIR__ . '/sources/AppBundle/Controller/Event/Vote/NewAction.php',
];
$ignoreErrors[] = [
'message' => '#^Parameter \\#1 \\$vote of method AppBundle\\\\Notifier\\\\SlackNotifier\\:\\:notifyVote\\(\\) expects AppBundle\\\\Event\\\\Model\\\\Vote, mixed given\\.$#',
'identifier' => 'argument.type',
'message' => '#^Property AppBundle\\\\Event\\\\Entity\\\\Vote\\:\\:\\$userId \\(int\\) does not accept int\\|null\\.$#',
'identifier' => 'assign.propertyType',
'count' => 1,
'path' => __DIR__ . '/sources/AppBundle/Controller/Event/Vote/NewAction.php',
];
Expand Down Expand Up @@ -5299,6 +5293,18 @@
'count' => 1,
'path' => __DIR__ . '/sources/AppBundle/Email/Mailer/Mailer.php',
];
$ignoreErrors[] = [
'message' => '#^Cannot cast mixed to int\\.$#',
'identifier' => 'cast.int',
'count' => 7,
'path' => __DIR__ . '/sources/AppBundle/Event/Entity/Repository/VoteRepository.php',
];
$ignoreErrors[] = [
'message' => '#^Parameter \\#1 \\$datetime of class DateTimeImmutable constructor expects string, mixed given\\.$#',
'identifier' => 'argument.type',
'count' => 1,
'path' => __DIR__ . '/sources/AppBundle/Event/Entity/Repository/VoteRepository.php',
];
$ignoreErrors[] = [
'message' => '#^Class AppBundle\\\\Event\\\\Form\\\\EventCFPTextType extends generic class Symfony\\\\Component\\\\Form\\\\AbstractType but does not specify its types\\: TData$#',
'identifier' => 'missingType.generics',
Expand Down Expand Up @@ -7261,60 +7267,6 @@
'count' => 1,
'path' => __DIR__ . '/sources/AppBundle/Event/Model/Repository/UserBadgeRepository.php',
];
$ignoreErrors[] = [
'message' => '#^Cannot cast mixed to int\\.$#',
'identifier' => 'cast.int',
'count' => 1,
'path' => __DIR__ . '/sources/AppBundle/Event/Model/Repository/VoteRepository.php',
];
$ignoreErrors[] = [
'message' => '#^Method AppBundle\\\\Event\\\\Model\\\\Repository\\\\VoteRepository\\:\\:getNumberOfVotesByEvent\\(\\) has no return type specified\\.$#',
'identifier' => 'missingType.return',
'count' => 1,
'path' => __DIR__ . '/sources/AppBundle/Event/Model/Repository/VoteRepository.php',
];
$ignoreErrors[] = [
'message' => '#^Method AppBundle\\\\Event\\\\Model\\\\Repository\\\\VoteRepository\\:\\:getVotesByEvent\\(\\) return type with generic interface CCMBenchmark\\\\Ting\\\\Repository\\\\CollectionInterface does not specify its types\\: T$#',
'identifier' => 'missingType.generics',
'count' => 1,
'path' => __DIR__ . '/sources/AppBundle/Event/Model/Repository/VoteRepository.php',
];
$ignoreErrors[] = [
'message' => '#^Method AppBundle\\\\Event\\\\Model\\\\Repository\\\\VoteRepository\\:\\:getVotesByTalkWithUser\\(\\) has no return type specified\\.$#',
'identifier' => 'missingType.return',
'count' => 1,
'path' => __DIR__ . '/sources/AppBundle/Event/Model/Repository/VoteRepository.php',
];
$ignoreErrors[] = [
'message' => '#^Method AppBundle\\\\Event\\\\Model\\\\Repository\\\\VoteRepository\\:\\:getVotesByTalkWithUser\\(\\) has parameter \\$talkId with no type specified\\.$#',
'identifier' => 'missingType.parameter',
'count' => 1,
'path' => __DIR__ . '/sources/AppBundle/Event/Model/Repository/VoteRepository.php',
];
$ignoreErrors[] = [
'message' => '#^Method AppBundle\\\\Event\\\\Model\\\\Repository\\\\VoteRepository\\:\\:initMetadata\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#',
'identifier' => 'missingType.iterableValue',
'count' => 1,
'path' => __DIR__ . '/sources/AppBundle/Event/Model/Repository/VoteRepository.php',
];
$ignoreErrors[] = [
'message' => '#^Method AppBundle\\\\Event\\\\Model\\\\Repository\\\\VoteRepository\\:\\:initMetadata\\(\\) should return M of CCMBenchmark\\\\Ting\\\\Repository\\\\Metadata but returns CCMBenchmark\\\\Ting\\\\Repository\\\\Metadata\\<object\\>\\.$#',
'identifier' => 'return.type',
'count' => 1,
'path' => __DIR__ . '/sources/AppBundle/Event/Model/Repository/VoteRepository.php',
];
$ignoreErrors[] = [
'message' => '#^Parameter \\#1 \\$databaseName of method CCMBenchmark\\\\Ting\\\\Repository\\\\Metadata\\<object\\>\\:\\:setDatabase\\(\\) expects string, mixed given\\.$#',
'identifier' => 'argument.type',
'count' => 1,
'path' => __DIR__ . '/sources/AppBundle/Event/Model/Repository/VoteRepository.php',
];
$ignoreErrors[] = [
'message' => '#^Parameter \\#1 \\$submittedOn of method AppBundle\\\\Event\\\\Model\\\\Vote\\:\\:setSubmittedOn\\(\\) expects DateTime, DateTime\\|null given\\.$#',
'identifier' => 'argument.type',
'count' => 1,
'path' => __DIR__ . '/sources/AppBundle/Event/Model/Repository/VoteRepository.php',
];
$ignoreErrors[] = [
'message' => '#^Property AppBundle\\\\Event\\\\Model\\\\Room\\:\\:\\$name \\(string\\) does not accept mixed\\.$#',
'identifier' => 'assign.propertyType',
Expand Down Expand Up @@ -7387,6 +7339,12 @@
'count' => 1,
'path' => __DIR__ . '/sources/AppBundle/Event/Model/Talk.php',
];
$ignoreErrors[] = [
'message' => '#^Property AppBundle\\\\Event\\\\Model\\\\Talk\\:\\:\\$votes has unknown class AppBundle\\\\Event\\\\Model\\\\Vote as its type\\.$#',
'identifier' => 'class.notFound',
'count' => 1,
'path' => __DIR__ . '/sources/AppBundle/Event/Model/Talk.php',
];
$ignoreErrors[] = [
'message' => '#^Method AppBundle\\\\Event\\\\Model\\\\Ticket\\:\\:getTags\\(\\) return type has no value type specified in iterable type array\\.$#',
'identifier' => 'missingType.iterableValue',
Expand All @@ -7405,12 +7363,6 @@
'count' => 1,
'path' => __DIR__ . '/sources/AppBundle/Event/Model/TicketType.php',
];
$ignoreErrors[] = [
'message' => '#^Method AppBundle\\\\Event\\\\Model\\\\Vote\\:\\:getId\\(\\) should return int but returns int\\|null\\.$#',
'identifier' => 'return.type',
'count' => 1,
'path' => __DIR__ . '/sources/AppBundle/Event/Model/Vote.php',
];
$ignoreErrors[] = [
'message' => '#^Argument of an invalid type mixed supplied for foreach, only iterables are supported\\.$#',
'identifier' => 'foreach.nonIterable',
Expand Down Expand Up @@ -9109,12 +9061,6 @@
'count' => 1,
'path' => __DIR__ . '/sources/AppBundle/Slack/MessageFactory.php',
];
$ignoreErrors[] = [
'message' => '#^Cannot call method getTitle\\(\\) on AppBundle\\\\Event\\\\Model\\\\Talk\\|null\\.$#',
'identifier' => 'method.nonObject',
'count' => 2,
'path' => __DIR__ . '/sources/AppBundle/Slack/MessageFactory.php',
];
$ignoreErrors[] = [
'message' => '#^Argument of an invalid type mixed supplied for foreach, only iterables are supported\\.$#',
'identifier' => 'foreach.nonIterable',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace AppBundle\Controller\Admin\Event;

use AppBundle\Event\AdminEventSelection;
use AppBundle\Event\Model\Repository\VoteRepository;
use AppBundle\Event\Entity\Repository\VoteRepository;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
Expand Down
4 changes: 2 additions & 2 deletions sources/AppBundle/Controller/Event/CFP/EditAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
use AppBundle\Event\Model\Repository\SpeakerRepository;
use AppBundle\Event\Model\Repository\TalkInvitationRepository;
use AppBundle\Event\Model\Repository\TalkRepository;
use AppBundle\Event\Model\Repository\VoteRepository;
use AppBundle\Event\Entity\Repository\VoteRepository;
use AppBundle\Event\Model\Talk;
use AppBundle\Event\Model\TalkInvitation;
use AppBundle\Event\Talk\InvitationFormHandler;
Expand Down Expand Up @@ -98,7 +98,7 @@ public function __invoke(Request $request): RedirectResponse|Response
'invitations' => $this->talkInvitationRepository->getPendingInvitationsByTalkId($talk->getId()),
'speakers' => $this->speakerRepository->getSpeakersByTalk($talk),
'invitationForm' => $invitationForm->createView(),
'votes' => $this->voteRepository->getVotesByTalkWithUser($talk->getId()),
'votes' => $this->voteRepository->getVotesByTalkWithUser((int) $talk->getId()),
'sidebar' => $this->sidebarRenderer->render($event),
]);
}
Expand Down
2 changes: 1 addition & 1 deletion sources/AppBundle/Controller/Event/Event/ShowAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

use AppBundle\Controller\Event\EventActionHelper;
use AppBundle\Event\Model\Repository\TalkRepository;
use AppBundle\Event\Model\Repository\VoteRepository;
use AppBundle\Event\Entity\Repository\VoteRepository;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;

Expand Down
2 changes: 1 addition & 1 deletion sources/AppBundle/Controller/Event/Vote/IndexAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use AppBundle\Controller\Event\EventActionHelper;
use AppBundle\Event\Model\Repository\TalkRepository;
use AppBundle\Event\Model\Talk;
use AppBundle\Event\Model\Vote;
use AppBundle\Event\Entity\Vote;
use AppBundle\Security\Authentication;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\HttpFoundation\Response;
Expand Down
16 changes: 9 additions & 7 deletions sources/AppBundle/Controller/Event/Vote/NewAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@
namespace AppBundle\Controller\Event\Vote;

use AppBundle\Controller\Event\EventActionHelper;
use AppBundle\Event\Entity\Vote;
use AppBundle\Event\Entity\Repository\VoteRepository;
use AppBundle\Event\Model\GithubUser;
use AppBundle\Event\Model\Repository\TalkRepository;
use AppBundle\Event\Model\Repository\VoteRepository;
use AppBundle\Event\Model\Talk;
use AppBundle\Event\Model\Vote;
use AppBundle\Notifier\SlackNotifier;
use AppBundle\Security\Authentication;
use CCMBenchmark\Ting\Exception;
use DateTime;
use Doctrine\DBAL\Exception as DbalException;
use Doctrine\ORM\Exception\ORMException;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
Expand Down Expand Up @@ -40,7 +42,7 @@ public function __invoke(Request $request, string $eventSlug, int $talkId): Json
$vote = new Vote();
$user = $this->authentication->getGithubUserOrNull();
if ($user instanceof GithubUser) {
$vote->setUser($user->getId());
$vote->userId = $user->getId();
}

$form = $this->createVoteForm($eventSlug, $talkId, $vote);
Expand All @@ -65,15 +67,15 @@ public function __invoke(Request $request, string $eventSlug, int $talkId): Json
}

$vote = $form->getData();
$vote->setSubmittedOn(new \DateTime());
$vote->submittedOn = new DateTime();

try {
$vote->setTalk($talk);
$vote->talk = $talk;
$this->eventDispatcher->addListener(KernelEvents::TERMINATE, function () use ($vote): void {
$this->slackNotifier->notifyVote($vote);
});
$this->voteRepository->upsert($vote);
} catch (Exception $e) {
} catch (DbalException|ORMException $e) {
return new JsonResponse(['errors' => [$e->getMessage()]], Response::HTTP_INTERNAL_SERVER_ERROR);
}

Expand Down
4 changes: 2 additions & 2 deletions sources/AppBundle/Controller/Event/Vote/VoteController.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

namespace AppBundle\Controller\Event\Vote;

use AppBundle\Event\Entity\Vote;
use AppBundle\Event\Form\VoteType;
use AppBundle\Event\Model\Vote;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\HttpFoundation\Request;
Expand All @@ -14,7 +14,7 @@ abstract class VoteController extends AbstractController
{
protected function createVoteForm(string $eventSlug, int $talkId, Vote $vote): FormInterface
{
$vote->setSessionId($talkId);
$vote->sessionId = $talkId;

return $this
->createFormBuilder()->create(
Expand Down
Loading
Loading