]> Raphaël G. Git Repositories - userbundle/commitdiff
Add strict type
authorRaphaël Gertz <git@rapsys.eu>
Thu, 12 Aug 2021 12:39:50 +0000 (14:39 +0200)
committerRaphaël Gertz <git@rapsys.eu>
Thu, 12 Aug 2021 12:40:12 +0000 (14:40 +0200)
Cleanup

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

index 83c7f47ef4b1d7359452c0108291a6c0207d0df9..8e1719c22ec465bfa0cae13c39cfba358acf15f7 100644 (file)
@@ -1,7 +1,20 @@
-<?php
+<?php declare(strict_types=1);
+
+/*
+ * This file is part of the Rapsys PackBundle package.
+ *
+ * (c) Raphaël Gertz <symfony@rapsys.eu>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
 
 namespace Rapsys\UserBundle\Entity;
 
 
 namespace Rapsys\UserBundle\Entity;
 
+use Doctrine\Common\Collections\ArrayCollection;
+
+use Rapsys\UserBundle\Entity\User;
+
 /**
  * Civility
  */
 /**
  * Civility
  */
@@ -27,7 +40,7 @@ class Civility {
        protected $updated;
 
        /**
        protected $updated;
 
        /**
-        * @var \Doctrine\Common\Collections\Collection
+        * @var ArrayCollection
         */
        protected $users;
 
         */
        protected $users;
 
@@ -35,7 +48,7 @@ class Civility {
         * Constructor
         */
        public function __construct() {
         * Constructor
         */
        public function __construct() {
-               $this->users = new \Doctrine\Common\Collections\ArrayCollection();
+               $this->users = new ArrayCollection();
        }
 
        /**
        }
 
        /**
@@ -43,7 +56,7 @@ class Civility {
         *
         * @return integer
         */
         *
         * @return integer
         */
-       public function getId() {
+       public function getId(): int {
                return $this->id;
        }
 
                return $this->id;
        }
 
@@ -54,7 +67,7 @@ class Civility {
         *
         * @return Civility
         */
         *
         * @return Civility
         */
-       public function setTitle($title) {
+       public function setTitle(string $title) {
                $this->title = $title;
 
                return $this;
                $this->title = $title;
 
                return $this;
@@ -65,7 +78,7 @@ class Civility {
         *
         * @return string
         */
         *
         * @return string
         */
-       public function getTitle() {
+       public function getTitle(): ?string {
                return $this->title;
        }
 
                return $this->title;
        }
 
@@ -76,7 +89,7 @@ class Civility {
         *
         * @return Civility
         */
         *
         * @return Civility
         */
-       public function setCreated($created) {
+       public function setCreated(\DateTime $created) {
                $this->created = $created;
 
                return $this;
                $this->created = $created;
 
                return $this;
@@ -87,7 +100,7 @@ class Civility {
         *
         * @return \DateTime
         */
         *
         * @return \DateTime
         */
-       public function getCreated() {
+       public function getCreated(): \DateTime {
                return $this->created;
        }
 
                return $this->created;
        }
 
@@ -98,7 +111,7 @@ class Civility {
         *
         * @return Civility
         */
         *
         * @return Civility
         */
-       public function setUpdated($updated) {
+       public function setUpdated(\DateTime $updated) {
                $this->updated = $updated;
 
                return $this;
                $this->updated = $updated;
 
                return $this;
@@ -109,18 +122,18 @@ class Civility {
         *
         * @return \DateTime
         */
         *
         * @return \DateTime
         */
-       public function getUpdated() {
+       public function getUpdated(): \DateTime {
                return $this->updated;
        }
 
        /**
         * Add user
         *
                return $this->updated;
        }
 
        /**
         * Add user
         *
-        * @param \Rapsys\UserBundle\Entity\User $user
+        * @param User $user
         *
         * @return Civility
         */
         *
         * @return Civility
         */
-       public function addUser(\Rapsys\UserBundle\Entity\User $user) {
+       public function addUser(User $user): Civility {
                $this->users[] = $user;
 
                return $this;
                $this->users[] = $user;
 
                return $this;
@@ -129,18 +142,18 @@ class Civility {
        /**
         * Remove user
         *
        /**
         * Remove user
         *
-        * @param \Rapsys\UserBundle\Entity\User $user
+        * @param User $user
         */
         */
-       public function removeUser(\Rapsys\UserBundle\Entity\User $user) {
+       public function removeUser(User $user) {
                $this->users->removeElement($user);
        }
 
        /**
         * Get users
         *
                $this->users->removeElement($user);
        }
 
        /**
         * Get users
         *
-        * @return \Doctrine\Common\Collections\Collection
+        * @return ArrayCollection
         */
         */
-       public function getUsers() {
+       public function getUsers(): ArrayCollection {
                return $this->users;
        }
 
                return $this->users;
        }
 
index c503b2f7894f0c07204b9ec7213e486c2a56df23..1141f91dca6ff863f378ae3e7dfd594ed8f02983 100644 (file)
@@ -1,8 +1,23 @@
-<?php
+<?php declare(strict_types=1);
+
+/*
+ * This file is part of the Rapsys PackBundle package.
+ *
+ * (c) Raphaël Gertz <symfony@rapsys.eu>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
 
 
-// src/Rapsys/UserBundle/Entity/Group.php
 namespace Rapsys\UserBundle\Entity;
 
 namespace Rapsys\UserBundle\Entity;
 
+use Doctrine\Common\Collections\ArrayCollection;
+
+use Rapsys\UserBundle\Entity\User;
+
+/**
+ * Group
+ */
 class Group {
        /**
         * @var integer
 class Group {
        /**
         * @var integer
@@ -25,7 +40,7 @@ class Group {
        protected $updated;
 
        /**
        protected $updated;
 
        /**
-        * @var \Doctrine\Common\Collections\Collection
+        * @var ArrayCollection
         */
        protected $users;
 
         */
        protected $users;
 
@@ -36,7 +51,7 @@ class Group {
         */
        public function __construct(string $title) {
                $this->title = (string) $title;
         */
        public function __construct(string $title) {
                $this->title = (string) $title;
-               $this->users = new \Doctrine\Common\Collections\ArrayCollection();
+               $this->users = new ArrayCollection();
        }
 
        /**
        }
 
        /**
@@ -44,7 +59,7 @@ class Group {
         *
         * @return integer
         */
         *
         * @return integer
         */
-       public function getId() {
+       public function getId(): int {
                return $this->id;
        }
 
                return $this->id;
        }
 
@@ -55,7 +70,7 @@ class Group {
         *
         * @return User
         */
         *
         * @return User
         */
-       public function setTitle($title) {
+       public function setTitle(string $title) {
                $this->title = $title;
 
                return $this;
                $this->title = $title;
 
                return $this;
@@ -66,7 +81,7 @@ class Group {
         *
         * @return string
         */
         *
         * @return string
         */
-       public function getTitle() {
+       public function getTitle(): ?string {
                return $this->title;
        }
 
                return $this->title;
        }
 
@@ -77,7 +92,7 @@ class Group {
         *
         * @return User
         */
         *
         * @return User
         */
-       public function setCreated($created) {
+       public function setCreated(\DateTime $created) {
                $this->created = $created;
 
                return $this;
                $this->created = $created;
 
                return $this;
@@ -88,7 +103,7 @@ class Group {
         *
         * @return \DateTime
         */
         *
         * @return \DateTime
         */
-       public function getCreated() {
+       public function getCreated(): \DateTime {
                return $this->created;
        }
 
                return $this->created;
        }
 
@@ -99,7 +114,7 @@ class Group {
         *
         * @return User
         */
         *
         * @return User
         */
-       public function setUpdated($updated) {
+       public function setUpdated(\DateTime $updated) {
                $this->updated = $updated;
 
                return $this;
                $this->updated = $updated;
 
                return $this;
@@ -110,18 +125,18 @@ class Group {
         *
         * @return \DateTime
         */
         *
         * @return \DateTime
         */
-       public function getUpdated() {
+       public function getUpdated(): \DateTime {
                return $this->updated;
        }
 
        /**
         * Add user
         *
                return $this->updated;
        }
 
        /**
         * Add user
         *
-        * @param \Rapsys\UserBundle\Entity\User $user
+        * @param User $user
         *
         * @return Group
         */
         *
         * @return Group
         */
-       public function addUser(\Rapsys\UserBundle\Entity\User $user) {
+       public function addUser(User $user) {
                $this->users[] = $user;
 
                return $this;
                $this->users[] = $user;
 
                return $this;
@@ -130,18 +145,18 @@ class Group {
        /**
         * Remove user
         *
        /**
         * Remove user
         *
-        * @param \Rapsys\UserBundle\Entity\User $user
+        * @param User $user
         */
         */
-       public function removeUser(\Rapsys\UserBundle\Entity\User $user) {
+       public function removeUser(User $user) {
                $this->users->removeElement($user);
        }
 
        /**
         * Get users
         *
                $this->users->removeElement($user);
        }
 
        /**
         * Get users
         *
-        * @return \Doctrine\Common\Collections\Collection
+        * @return ArrayCollection
         */
         */
-       public function getUsers() {
+       public function getUsers(): ArrayCollection {
                return $this->users;
        }
 
                return $this->users;
        }
 
@@ -159,7 +174,7 @@ class Group {
         *
         * @return string
         */
         *
         * @return string
         */
-       public function getRole() {
+       public function getRole(): string {
                return 'ROLE_'.strtoupper($this->title);
        }
 }
                return 'ROLE_'.strtoupper($this->title);
        }
 }
index 3c1c7686100f13a69bd7a486afe0f69e52c25f25..8e6a671f78aee694710f634a49856d0f80d45e78 100644 (file)
@@ -1,13 +1,25 @@
-<?php
+<?php declare(strict_types=1);
+
+/*
+ * this file is part of the rapsys packbundle package.
+ *
+ * (c) raphaël gertz <symfony@rapsys.eu>
+ *
+ * for the full copyright and license information, please view the license
+ * file that was distributed with this source code.
+ */
 
 
-// src/Rapsys/UserBundle/Entity/User.php
 namespace Rapsys\UserBundle\Entity;
 
 namespace Rapsys\UserBundle\Entity;
 
-use Rapsys\UserBundle\Entity\Group;
-use Symfony\Component\Security\Core\User\UserInterface;
 use Doctrine\Common\Collections\ArrayCollection;
 use Doctrine\Common\Collections\ArrayCollection;
+use Symfony\Component\Security\Core\User\UserInterface;
+
 use Rapsys\UserBundle\Entity\Civility;
 use Rapsys\UserBundle\Entity\Civility;
+use Rapsys\UserBundle\Entity\Group;
 
 
+/**
+ * User
+ */
 class User implements UserInterface, \Serializable {
        /**
         * @var integer
 class User implements UserInterface, \Serializable {
        /**
         * @var integer
@@ -60,12 +72,12 @@ class User implements UserInterface, \Serializable {
        protected $updated;
 
        /**
        protected $updated;
 
        /**
-        * @var \Rapsys\UserBundle\Entity\Civility
+        * @var Civility
         */
        protected $civility;
 
        /**
         */
        protected $civility;
 
        /**
-        * @var \Doctrine\Common\Collections\ArrayCollection
+        * @var ArrayCollection
         */
        protected $groups;
 
         */
        protected $groups;
 
@@ -306,7 +318,7 @@ class User implements UserInterface, \Serializable {
        /**
         * Add group
         *
        /**
         * Add group
         *
-        * @param \Rapsys\UserBundle\Entity\Group $group
+        * @param Group $group
         *
         * @return User
         */
         *
         * @return User
         */
@@ -319,7 +331,7 @@ class User implements UserInterface, \Serializable {
        /**
         * Remove group
         *
        /**
         * Remove group
         *
-        * @param \Rapsys\UserBundle\Entity\Group $group
+        * @param Group $group
         */
        public function removeGroup(Group $group) {
                $this->groups->removeElement($group);
         */
        public function removeGroup(Group $group) {
                $this->groups->removeElement($group);
@@ -328,7 +340,7 @@ class User implements UserInterface, \Serializable {
        /**
         * Get groups
         *
        /**
         * Get groups
         *
-        * @return \Doctrine\Common\Collections\ArrayCollection
+        * @return ArrayCollection
         */
        public function getGroups(): ArrayCollection {
                return $this->groups;
         */
        public function getGroups(): ArrayCollection {
                return $this->groups;