Skip to content
Merged
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
5 changes: 2 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
"ext-pdo": "*",
"ext-zip": "*",
"algolia/algoliasearch-client-php": "^3.4",
"beberlei/assert": "^2.9",
"captioning/captioning": "^2.6",
"ccmbenchmark/ting_bundle": "^3.8",
"cocur/slugify": "^2.3",
Expand Down Expand Up @@ -66,6 +65,7 @@
"twig/intl-extra": "^3.21",
"twig/string-extra": "^3.21",
"twig/twig": "^3.21",
"webmozart/assert": "^2.1",
"znk3r/html_common": "*",
"znk3r/html_quickform": "4.0.2"
},
Expand Down Expand Up @@ -157,8 +157,7 @@
"symfony/json-path": "7.3.*",
"symfony/web-profiler-bundle": "7.3.*",
"symplify/vendor-patches": "^11.4",
"tomasvotruba/type-coverage": "^2.1",
"webmozart/assert": "^2.0"
"tomasvotruba/type-coverage": "^2.1"
},
"repositories": [
{
Expand Down
185 changes: 63 additions & 122 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions sources/Afup/Association/Cotisations.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
use AppBundle\Email\Mailer\MailUser;
use AppBundle\Email\Mailer\MailUserFactory;
use AppBundle\Email\Mailer\Message;
use Assert\Assertion;
use DateInterval;
use DateTime;
use Webmozart\Assert\Assert;

define('AFUP_COTISATIONS_REGLEMENT_ESPECES', 0);
define('AFUP_COTISATIONS_REGLEMENT_CHEQUE', 1);
Expand Down Expand Up @@ -509,15 +509,15 @@ public function envoyerFacture($id_cotisation, Mailer $mailer, UserRepository $u

if ($personne['type_personne'] == MemberType::MemberCompany->value) {
$company = $this->companyMemberRepository ? $this->companyMemberRepository->get($personne['id_personne']) : null;
Assertion::notNull($company);
Assert::notNull($company);
$contactPhysique = [
'nom' => $company->getLastName(),
'prenom' => $company->getFirstName(),
'email' => $company->getEmail(),
];
} else {
$user = $userRepository->get($personne['id_personne']);
Assertion::notNull($user);
Assert::notNull($user);
$contactPhysique = [
'nom' => $user->getLastName(),
'prenom' => $user->getFirstName(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

use AppBundle\Association\MemberType;
use AppBundle\Association\Model\CompanyMember;
use Assert\Assertion;
use Aura\SqlQuery\Common\SelectInterface;
use CCMBenchmark\Ting\Driver\Mysqli\Serializer\Boolean;
use CCMBenchmark\Ting\Repository\CollectionInterface;
Expand All @@ -17,6 +16,7 @@
use CCMBenchmark\Ting\Repository\Repository;
use CCMBenchmark\Ting\Serializer\SerializerFactoryInterface;
use InvalidArgumentException;
use Webmozart\Assert\Assert;

/**
* @extends Repository<CompanyMember>
Expand Down Expand Up @@ -71,12 +71,12 @@ public function loadAll()
*/
public function search($sort = 'name', $direction = 'asc', $filter = null, $onlyDisplayActive = true)
{
Assertion::inArray($direction, ['asc', 'desc']);
Assert::inArray($direction, ['asc', 'desc']);
$sorts = [
'name' => ['raison_sociale'],
'status' => ['etat', 'raison_sociale'],
];
Assertion::keyExists($sorts, $sort);
Assert::keyExists($sorts, $sort);
$queryBuilder = $this->getQueryBuilderWithCompleteCompanyMember()
->orderBy(array_map(static fn($field): string => $field . ' ' . $direction, $sorts[$sort]));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
use AppBundle\Association\Model\CompanyMember;
use AppBundle\Association\Model\User;
use AppBundle\Event\Model\Badge;
use Assert\Assertion;
use Aura\SqlQuery\Common\SelectInterface;
use CCMBenchmark\Ting\Driver\Mysqli\Serializer\Boolean;
use CCMBenchmark\Ting\Repository\CollectionInterface;
Expand All @@ -26,6 +25,7 @@
use Symfony\Component\Security\Core\User\PasswordUpgraderInterface;
use Symfony\Component\Security\Core\User\UserInterface;
use Symfony\Component\Security\Core\User\UserProviderInterface;
use Webmozart\Assert\Assert;

/**
* @extends Repository<User>
Expand Down Expand Up @@ -176,13 +176,13 @@ public function search(
$isCompanyManager = null,
$needsUptoDateMembership = null,
) {
Assertion::inArray($direction, ['asc', 'desc']);
Assert::inArray($direction, ['asc', 'desc']);
$sorts = [
'lastname' => ['nom', 'prenom'],
'firstname' => ['prenom', 'nom'],
'status' => ['etat','nom', 'prenom'],
];
Assertion::keyExists($sorts, $sort);
Assert::keyExists($sorts, $sort);

$queryBuilder = $this->getQueryBuilderWithCompleteUser()
->orderBy(array_map(static fn($field): string => $field . ' ' . $direction, $sorts[$sort]));
Expand Down
4 changes: 2 additions & 2 deletions sources/AppBundle/Controller/Admin/GetMenuAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@

namespace AppBundle\Controller\Admin;

use Assert\Assertion;
use Symfony\Component\DependencyInjection\Attribute\Autowire;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\HttpFoundation\Response;
use Twig\Environment;
use Webmozart\Assert\Assert;

class GetMenuAction
{
Expand All @@ -23,7 +23,7 @@ public function __construct(
public function __invoke(): Response
{
$masterRequest = $this->requestStack->getMainRequest();
Assertion::notNull($masterRequest);
Assert::notNull($masterRequest);
$page = $masterRequest->query->get('page');
$route = $masterRequest->get('_route');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@

use AppBundle\Association\Model\Repository\UserRepository;
use AppBundle\GeneralMeeting\GeneralMeetingRepository;
use Assert\Assertion;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Twig\Environment;
use Webmozart\Assert\Assert;

class ListAction
{
Expand All @@ -27,8 +27,8 @@ public function __invoke(Request $request): Response
$latestDate = $this->generalMeetingRepository->getLatestAttendanceDate();
$sort = $request->query->get('sort', 'nom');
$direction = $request->query->get('direction', 'asc');
Assertion::inArray($sort, self::VALID_SORTS);
Assertion::inArray($direction, self::VALID_DIRECTIONS);
Assert::inArray($sort, self::VALID_SORTS);
Assert::inArray($direction, self::VALID_DIRECTIONS);
$dates = $this->generalMeetingRepository->getAllDates();
$convocations = count($this->userRepository->getActiveMembers());
$nbAttendeesAndPowers = $nbAttendees = $quorum = $validAttendeeIds = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@

use Afup\Site\Utils\PDF_AG;
use AppBundle\GeneralMeeting\GeneralMeetingRepository;
use Assert\Assertion;
use DateTimeImmutable;
use Symfony\Component\HttpFoundation\BinaryFileResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\ResponseHeaderBag;
use Webmozart\Assert\Assert;

class ListingAction
{
Expand All @@ -19,7 +19,7 @@ public function __construct(private readonly GeneralMeetingRepository $generalMe
public function __invoke(Request $request): BinaryFileResponse
{
$latestDate = $this->generalMeetingRepository->getLatestAttendanceDate();
Assertion::notNull($latestDate);
Assert::notNull($latestDate);
$selectedDate = $latestDate;
if ($request->query->has('date')) {
$selectedDate = DateTimeImmutable::createFromFormat('d/m/Y', (string) $request->query->get('date'));
Expand Down
Loading
Loading