DX: apply rector rules up to php8.0

This commit is contained in:
2023-04-15 01:05:37 +02:00
parent d8870e906f
commit dde3002100
714 changed files with 2348 additions and 9263 deletions

View File

@@ -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);