Skip to content

Commit

Permalink
Replace annotations to PHP8 attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
schvoy committed Dec 1, 2021
1 parent 51c2b98 commit 91c214e
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 62 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
6 changes: 0 additions & 6 deletions src/DependencyInjection/UserExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
38 changes: 5 additions & 33 deletions src/Entity/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -90,9 +68,6 @@ public function getRoles(): array
return array_unique($roles);
}

/**
* @param array $roles
*/
public function setRoles(array $roles): void
{
$this->roles = $roles;
Expand All @@ -106,9 +81,6 @@ public function getPassword(): string
return (string)$this->password;
}

/**
* @param string $password
*/
public function setPassword(string $password): void
{
$this->password = $password;
Expand Down
7 changes: 0 additions & 7 deletions src/Repository/UserRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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
*/
Expand Down
10 changes: 0 additions & 10 deletions src/Security/PasswordUpdater.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
6 changes: 0 additions & 6 deletions src/Security/PasswordUpdaterInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,5 @@

interface PasswordUpdaterInterface
{
/**
* @param UserInterface $user
* @param string $plainPassword
*
* @return void
*/
public function hashPassword(UserInterface $user, string $plainPassword): void;
}

0 comments on commit 91c214e

Please sign in to comment.