From aecd79b0af016492323465e0526dbbbd94178976 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rapha=C3=ABl=20Gertz?= Date: Fri, 8 Mar 2024 01:23:04 +0100 Subject: [PATCH] Fix header comment Add default values to class member variables Strict types Cleanup --- Entity/Dance.php | 43 ++++++++++++++++--------------------------- 1 file changed, 16 insertions(+), 27 deletions(-) diff --git a/Entity/Dance.php b/Entity/Dance.php index 0b132c8..6ae5f1b 100644 --- a/Entity/Dance.php +++ b/Entity/Dance.php @@ -1,16 +1,17 @@ + * (c) Raphaël Gertz * - * for the full copyright and license information, please view the license + * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Rapsys\AirBundle\Entity; +use Doctrine\Common\Collections\Collection; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\ORM\Event\PreUpdateEventArgs; @@ -19,39 +20,29 @@ use Doctrine\ORM\Event\PreUpdateEventArgs; */ class Dance { /** - * @var integer + * Primary key */ - private $id; + private ?int $id = null; /** - * @var string + * Create datetime */ - protected $name; + private \DateTime $created; /** - * @var string + * Update datetime */ - protected $type; + private \DateTime $updated; /** - * @var \DateTime + * Applications collection */ - private $created; + private Collection $applications; /** - * @var \DateTime + * Users collection */ - private $updated; - - /** - * @var ArrayCollection - */ - private $applications; - - /** - * @var ArrayCollection - */ - private $users; + private Collection $users; /** * Constructor @@ -59,10 +50,8 @@ class Dance { * @param string $name The dance name * @param string $type The dance type */ - public function __construct(string $name, string $type) { + public function __construct(private string $name, private string $type) { //Set defaults - $this->name = $name; - $this->type = $type; $this->created = new \DateTime('now'); $this->updated = new \DateTime('now'); @@ -76,7 +65,7 @@ class Dance { * * @return integer */ - public function getId(): int { + public function getId(): ?int { return $this->id; } -- 2.41.0