From 7016373ced8b32607eb5c4a0fc144ef9a3b409c0 Mon Sep 17 00:00:00 2001 From: Andrew Longosz Date: Fri, 19 Jul 2024 16:50:35 +0200 Subject: [PATCH] [Rector] Applied all Symfony 5.x rectors to the production codebase Applied rules: * AddReturnTypeDeclarationRector * AnnotationToAttributeRector * CommandConstantReturnCodeRector --- src/bundle/Command/AuditUserDatabaseCommand.php | 2 +- src/lib/Form/Data/UserInvitationData.php | 11 +++-------- src/lib/Form/Data/UserPasswordChangeData.php | 6 ++---- src/lib/Form/Data/UserPasswordForgotData.php | 3 +-- src/lib/Form/Data/UserPasswordForgotWithLoginData.php | 3 +-- src/lib/Form/Data/UserPasswordResetData.php | 3 +-- src/lib/Form/Data/UserSettingUpdateData.php | 4 +--- src/lib/Form/Processor/UserRegisterFormProcessor.php | 2 +- src/lib/Form/Type/UserRegisterType.php | 4 ++-- 9 files changed, 13 insertions(+), 25 deletions(-) diff --git a/src/bundle/Command/AuditUserDatabaseCommand.php b/src/bundle/Command/AuditUserDatabaseCommand.php index edd3f90..48c6b60 100644 --- a/src/bundle/Command/AuditUserDatabaseCommand.php +++ b/src/bundle/Command/AuditUserDatabaseCommand.php @@ -109,7 +109,7 @@ public function execute( $output->writeln(''); $output->writeln('Done.'); - return 0; + return Command::SUCCESS; } /** diff --git a/src/lib/Form/Data/UserInvitationData.php b/src/lib/Form/Data/UserInvitationData.php index 8f52141..b9b3932 100644 --- a/src/lib/Form/Data/UserInvitationData.php +++ b/src/lib/Form/Data/UserInvitationData.php @@ -16,18 +16,13 @@ final class UserInvitationData { - /** - * @Assert\NotBlank() - * - * @Assert\Email() - */ + #[Assert\NotBlank] + #[Assert\Email] private string $email; private ?Role $role; - /** - * @Assert\NotBlank() - */ + #[Assert\NotBlank] private ?SiteAccess $siteaccess; private ?UserGroup $userGroup; diff --git a/src/lib/Form/Data/UserPasswordChangeData.php b/src/lib/Form/Data/UserPasswordChangeData.php index bd7ac16..e3a7064 100644 --- a/src/lib/Form/Data/UserPasswordChangeData.php +++ b/src/lib/Form/Data/UserPasswordChangeData.php @@ -16,17 +16,15 @@ class UserPasswordChangeData /** * @UserAssert\UserPassword() * - * @Assert\NotBlank() - * * @var string */ + #[Assert\NotBlank] private $oldPassword; /** - * @Assert\NotBlank() - * * @var string */ + #[Assert\NotBlank] private $newPassword; /** diff --git a/src/lib/Form/Data/UserPasswordForgotData.php b/src/lib/Form/Data/UserPasswordForgotData.php index 5827dc7..cfb1b42 100644 --- a/src/lib/Form/Data/UserPasswordForgotData.php +++ b/src/lib/Form/Data/UserPasswordForgotData.php @@ -13,10 +13,9 @@ class UserPasswordForgotData { /** - * @Assert\NotBlank() - * * @var string */ + #[Assert\NotBlank] private $email; /** diff --git a/src/lib/Form/Data/UserPasswordForgotWithLoginData.php b/src/lib/Form/Data/UserPasswordForgotWithLoginData.php index 333e759..fd0213f 100644 --- a/src/lib/Form/Data/UserPasswordForgotWithLoginData.php +++ b/src/lib/Form/Data/UserPasswordForgotWithLoginData.php @@ -13,10 +13,9 @@ class UserPasswordForgotWithLoginData { /** - * @Assert\NotBlank() - * * @var string */ + #[Assert\NotBlank] private $login; /** diff --git a/src/lib/Form/Data/UserPasswordResetData.php b/src/lib/Form/Data/UserPasswordResetData.php index 9e8bcd3..033d873 100644 --- a/src/lib/Form/Data/UserPasswordResetData.php +++ b/src/lib/Form/Data/UserPasswordResetData.php @@ -14,10 +14,9 @@ class UserPasswordResetData { /** - * @Assert\NotBlank() - * * @var string */ + #[Assert\NotBlank] private $newPassword; /** diff --git a/src/lib/Form/Data/UserSettingUpdateData.php b/src/lib/Form/Data/UserSettingUpdateData.php index 020b441..1609db7 100644 --- a/src/lib/Form/Data/UserSettingUpdateData.php +++ b/src/lib/Form/Data/UserSettingUpdateData.php @@ -12,9 +12,7 @@ class UserSettingUpdateData { - /** - * @Assert\NotBlank() - */ + #[Assert\NotBlank] private string $identifier; /** diff --git a/src/lib/Form/Processor/UserRegisterFormProcessor.php b/src/lib/Form/Processor/UserRegisterFormProcessor.php index ad0a5d4..8f3441c 100644 --- a/src/lib/Form/Processor/UserRegisterFormProcessor.php +++ b/src/lib/Form/Processor/UserRegisterFormProcessor.php @@ -53,7 +53,7 @@ public function __construct( $this->notificationService = $notificationService; } - public static function getSubscribedEvents() + public static function getSubscribedEvents(): array { return [ UserFormEvents::USER_REGISTER => ['processRegister', 20], diff --git a/src/lib/Form/Type/UserRegisterType.php b/src/lib/Form/Type/UserRegisterType.php index 8b4318c..e8c3804 100644 --- a/src/lib/Form/Type/UserRegisterType.php +++ b/src/lib/Form/Type/UserRegisterType.php @@ -38,12 +38,12 @@ public function getName() return $this->getBlockPrefix(); } - public function getBlockPrefix() + public function getBlockPrefix(): string { return 'ezplatform_content_forms_user_register'; } - public function getParent() + public function getParent(): ?string { return BaseContentType::class; }