Skip to content

Commit

Permalink
Fix psalm errors for Processors (#3672)
Browse files Browse the repository at this point in the history
* InvitationAcceptProcessor: fix psalm

ERROR: MissingTemplateParam - src/State/InvitationAcceptProcessor.php:17:44 - App\State\InvitationAcceptProcessor has missing template params when extending ApiPlatform\State\ProcessorInterface, expecting 1 (see https://psalm.dev/182)
class InvitationAcceptProcessor implements ProcessorInterface {

* InvitationRejectProcessor: fix psalm

ERROR: MissingTemplateParam - src/State/InvitationRejectProcessor.php:13:44 - App\State\InvitationRejectProcessor has missing template params when extending ApiPlatform\State\ProcessorInterface, expecting 1 (see https://psalm.dev/182)
class InvitationRejectProcessor implements ProcessorInterface {

* ResetPasswordCreateProcessor: fix psalm

ERROR: MissingTemplateParam - src/State/ResetPasswordCreateProcessor.php:17:47 - App\State\ResetPasswordCreateProcessor has missing template params when extending ApiPlatform\State\ProcessorInterface, expecting 1 (see https://psalm.dev/182)
class ResetPasswordCreateProcessor implements ProcessorInterface {

* ResetPasswordUpdateProcessor: fix psalm

ERROR: MissingTemplateParam - src/State/ResetPasswordUpdateProcessor.php:15:47 - App\State\ResetPasswordUpdateProcessor has missing template params when extending ApiPlatform\State\ProcessorInterface, expecting 1 (see https://psalm.dev/182)
class ResetPasswordUpdateProcessor implements ProcessorInterface {

* AbstractPersistProcessor and children: fix psalm

ERROR: MissingTemplateParam - src/State/Util/AbstractPersistProcessor.php:14:52 - App\State\Util\AbstractPersistProcessor has missing template params when extending ApiPlatform\State\ProcessorInterface, expecting 1 (see https://psalm.dev/182)
abstract class AbstractPersistProcessor implements ProcessorInterface {

* AbstractRemoveProcessor and children: fix psalm

ERROR: MissingTemplateParam - src/State/Util/AbstractRemoveProcessor.php:8:51 - App\State\Util\AbstractRemoveProcessor has missing template params when extending ApiPlatform\State\ProcessorInterface, expecting 1 (see https://psalm.dev/182)
abstract class AbstractRemoveProcessor implements ProcessorInterface {
  • Loading branch information
BacLuc authored Aug 14, 2023
1 parent 29697c0 commit 95fa58a
Show file tree
Hide file tree
Showing 24 changed files with 78 additions and 8 deletions.
3 changes: 3 additions & 0 deletions api/src/State/ActivityCreateProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
use App\Util\EntityMap;
use Doctrine\ORM\EntityManagerInterface;

/**
* @template-extends AbstractPersistProcessor<Activity>
*/
class ActivityCreateProcessor extends AbstractPersistProcessor {
public function __construct(
ProcessorInterface $decorated,
Expand Down
3 changes: 3 additions & 0 deletions api/src/State/ActivityRemoveProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
use App\State\Util\AbstractRemoveProcessor;
use Doctrine\ORM\EntityManagerInterface;

/**
* @template-extends AbstractRemoveProcessor<Activity>
*/
class ActivityRemoveProcessor extends AbstractRemoveProcessor {
public function __construct(
ProcessorInterface $decorated,
Expand Down
3 changes: 3 additions & 0 deletions api/src/State/CampCollaborationCreateProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
use Symfony\Component\PasswordHasher\Hasher\PasswordHasherFactoryInterface;
use Symfony\Component\Security\Core\Security;

/**
* @template-extends AbstractPersistProcessor<CampCollaboration>
*/
class CampCollaborationCreateProcessor extends AbstractPersistProcessor {
use CampCollaborationSendEmailTrait;

Expand Down
3 changes: 3 additions & 0 deletions api/src/State/CampCollaborationResendInvitationProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
use Symfony\Component\PasswordHasher\Hasher\PasswordHasherFactoryInterface;
use Symfony\Component\Security\Core\Security;

/**
* @template-extends AbstractPersistProcessor<CampCollaboration>
*/
class CampCollaborationResendInvitationProcessor extends AbstractPersistProcessor {
use CampCollaborationSendEmailTrait;

Expand Down
3 changes: 3 additions & 0 deletions api/src/State/CampCollaborationUpdateProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
use Symfony\Component\PasswordHasher\Hasher\PasswordHasherFactoryInterface;
use Symfony\Component\Security\Core\Security;

/**
* @template-extends AbstractPersistProcessor<CampCollaboration>
*/
class CampCollaborationUpdateProcessor extends AbstractPersistProcessor {
use CampCollaborationSendEmailTrait;

Expand Down
3 changes: 3 additions & 0 deletions api/src/State/CampCreateProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\Security\Core\Security;

/**
* @template-extends AbstractPersistProcessor<Camp>
*/
class CampCreateProcessor extends AbstractPersistProcessor {
public function __construct(
ProcessorInterface $decorated,
Expand Down
3 changes: 3 additions & 0 deletions api/src/State/CampRemoveProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
use App\State\Util\AbstractRemoveProcessor;
use Doctrine\ORM\EntityManagerInterface;

/**
* @template-extends AbstractRemoveProcessor<Camp>
*/
class CampRemoveProcessor extends AbstractRemoveProcessor {
public function __construct(
ProcessorInterface $decorated,
Expand Down
3 changes: 3 additions & 0 deletions api/src/State/CategoryCreateProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
use App\State\Util\AbstractPersistProcessor;
use Doctrine\ORM\EntityManagerInterface;

/**
* @template-extends AbstractPersistProcessor<Category>
*/
class CategoryCreateProcessor extends AbstractPersistProcessor {
public function __construct(
ProcessorInterface $decorated,
Expand Down
3 changes: 3 additions & 0 deletions api/src/State/CategoryRemoveProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
use App\State\Util\AbstractRemoveProcessor;
use Doctrine\ORM\EntityManagerInterface;

/**
* @template-extends AbstractRemoveProcessor<Category>
*/
class CategoryRemoveProcessor extends AbstractRemoveProcessor {
public function __construct(
ProcessorInterface $decorated,
Expand Down
9 changes: 5 additions & 4 deletions api/src/State/ContentNode/ContentNodePersistProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@
use App\Entity\ContentNode;
use App\State\Util\AbstractPersistProcessor;

/**
* @template T of ContentNode
*
* @template-extends AbstractPersistProcessor<T>
*/
class ContentNodePersistProcessor extends AbstractPersistProcessor {
/**
* @template T of ContentNode
*
* @param T $data
*
* @return T
*/
public function onBefore($data, Operation $operation, array $uriVariables = [], array $context = []): ContentNode {
$data = parent::onBefore($data, $operation, $uriVariables, $context);
Expand Down
3 changes: 3 additions & 0 deletions api/src/State/ContentNode/MultiSelectCreateProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
use ApiPlatform\Metadata\Operation;
use App\Entity\ContentNode\MultiSelect;

/**
* @template-extends ContentNodePersistProcessor<MultiSelect>
*/
class MultiSelectCreateProcessor extends ContentNodePersistProcessor {
/**
* @param MultiSelect $data
Expand Down
3 changes: 3 additions & 0 deletions api/src/State/ContentNode/SingleTextPersistProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
use App\Entity\ContentNode\SingleText;
use App\InputFilter\CleanHTMLFilter;

/**
* @template-extends ContentNodePersistProcessor<SingleText>
*/
class SingleTextPersistProcessor extends ContentNodePersistProcessor {
public function __construct(
ProcessorInterface $decorated,
Expand Down
3 changes: 3 additions & 0 deletions api/src/State/ContentNode/StoryboardPersistProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
use App\InputFilter\CleanTextFilter;
use Ramsey\Uuid\Uuid;

/**
* @template-extends ContentNodePersistProcessor<Storyboard>
*/
class StoryboardPersistProcessor extends ContentNodePersistProcessor {
public function __construct(
ProcessorInterface $decorated,
Expand Down
3 changes: 3 additions & 0 deletions api/src/State/InvitationAcceptProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
use Symfony\Component\PasswordHasher\Hasher\PasswordHasherFactoryInterface;
use Symfony\Component\Security\Core\Security;

/**
* @implements ProcessorInterface<Invitation>
*/
class InvitationAcceptProcessor implements ProcessorInterface {
public function __construct(
private PasswordHasherFactoryInterface $passwordHasherFactory,
Expand Down
3 changes: 3 additions & 0 deletions api/src/State/InvitationRejectProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\PasswordHasher\Hasher\PasswordHasherFactoryInterface;

/**
* @implements ProcessorInterface<Invitation>
*/
class InvitationRejectProcessor implements ProcessorInterface {
public function __construct(
private PasswordHasherFactoryInterface $passwordHasherFactory,
Expand Down
3 changes: 3 additions & 0 deletions api/src/State/PeriodPersistProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
use App\State\Util\AbstractPersistProcessor;
use App\Util\DateTimeUtil;

/**
* @template-extends AbstractPersistProcessor<Period>
*/
class PeriodPersistProcessor extends AbstractPersistProcessor {
public function __construct(
ProcessorInterface $decorated
Expand Down
3 changes: 3 additions & 0 deletions api/src/State/ProfileUpdateProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
use Symfony\Component\PasswordHasher\Hasher\PasswordHasherFactoryInterface;
use Symfony\Component\PasswordHasher\PasswordHasherInterface;

/**
* @template-extends AbstractPersistProcessor<Profile>
*/
class ProfileUpdateProcessor extends AbstractPersistProcessor {
public function __construct(
ProcessorInterface $decorated,
Expand Down
3 changes: 3 additions & 0 deletions api/src/State/ResetPasswordCreateProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
use Symfony\Component\PasswordHasher\Hasher\PasswordHasherFactoryInterface;
use Symfony\Component\PasswordHasher\PasswordHasherInterface;

/**
* @implements ProcessorInterface<ResetPassword>
*/
class ResetPasswordCreateProcessor implements ProcessorInterface {
public function __construct(
private ReCaptcha $reCaptcha,
Expand Down
3 changes: 3 additions & 0 deletions api/src/State/ResetPasswordUpdateProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
use Symfony\Component\PasswordHasher\Hasher\PasswordHasherFactoryInterface;
use Symfony\Component\PasswordHasher\PasswordHasherInterface;

/**
* @implements ProcessorInterface<ResetPassword>
*/
class ResetPasswordUpdateProcessor implements ProcessorInterface {
public function __construct(
private ReCaptcha $reCaptcha,
Expand Down
3 changes: 3 additions & 0 deletions api/src/State/UserActivateProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
use App\State\Util\AbstractPersistProcessor;
use Symfony\Component\HttpKernel\Exception\HttpException;

/**
* @template-extends AbstractPersistProcessor<User>
*/
class UserActivateProcessor extends AbstractPersistProcessor {
public function __construct(
ProcessorInterface $decorated
Expand Down
3 changes: 3 additions & 0 deletions api/src/State/UserCreateProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
use Symfony\Component\HttpKernel\Exception\HttpException;
use Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface;

/**
* @template-extends AbstractPersistProcessor<User>
*/
class UserCreateProcessor extends AbstractPersistProcessor {
public function __construct(
ProcessorInterface $decorated,
Expand Down
3 changes: 3 additions & 0 deletions api/src/State/UserUpdateProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
use App\State\Util\AbstractPersistProcessor;
use Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface;

/**
* @template-extends AbstractPersistProcessor<User>
*/
class UserUpdateProcessor extends AbstractPersistProcessor {
public function __construct(
ProcessorInterface $decorated,
Expand Down
9 changes: 5 additions & 4 deletions api/src/State/Util/AbstractPersistProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
use ApiPlatform\State\ProcessorInterface;
use App\Entity\BaseEntity;

/**
* @template T
*
* @template-implements ProcessorInterface<T>
*/
abstract class AbstractPersistProcessor implements ProcessorInterface {
/**
* @param PropertyChangeListener[] $propertyChangeListeners
Expand All @@ -22,8 +27,6 @@ public function __construct(
}

/**
* @template T
*
* @param T $data
*
* @return T
Expand Down Expand Up @@ -62,8 +65,6 @@ public function process(mixed $data, Operation $operation, array $uriVariables =
/**
* Return an object of the type and with the properties you want persisted.
*
* @template T of BaseEntity
*
* @param T $data
*
* @return T
Expand Down
5 changes: 5 additions & 0 deletions api/src/State/Util/AbstractRemoveProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
use ApiPlatform\Metadata\Operation;
use ApiPlatform\State\ProcessorInterface;

/**
* @template T
*
* @template-implements ProcessorInterface<T>
*/
abstract class AbstractRemoveProcessor implements ProcessorInterface {
public function __construct(
private ProcessorInterface $decorated,
Expand Down

0 comments on commit 95fa58a

Please sign in to comment.