]> Raphaël G. Git Repositories - userbundle/commitdiff
Strict types
authorRaphaël Gertz <git@rapsys.eu>
Thu, 7 Mar 2024 17:46:25 +0000 (18:46 +0100)
committerRaphaël Gertz <git@rapsys.eu>
Thu, 7 Mar 2024 17:46:25 +0000 (18:46 +0100)
Cleanup

Entity/Civility.php
Entity/Group.php
Entity/User.php

index ea8b95b1a0ec1c3ed5c6c0c884b6aea759c2fd6b..d1ccec37fe9b787d62f7337b65d2ed34cf254c21 100644 (file)
@@ -11,6 +11,7 @@
 
 namespace Rapsys\UserBundle\Entity;
 
+use Doctrine\Common\Collections\Collection;
 use Doctrine\Common\Collections\ArrayCollection;
 use Doctrine\ORM\Event\PreUpdateEventArgs;
 
@@ -23,36 +24,30 @@ class Civility {
        /**
         * @var integer
         */
-       protected $id;
-
-       /**
-        * @var string
-        */
-       protected $title;
+       protected int $id;
 
        /**
         * @var \DateTime
         */
-       protected $created;
+       protected \DateTime $created;
 
        /**
         * @var \DateTime
         */
-       protected $updated;
+       protected \DateTime $updated;
 
        /**
         * @var ArrayCollection
         */
-       protected $users;
+       protected Collection $users;
 
        /**
         * Constructor
         *
         * @param string $title The civility name
         */
-       public function __construct(string $title) {
+       public function __construct(protected string $title) {
                //Set defaults
-               $this->title = $title;
                $this->created = new \DateTime('now');
                $this->updated = new \DateTime('now');
                $this->users = new ArrayCollection();
index aa60f77e0f9e48c3a77a1a42f6aa154b53e89806..d1550026cbdfc986c58f7b2066b333ec46b05fcc 100644 (file)
@@ -11,6 +11,7 @@
 
 namespace Rapsys\UserBundle\Entity;
 
+use Doctrine\Common\Collections\Collection;
 use Doctrine\Common\Collections\ArrayCollection;
 use Doctrine\ORM\Event\PreUpdateEventArgs;
 
@@ -23,36 +24,30 @@ class Group {
        /**
         * @var integer
         */
-       protected $id;
-
-       /**
-        * @var string
-        */
-       protected $title;
+       protected int $id;
 
        /**
         * @var \DateTime
         */
-       protected $created;
+       protected \DateTime $created;
 
        /**
         * @var \DateTime
         */
-       protected $updated;
+       protected \DateTime $updated;
 
        /**
         * @var ArrayCollection
         */
-       protected $users;
+       protected Collection $users;
 
        /**
         * Constructor
         *
         * @param string $title The group name
         */
-       public function __construct(string $title) {
+       public function __construct(protected string $title) {
                //Set defaults
-               $this->title = $title;
                $this->created = new \DateTime('now');
                $this->updated = new \DateTime('now');
                $this->users = new ArrayCollection();
@@ -85,7 +80,7 @@ class Group {
         *
         * @return string
         */
-       public function getTitle(): ?string {
+       public function getTitle(): string {
                return $this->title;
        }
 
index 299303bea98e3d116a29370d1f670f09af786390..380c7ffa1660b83a53fdbd9ab3ed88e65c1d4670 100644 (file)
@@ -14,6 +14,7 @@ namespace Rapsys\UserBundle\Entity;
 use Doctrine\Common\Collections\Collection;
 use Doctrine\Common\Collections\ArrayCollection;
 use Doctrine\ORM\Event\PreUpdateEventArgs;
+
 use Symfony\Component\Security\Core\User\UserInterface;
 use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
 
@@ -154,10 +155,10 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface {
        }
 
        /**
-        * Get password
-        *
         * {@inheritdoc}
         *
+        * Get password
+        *
         * @return string
         */
        public function getPassword(): string {