mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-01 12:33:49 +00:00
DX: apply rector rules up to php8.0
This commit is contained in:
@@ -51,32 +51,8 @@ use function count;
|
||||
|
||||
final class AccompanyingCourseApiController extends ApiController
|
||||
{
|
||||
private AccompanyingPeriodACLAwareRepository $accompanyingPeriodACLAwareRepository;
|
||||
|
||||
private AccompanyingPeriodRepository $accompanyingPeriodRepository;
|
||||
|
||||
private EventDispatcherInterface $eventDispatcher;
|
||||
|
||||
private ReferralsSuggestionInterface $referralAvailable;
|
||||
|
||||
private Registry $registry;
|
||||
|
||||
private ValidatorInterface $validator;
|
||||
|
||||
public function __construct(
|
||||
AccompanyingPeriodRepository $accompanyingPeriodRepository,
|
||||
AccompanyingPeriodACLAwareRepository $accompanyingPeriodACLAwareRepository,
|
||||
EventDispatcherInterface $eventDispatcher,
|
||||
ReferralsSuggestionInterface $referralAvailable,
|
||||
Registry $registry,
|
||||
ValidatorInterface $validator
|
||||
) {
|
||||
$this->accompanyingPeriodRepository = $accompanyingPeriodRepository;
|
||||
$this->accompanyingPeriodACLAwareRepository = $accompanyingPeriodACLAwareRepository;
|
||||
$this->eventDispatcher = $eventDispatcher;
|
||||
$this->referralAvailable = $referralAvailable;
|
||||
$this->registry = $registry;
|
||||
$this->validator = $validator;
|
||||
public function __construct(private AccompanyingPeriodRepository $accompanyingPeriodRepository, private AccompanyingPeriodACLAwareRepository $accompanyingPeriodACLAwareRepository, private EventDispatcherInterface $eventDispatcher, private ReferralsSuggestionInterface $referralAvailable, private Registry $registry, private ValidatorInterface $validator)
|
||||
{
|
||||
}
|
||||
|
||||
public function commentApi($id, Request $request, string $_format): Response
|
||||
@@ -190,20 +166,11 @@ final class AccompanyingCourseApiController extends ApiController
|
||||
//
|
||||
$this->onPostCheckACL('participation', $request, $_format, $accompanyingPeriod);
|
||||
|
||||
switch ($request->getMethod()) {
|
||||
case Request::METHOD_POST:
|
||||
$participation = $accompanyingPeriod->createParticipationFor($person);
|
||||
|
||||
break;
|
||||
|
||||
case Request::METHOD_DELETE:
|
||||
$participation = $accompanyingPeriod->closeParticipationFor($person);
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new BadRequestHttpException('This method is not supported');
|
||||
}
|
||||
$participation = match ($request->getMethod()) {
|
||||
Request::METHOD_POST => $accompanyingPeriod->createParticipationFor($person),
|
||||
Request::METHOD_DELETE => $accompanyingPeriod->closeParticipationFor($person),
|
||||
default => throw new BadRequestHttpException('This method is not supported'),
|
||||
};
|
||||
|
||||
$errors = $this->validator->validate($accompanyingPeriod);
|
||||
|
||||
@@ -320,10 +287,8 @@ final class AccompanyingCourseApiController extends ApiController
|
||||
/**
|
||||
* @Route("/api/1.0/person/accompanying-course/{id}/confidential.json", name="chill_api_person_accompanying_period_confidential")
|
||||
* @ParamConverter("accompanyingCourse", options={"id": "id"})
|
||||
*
|
||||
* @param mixed $id
|
||||
*/
|
||||
public function toggleConfidentialApi(AccompanyingPeriod $accompanyingCourse, $id, Request $request)
|
||||
public function toggleConfidentialApi(AccompanyingPeriod $accompanyingCourse, mixed $id, Request $request)
|
||||
{
|
||||
if ($request->getMethod() === 'POST') {
|
||||
$this->denyAccessUnlessGranted(AccompanyingPeriodVoter::TOGGLE_CONFIDENTIAL, $accompanyingCourse);
|
||||
|
Reference in New Issue
Block a user