]> Raphaël G. Git Repositories - userbundle/blobdiff - Entity/Civility.php
Add strict
[userbundle] / Entity / Civility.php
index 83c7f47ef4b1d7359452c0108291a6c0207d0df9..f3509194542f2ac3711badf984c9d172b5c61c59 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,15 +40,18 @@ class Civility {
        protected $updated;
 
        /**
        protected $updated;
 
        /**
-        * @var \Doctrine\Common\Collections\Collection
+        * @var ArrayCollection
         */
        protected $users;
 
        /**
         * Constructor
         */
        protected $users;
 
        /**
         * Constructor
+        *
+        * @param string $title The civility name
         */
         */
-       public function __construct() {
-               $this->users = new \Doctrine\Common\Collections\ArrayCollection();
+       public function __construct(string $title) {
+               $this->title = $title;
+               $this->users = new ArrayCollection();
        }
 
        /**
        }
 
        /**
@@ -43,7 +59,7 @@ class Civility {
         *
         * @return integer
         */
         *
         * @return integer
         */
-       public function getId() {
+       public function getId(): int {
                return $this->id;
        }
 
                return $this->id;
        }
 
@@ -54,7 +70,7 @@ class Civility {
         *
         * @return Civility
         */
         *
         * @return Civility
         */
-       public function setTitle($title) {
+       public function setTitle(string $title): Civility {
                $this->title = $title;
 
                return $this;
                $this->title = $title;
 
                return $this;
@@ -65,7 +81,7 @@ class Civility {
         *
         * @return string
         */
         *
         * @return string
         */
-       public function getTitle() {
+       public function getTitle(): ?string {
                return $this->title;
        }
 
                return $this->title;
        }
 
@@ -76,7 +92,7 @@ class Civility {
         *
         * @return Civility
         */
         *
         * @return Civility
         */
-       public function setCreated($created) {
+       public function setCreated(\DateTime $created): Civility {
                $this->created = $created;
 
                return $this;
                $this->created = $created;
 
                return $this;
@@ -87,7 +103,7 @@ class Civility {
         *
         * @return \DateTime
         */
         *
         * @return \DateTime
         */
-       public function getCreated() {
+       public function getCreated(): \DateTime {
                return $this->created;
        }
 
                return $this->created;
        }
 
@@ -98,7 +114,7 @@ class Civility {
         *
         * @return Civility
         */
         *
         * @return Civility
         */
-       public function setUpdated($updated) {
+       public function setUpdated(\DateTime $updated): Civility {
                $this->updated = $updated;
 
                return $this;
                $this->updated = $updated;
 
                return $this;
@@ -109,18 +125,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 +145,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;
        }