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
119 changes: 32 additions & 87 deletions phpstan-baseline.php
Original file line number Diff line number Diff line change
Expand Up @@ -649,6 +649,18 @@
'count' => 1,
'path' => __DIR__ . '/sources/AppBundle/AssembleeGenerale/Entity/Repository/PresenceRepository.php',
];
$ignoreErrors[] = [
'message' => '#^Cannot cast mixed to int\\.$#',
'identifier' => 'cast.int',
'count' => 1,
'path' => __DIR__ . '/sources/AppBundle/Association/CompanyMembership/AbstractCompanyReminder.php',
];
$ignoreErrors[] = [
'message' => '#^Cannot cast mixed to string\\.$#',
'identifier' => 'cast.string',
'count' => 1,
'path' => __DIR__ . '/sources/AppBundle/Association/CompanyMembership/AbstractCompanyReminder.php',
];
$ignoreErrors[] = [
'message' => '#^Parameter \\#1 \\$email of class AppBundle\\\\Email\\\\Mailer\\\\MailUser constructor expects string, mixed given\\.$#',
'identifier' => 'argument.type',
Expand Down Expand Up @@ -941,8 +953,8 @@
'message' => '#^Parameter \\#2 \\$array of function implode expects array\\<string\\>, list given\\.$#',
'identifier' => 'argument.type',
'count' => 1,
'path' => __DIR__ . '/sources/AppBundle/Association/Model/CompanyMember.php',
];
'path' => __DIR__ . '/sources/AppBundle/Association/Model/CompanyMember.php',
];
$ignoreErrors[] = [
'message' => '#^Cannot access offset \'id\' on mixed\\.$#',
'identifier' => 'offsetAccess.nonOffsetAccessible',
Expand Down Expand Up @@ -1573,6 +1585,18 @@
'count' => 1,
'path' => __DIR__ . '/sources/AppBundle/Association/NotifiableInterface.php',
];
$ignoreErrors[] = [
'message' => '#^Cannot cast mixed to int\\.$#',
'identifier' => 'cast.int',
'count' => 1,
'path' => __DIR__ . '/sources/AppBundle/Association/UserMembership/AbstractUserReminder.php',
];
$ignoreErrors[] = [
'message' => '#^Cannot cast mixed to string\\.$#',
'identifier' => 'cast.string',
'count' => 1,
'path' => __DIR__ . '/sources/AppBundle/Association/UserMembership/AbstractUserReminder.php',
];
$ignoreErrors[] = [
'message' => '#^Parameter \\#1 \\$email of class AppBundle\\\\Email\\\\Mailer\\\\MailUser constructor expects string, mixed given\\.$#',
'identifier' => 'argument.type',
Expand Down Expand Up @@ -2887,18 +2911,18 @@
'count' => 1,
'path' => __DIR__ . '/sources/AppBundle/Controller/Admin/Event/RemoveEventAction.php',
];
$ignoreErrors[] = [
'message' => '#^Method AppBundle\\\\Controller\\\\Admin\\\\Event\\\\RoomAction\\:\\:getFormsForRooms\\(\\) return type with generic interface Symfony\\\\Component\\\\Form\\\\FormInterface does not specify its types\\: TData$#',
'identifier' => 'missingType.generics',
'count' => 1,
'path' => __DIR__ . '/sources/AppBundle/Controller/Admin/Event/RoomAction.php',
];
$ignoreErrors[] = [
'message' => '#^Cannot access property \\$name on mixed\\.$#',
'identifier' => 'property.nonObject',
'count' => 2,
'path' => __DIR__ . '/sources/AppBundle/Controller/Admin/Event/RoomAction.php',
];
$ignoreErrors[] = [
'message' => '#^Method AppBundle\\\\Controller\\\\Admin\\\\Event\\\\RoomAction\\:\\:getFormsForRooms\\(\\) return type with generic interface Symfony\\\\Component\\\\Form\\\\FormInterface does not specify its types\\: TData$#',
'identifier' => 'missingType.generics',
'count' => 1,
'path' => __DIR__ . '/sources/AppBundle/Controller/Admin/Event/RoomAction.php',
];
$ignoreErrors[] = [
'message' => '#^Parameter \\#1 \\$entity of method AppBundle\\\\Doctrine\\\\EntityRepository\\<AppBundle\\\\Event\\\\Entity\\\\Room\\>\\:\\:delete\\(\\) expects AppBundle\\\\Event\\\\Entity\\\\Room, mixed given\\.$#',
'identifier' => 'argument.type',
Expand Down Expand Up @@ -3067,36 +3091,6 @@
'count' => 1,
'path' => __DIR__ . '/sources/AppBundle/Controller/Admin/Event/SpecialPriceAction.php',
];
$ignoreErrors[] = [
'message' => '#^Cannot call method getId\\(\\) on AppBundle\\\\Event\\\\Model\\\\SponsorTicket\\|null\\.$#',
'identifier' => 'method.nonObject',
'count' => 1,
'path' => __DIR__ . '/sources/AppBundle/Controller/Admin/Event/SponsorTicketAction.php',
];
$ignoreErrors[] = [
'message' => '#^Cannot call method setEditedOn\\(\\) on AppBundle\\\\Event\\\\Model\\\\SponsorTicket\\|null\\.$#',
'identifier' => 'method.nonObject',
'count' => 1,
'path' => __DIR__ . '/sources/AppBundle/Controller/Admin/Event/SponsorTicketAction.php',
];
$ignoreErrors[] = [
'message' => '#^Parameter \\#1 \\$entity of method CCMBenchmark\\\\Ting\\\\Repository\\\\Repository\\<AppBundle\\\\Event\\\\Model\\\\SponsorTicket\\>\\:\\:save\\(\\) expects AppBundle\\\\Event\\\\Model\\\\SponsorTicket, AppBundle\\\\Event\\\\Model\\\\SponsorTicket\\|null given\\.$#',
'identifier' => 'argument.type',
'count' => 1,
'path' => __DIR__ . '/sources/AppBundle/Controller/Admin/Event/SponsorTicketAction.php',
];
$ignoreErrors[] = [
'message' => '#^Parameter \\#1 \\$idForum of method AppBundle\\\\Event\\\\Model\\\\SponsorTicket\\:\\:setIdForum\\(\\) expects int, int\\|null given\\.$#',
'identifier' => 'argument.type',
'count' => 1,
'path' => __DIR__ . '/sources/AppBundle/Controller/Admin/Event/SponsorTicketAction.php',
];
$ignoreErrors[] = [
'message' => '#^Parameter \\#1 \\$sponsorTicket of method AppBundle\\\\Event\\\\Ticket\\\\SponsorTokenMail\\:\\:sendNotification\\(\\) expects AppBundle\\\\Event\\\\Model\\\\SponsorTicket, AppBundle\\\\Event\\\\Model\\\\SponsorTicket\\|null given\\.$#',
'identifier' => 'argument.type',
'count' => 1,
'path' => __DIR__ . '/sources/AppBundle/Controller/Admin/Event/SponsorTicketAction.php',
];
$ignoreErrors[] = [
'message' => '#^Cannot access offset \'n\' on mixed\\.$#',
'identifier' => 'offsetAccess.nonOffsetAccessible',
Expand Down Expand Up @@ -6301,30 +6295,6 @@
'count' => 1,
'path' => __DIR__ . '/sources/AppBundle/Event/Model/Repository/SpeakerRepository.php',
];
$ignoreErrors[] = [
'message' => '#^Method AppBundle\\\\Event\\\\Model\\\\Repository\\\\SponsorTicketRepository\\:\\:getByEvent\\(\\) 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/SponsorTicketRepository.php',
];
$ignoreErrors[] = [
'message' => '#^Method AppBundle\\\\Event\\\\Model\\\\Repository\\\\SponsorTicketRepository\\:\\: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/SponsorTicketRepository.php',
];
$ignoreErrors[] = [
'message' => '#^Method AppBundle\\\\Event\\\\Model\\\\Repository\\\\SponsorTicketRepository\\:\\: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/SponsorTicketRepository.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/SponsorTicketRepository.php',
];
$ignoreErrors[] = [
'message' => '#^Cannot access offset \'\\.aggregation\' on mixed\\.$#',
'identifier' => 'offsetAccess.nonOffsetAccessible',
Expand Down Expand Up @@ -9445,30 +9415,5 @@
'count' => 1,
'path' => __DIR__ . '/sources/AppBundle/VideoNotifier/StatusGenerator.php',
];
$ignoreErrors[] = [
'message' => '#^Cannot cast mixed to string\\.$#',
'identifier' => 'cast.string',
'count' => 1,
'path' => __DIR__ . '/sources/AppBundle/Association/CompanyMembership/AbstractCompanyReminder.php',
];
$ignoreErrors[] = [
'message' => '#^Cannot cast mixed to int\\.$#',
'identifier' => 'cast.int',
'count' => 1,
'path' => __DIR__ . '/sources/AppBundle/Association/CompanyMembership/AbstractCompanyReminder.php',
];
$ignoreErrors[] = [
'message' => '#^Cannot cast mixed to string\\.$#',
'identifier' => 'cast.string',
'count' => 1,
'path' => __DIR__ . '/sources/AppBundle/Association/UserMembership/AbstractUserReminder.php',
];
$ignoreErrors[] = [
'message' => '#^Cannot cast mixed to int\\.$#',
'identifier' => 'cast.int',
'count' => 1,
'path' => __DIR__ . '/sources/AppBundle/Association/UserMembership/AbstractUserReminder.php',
];

return ['parameters' => ['ignoreErrors' => $ignoreErrors]];

Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace AppBundle\Controller\Admin\Event;

use AppBundle\Event\Model\Repository\SponsorTicketRepository;
use AppBundle\Event\Entity\Repository\SponsorTicketRepository;
use AppBundle\Event\Ticket\SponsorTicketHelper;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
Expand All @@ -19,7 +19,7 @@ public function __construct(

public function __invoke(Request $request, int $tokenId): Response
{
$token = $this->sponsorTicketRepository->get($tokenId);
$token = $this->sponsorTicketRepository->find($tokenId);
if ($token === null) {
throw $this->createNotFoundException(sprintf('Could not find token with id: %s', $tokenId));
}
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\SponsorTicketRepository;
use AppBundle\Event\Entity\Repository\SponsorTicketRepository;
use AppBundle\Event\Ticket\SponsorTokenMail;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\RedirectResponse;
Expand All @@ -20,7 +20,7 @@ public function __construct(

public function __invoke(Request $request, AdminEventSelection $eventSelection): RedirectResponse
{
$token = $this->sponsorTicketRepository->get($request->request->get('sponsor_token_id'));
$token = $this->sponsorTicketRepository->find($request->request->get('sponsor_token_id'));
if ($token === null) {
throw $this->createNotFoundException(sprintf('Could not find token with id: %s', $request->request->get('sponsor_token_id')));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
namespace AppBundle\Controller\Admin\Event;

use AppBundle\Controller\Event\EventActionHelper;
use AppBundle\Event\Model\Repository\SponsorTicketRepository;
use AppBundle\Event\Model\SponsorTicket;
use AppBundle\Event\Entity\Repository\SponsorTicketRepository;
use AppBundle\Event\Entity\SponsorTicket;
use AppBundle\Event\Ticket\SponsorTokenMail;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\RedirectResponse;
Expand All @@ -24,7 +24,7 @@ public function __invoke(Request $request): RedirectResponse
{
$event = $this->eventActionHelper->getFromRequest('id', false)->event;
/** @var SponsorTicket[] $tokens */
$tokens = $this->sponsorTicketRepository->getByEvent($event);
$tokens = $this->sponsorTicketRepository->findByEventId((int) $event->getId());
$mailSent = 0;

foreach ($tokens as $token) {
Expand Down
29 changes: 16 additions & 13 deletions sources/AppBundle/Controller/Admin/Event/SponsorTicketAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
namespace AppBundle\Controller\Admin\Event;

use AppBundle\Event\AdminEventSelection;
use AppBundle\Event\Entity\Repository\SponsorTicketRepository;
use AppBundle\Event\Entity\SponsorTicket;
use AppBundle\Event\Form\SponsorTokenType;
use AppBundle\Event\Model\Repository\SponsorTicketRepository;
use AppBundle\Event\Model\SponsorTicket;
use AppBundle\Event\Ticket\SponsorTokenMail;
use AppBundle\Security\Authentication;
use DateTime;
use DateTimeImmutable;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
Expand All @@ -26,24 +26,27 @@ public function __construct(
public function __invoke(Request $request, AdminEventSelection $eventSelection): Response
{
$event = $eventSelection->event;
$tokens = $this->sponsorTicketRepository->getByEvent($event);
$tokens = $this->sponsorTicketRepository->findByEventId((int) $event->getId());
$edit = $request->query->has('ticket');
$now = new DateTimeImmutable();
if ($edit) {
$newToken = $this->sponsorTicketRepository->get($request->query->get('ticket'));
$newToken->setEditedOn(new DateTime());
$newToken = $this->sponsorTicketRepository->find($request->query->get('ticket'));
if ($newToken === null) {
throw $this->createNotFoundException('Could not find token');
}
$newToken->editedOn = $now;
} else {
$newToken = new SponsorTicket();
$newToken
->setToken(base64_encode(random_bytes(30)))
->setIdForum($event->getId())
->setCreatedOn(new DateTime())
->setEditedOn(new DateTime())
->setCreatorId($this->authentication->getAfupUser()->getId());
$newToken->token = base64_encode(random_bytes(30));
$newToken->eventId = (int) $event->getId();
$newToken->createdOn = $now;
$newToken->editedOn = $now;
$newToken->creatorId = $this->authentication->getAfupUser()->getId();
}
$form = $this->createForm(SponsorTokenType::class, $newToken);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
if ($newToken->getId() === null) {
if ($newToken->id === null) {
$this->sponsorTokenMail->sendNotification($newToken);
}
$this->sponsorTicketRepository->save($newToken);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use AppBundle\Controller\Exception\InvalidSponsorTokenException;
use AppBundle\Event\Entity\Repository\SponsorScanRepository;
use AppBundle\Event\Entity\SponsorScan;
use AppBundle\Event\Model\Repository\SponsorTicketRepository;
use AppBundle\Event\Entity\Repository\SponsorTicketRepository;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;

Expand All @@ -32,7 +32,7 @@ public function __invoke(Request $request, string $eventSlug, string $scanId): R
return $this->redirectToRoute('sponsor_ticket_home', ['eventSlug' => $eventSlug]);
}

$scan = $this->sponsorScanRepository->findOneBy(['sponsorTicketId' => $sponsorTicket->getId(), 'id' => (int) $scanId]);
$scan = $this->sponsorScanRepository->findOneBy(['sponsorTicketId' => $sponsorTicket->id, 'id' => (int) $scanId]);

if ($scan instanceof SponsorScan) {
$scan->deletedOn = new \DateTimeImmutable('now');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use AppBundle\Controller\Event\EventActionHelper;
use AppBundle\Controller\Exception\InvalidSponsorTokenException;
use AppBundle\Event\Entity\Repository\SponsorScanRepository;
use AppBundle\Event\Model\Repository\SponsorTicketRepository;
use AppBundle\Event\Entity\Repository\SponsorTicketRepository;
use Symfony\Component\HttpFoundation\BinaryFileResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
use AppBundle\Controller\Exception\InvalidSponsorTokenException;
use AppBundle\Event\Entity\Repository\SponsorScanRepository;
use AppBundle\Event\Entity\SponsorScan;
use AppBundle\Event\Model\Repository\SponsorTicketRepository;
use AppBundle\Event\Entity\Repository\SponsorTicketRepository;
use AppBundle\Event\Model\Repository\TicketRepository;
use AppBundle\Event\Model\SponsorTicket;
use AppBundle\Event\Entity\SponsorTicket;
use AppBundle\Event\Model\Ticket;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
Expand Down Expand Up @@ -44,7 +44,7 @@ public function __invoke(Request $request, string $code, string $eventSlug): Red
return $this->redirectToRoute('sponsor_scan', ['eventSlug' => $eventSlug]);
}

$scan = $this->sponsorScanRepository->findOneBy(['sponsorTicketId' => $sponsorTicket->getId(), 'ticketId' => $ticket->getId()]);
$scan = $this->sponsorScanRepository->findOneBy(['sponsorTicketId' => $sponsorTicket->id, 'ticketId' => $ticket->getId()]);

if ($scan instanceof SponsorScan && $scan->deletedOn === null) {
$this->addFlash('error', 'Code déjà scanné.');
Expand All @@ -66,7 +66,7 @@ public function __invoke(Request $request, string $code, string $eventSlug): Red

private function createSponsorScan(SponsorTicket $sponsorTicket, Ticket $ticket): SponsorScan
{
$sponsorTicketId = $sponsorTicket->getId();
$sponsorTicketId = $sponsorTicket->id;
$ticketId = $ticket->getId();
if ($sponsorTicketId === null || $ticketId === null) {
throw new \InvalidArgumentException('Le ticket sponsor et le billet doivent être enregistrés');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use AppBundle\Controller\Event\EventActionHelper;
use AppBundle\Controller\Exception\InvalidSponsorTokenException;
use AppBundle\Event\Entity\Repository\SponsorScanRepository;
use AppBundle\Event\Model\Repository\SponsorTicketRepository;
use AppBundle\Event\Entity\Repository\SponsorTicketRepository;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use AppBundle\Controller\Event\EventActionHelper;
use AppBundle\Controller\Exception\InvalidSponsorTokenException;
use AppBundle\Event\Form\SponsorScanType;
use AppBundle\Event\Model\Repository\SponsorTicketRepository;
use AppBundle\Event\Entity\Repository\SponsorTicketRepository;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
namespace AppBundle\Controller\Event\SponsorScan;

use AppBundle\Controller\Exception\InvalidSponsorTokenException;
use AppBundle\Event\Model\Repository\SponsorTicketRepository;
use AppBundle\Event\Model\SponsorTicket;
use AppBundle\Event\Entity\Repository\SponsorTicketRepository;
use AppBundle\Event\Entity\SponsorTicket;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;

Expand All @@ -20,12 +20,12 @@ protected function checkSponsorTicket(Request $request): SponsorTicket
throw new InvalidSponsorTokenException('Merci de renseigner votre token.');
}

$sponsorTicket = $this->sponsorTicketRepository->get($request->getSession()->get('sponsor_ticket_id'));
$sponsorTicket = $this->sponsorTicketRepository->find($request->getSession()->get('sponsor_ticket_id'));
if ($sponsorTicket === null) {
throw new InvalidSponsorTokenException('Token invalide.');
}

if (!$sponsorTicket->getQrCodesScannerAvailable()) {
if (!$sponsorTicket->qrCodesScannerAvailable) {
throw new InvalidSponsorTokenException('Accès non autorisé.');
}

Expand Down
Loading
Loading