Skip to content

Commit 782a343

Browse files
committed
Internal: Add @implements ProcessorInterface specifying their generic type parameters.
1 parent 3a098f3 commit 782a343

8 files changed

+41
-20
lines changed

src/CoreBundle/State/AccessUrlRelColorThemeStateProcessor.php

+3
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
use Chamilo\CoreBundle\ServiceHelper\AccessUrlHelper;
1313
use Doctrine\ORM\EntityManagerInterface;
1414

15+
/**
16+
* @implements ProcessorInterface<AccessUrlRelColorTheme, AccessUrlRelColorTheme>
17+
*/
1518
final class AccessUrlRelColorThemeStateProcessor implements ProcessorInterface
1619
{
1720
public function __construct(

src/CoreBundle/State/CAttendanceStateProcessor.php

+3
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818
use Symfony\Component\HttpFoundation\RequestStack;
1919
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
2020

21+
/**
22+
* @implements ProcessorInterface<void, void>
23+
*/
2124
final class CAttendanceStateProcessor implements ProcessorInterface
2225
{
2326
public function __construct(

src/CoreBundle/State/CCalendarEventStateProcessor.php

+3
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
use Exception;
1515
use Symfony\Bundle\SecurityBundle\Security;
1616

17+
/**
18+
* @implements ProcessorInterface<CCalendarEvent, CCalendarEvent>
19+
*/
1720
final class CCalendarEventStateProcessor implements ProcessorInterface
1821
{
1922
public function __construct(

src/CoreBundle/State/CStudentPublicationPostStateProcessor.php

+9-2
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@
2323
use Symfony\Component\Routing\RouterInterface;
2424
use Symfony\Contracts\Translation\TranslatorInterface;
2525

26+
/**
27+
* @implements ProcessorInterface<CStudentPublication, CStudentPublication>
28+
*/
2629
final class CStudentPublicationPostStateProcessor implements ProcessorInterface
2730
{
2831
public function __construct(
@@ -34,8 +37,12 @@ public function __construct(
3437
private readonly SettingsManager $settingsManager,
3538
) {}
3639

37-
public function process($data, Operation $operation, array $uriVariables = [], array $context = [])
38-
{
40+
public function process(
41+
$data,
42+
Operation $operation,
43+
array $uriVariables = [],
44+
array $context = []
45+
): CStudentPublication {
3946
$result = $this->persistProcessor->process($data, $operation, $uriVariables, $context);
4047

4148
/** @var CStudentPublication $publication */

src/CoreBundle/State/ColorThemeStateProcessor.php

+4-6
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919
use const DIRECTORY_SEPARATOR;
2020
use const PHP_EOL;
2121

22+
/**
23+
* @implements ProcessorInterface<ColorTheme, ColorTheme|void>
24+
*/
2225
final class ColorThemeStateProcessor implements ProcessorInterface
2326
{
2427
public function __construct(
@@ -29,12 +32,7 @@ public function __construct(
2932
private readonly FilesystemOperator $filesystem,
3033
) {}
3134

32-
/**
33-
* @param mixed $data
34-
*
35-
* @throws FilesystemException
36-
*/
37-
public function process($data, Operation $operation, array $uriVariables = [], array $context = [])
35+
public function process($data, Operation $operation, array $uriVariables = [], array $context = []): ?ColorTheme
3836
{
3937
\assert($data instanceof ColorTheme);
4038

src/CoreBundle/State/MessageProcessor.php

+12-11
Original file line numberDiff line numberDiff line change
@@ -12,27 +12,27 @@
1212
use Chamilo\CoreBundle\Entity\Message;
1313
use Chamilo\CoreBundle\Entity\MessageAttachment;
1414
use Chamilo\CoreBundle\Entity\MessageRelUser;
15+
use Chamilo\CoreBundle\Entity\User;
1516
use Chamilo\CoreBundle\Repository\ResourceNodeRepository;
1617
use Doctrine\ORM\EntityManagerInterface;
1718
use LogicException;
1819
use Notification;
1920
use Symfony\Bundle\SecurityBundle\Security;
20-
use Symfony\Component\HttpFoundation\RequestStack;
21-
use Vich\UploaderBundle\Storage\FlysystemStorage;
2221

23-
final class MessageProcessor implements ProcessorInterface
22+
/**
23+
* @implements ProcessorInterface<Message, Message|void>
24+
*/
25+
final readonly class MessageProcessor implements ProcessorInterface
2426
{
2527
public function __construct(
26-
private readonly ProcessorInterface $persistProcessor,
27-
private readonly ProcessorInterface $removeProcessor,
28-
private readonly FlysystemStorage $storage,
29-
private readonly EntityManagerInterface $entityManager,
30-
private readonly ResourceNodeRepository $resourceNodeRepository,
31-
private readonly Security $security,
32-
private readonly RequestStack $requestStack
28+
private ProcessorInterface $persistProcessor,
29+
private ProcessorInterface $removeProcessor,
30+
private EntityManagerInterface $entityManager,
31+
private ResourceNodeRepository $resourceNodeRepository,
32+
private Security $security,
3333
) {}
3434

35-
public function process($data, Operation $operation, array $uriVariables = [], array $context = [])
35+
public function process($data, Operation $operation, array $uriVariables = [], array $context = []): ?Message
3636
{
3737
if ($operation instanceof DeleteOperationInterface) {
3838
return $this->removeProcessor->process($data, $operation, $uriVariables, $context);
@@ -51,6 +51,7 @@ public function process($data, Operation $operation, array $uriVariables = [], a
5151
}
5252
}
5353

54+
/** @var User $user */
5455
$user = $this->security->getUser();
5556
if (!$user) {
5657
throw new LogicException('User not found.');

src/CoreBundle/State/UserRelUserStateProcessor.php

+3
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
use Chamilo\CoreBundle\Entity\UserRelUser;
1414
use Doctrine\ORM\EntityManagerInterface;
1515

16+
/**
17+
* @implements ProcessorInterface<UserRelUser, UserRelUser|void>
18+
*/
1619
final class UserRelUserStateProcessor implements ProcessorInterface
1720
{
1821
public function __construct(

src/CoreBundle/State/UsergroupPostStateProcessor.php

+4-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
use Symfony\Bundle\SecurityBundle\Security;
1313
use Symfony\Component\HttpFoundation\RequestStack;
1414

15+
/**
16+
* @implements ProcessorInterface<Usergroup, Usergroup>
17+
*/
1518
final class UsergroupPostStateProcessor implements ProcessorInterface
1619
{
1720
private ProcessorInterface $processor;
@@ -31,7 +34,7 @@ public function __construct(
3134
$this->requestStack = $requestStack;
3235
}
3336

34-
public function process($data, Operation $operation, array $uriVariables = [], array $context = [])
37+
public function process($data, Operation $operation, array $uriVariables = [], array $context = []): Usergroup
3538
{
3639
/** @var Usergroup $usergroup */
3740
$usergroup = $this->processor->process($data, $operation, $uriVariables, $context);

0 commit comments

Comments
 (0)