From 91c214eab6b2a6b49a618aa255b6460c538b6459 Mon Sep 17 00:00:00 2001 From: Norbert Schvoy Date: Wed, 1 Dec 2021 12:15:42 +0100 Subject: [PATCH] Replace annotations to PHP8 attributes --- CHANGELOG.md | 13 ++++++++ src/DependencyInjection/UserExtension.php | 6 ---- src/Entity/User.php | 38 +++-------------------- src/Repository/UserRepository.php | 7 ----- src/Security/PasswordUpdater.php | 10 ------ src/Security/PasswordUpdaterInterface.php | 6 ---- 6 files changed, 18 insertions(+), 62 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9d90c3a..178537a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,18 @@ # Changelog +## 0.7.0 + +### Change + +* Replace annotations to PHP8 attributes +* Remove unnecessary doc blocks + +## 0.6.1 + +### Change + +* Update to PHP8 + ## 0.6.0 ### Change diff --git a/src/DependencyInjection/UserExtension.php b/src/DependencyInjection/UserExtension.php index a3e98f2..e793b61 100644 --- a/src/DependencyInjection/UserExtension.php +++ b/src/DependencyInjection/UserExtension.php @@ -21,12 +21,6 @@ class UserExtension extends AbstractExtension { - /** - * @param array $configs - * @param ContainerBuilder $container - * - * @throws Exception - */ public function load(array $configs, ContainerBuilder $container): void { $loader = new YamlFileLoader( diff --git a/src/Entity/User.php b/src/Entity/User.php index 0273163..f02da42 100644 --- a/src/Entity/User.php +++ b/src/Entity/User.php @@ -13,55 +13,33 @@ namespace EightMarq\UserBundle\Entity; +use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; use EightMarq\CoreBundle\Entity\BaseEntity; use Symfony\Component\Security\Core\User\UserInterface; -/** - * @ORM\MappedSuperclass() - */ +#[ORM\MappedSuperclass] class User extends BaseEntity implements UserInterface { - /** - * @var string - * - * @ORM\Column(type="string", length=180, unique=true) - */ + #[ORM\Column(type: Types::STRING, length: 180, unique: true)] protected string $email; - /** - * @var array - * - * @ORM\Column(type="json") - */ + #[ORM\Column(type: Types::JSON)] protected array $roles = []; - /** - * @var string - * - * @ORM\Column(type="string") - */ + #[ORM\Column(type: Types::STRING)] protected string $password; - /** - * @return string - */ public function __toString() { return $this->getEmail(); } - /** - * @return string - */ public function getEmail(): string { return $this->email; } - /** - * @param string $email - */ public function setEmail(string $email): void { $this->email = $email; @@ -90,9 +68,6 @@ public function getRoles(): array return array_unique($roles); } - /** - * @param array $roles - */ public function setRoles(array $roles): void { $this->roles = $roles; @@ -106,9 +81,6 @@ public function getPassword(): string return (string)$this->password; } - /** - * @param string $password - */ public function setPassword(string $password): void { $this->password = $password; diff --git a/src/Repository/UserRepository.php b/src/Repository/UserRepository.php index 1ed9e50..13de7b8 100644 --- a/src/Repository/UserRepository.php +++ b/src/Repository/UserRepository.php @@ -30,10 +30,6 @@ */ abstract class UserRepository extends ServiceEntityRepository implements PasswordUpgraderInterface { - /** - * @param ManagerRegistry $registry - * @param string $entityClass - */ public function __construct(ManagerRegistry $registry, string $entityClass = User::class) { parent::__construct($registry, $entityClass); @@ -42,9 +38,6 @@ public function __construct(ManagerRegistry $registry, string $entityClass = Use /** * Used to upgrade (rehash) the user's password automatically over time. * - * @param UserInterface $user - * @param string $newEncodedPassword - * * @throws ORMException * @throws OptimisticLockException */ diff --git a/src/Security/PasswordUpdater.php b/src/Security/PasswordUpdater.php index 8fc3a97..dd0c9dd 100644 --- a/src/Security/PasswordUpdater.php +++ b/src/Security/PasswordUpdater.php @@ -18,23 +18,13 @@ class PasswordUpdater implements PasswordUpdaterInterface { - /** - * @var EncoderFactoryInterface - */ protected EncoderFactoryInterface $encoderFactory; - /** - * @param EncoderFactoryInterface $encoderFactory - */ public function __construct(EncoderFactoryInterface $encoderFactory) { $this->encoderFactory = $encoderFactory; } - /** - * @param UserInterface $user - * @param string $plainPassword - */ public function hashPassword(UserInterface $user, string $plainPassword): void { if (strlen($plainPassword) === 0) { diff --git a/src/Security/PasswordUpdaterInterface.php b/src/Security/PasswordUpdaterInterface.php index f267d69..4555136 100644 --- a/src/Security/PasswordUpdaterInterface.php +++ b/src/Security/PasswordUpdaterInterface.php @@ -17,11 +17,5 @@ interface PasswordUpdaterInterface { - /** - * @param UserInterface $user - * @param string $plainPassword - * - * @return void - */ public function hashPassword(UserInterface $user, string $plainPassword): void; } \ No newline at end of file