Add default values to class member variables
Strict types
Cleanup
<?php declare(strict_types=1);
/*
<?php declare(strict_types=1);
/*
- * this file is part of the rapsys packbundle package.
+ * This file is part of the Rapsys AirBundle package.
- * (c) raphaël gertz <symfony@rapsys.eu>
+ * (c) Raphaël Gertz <symfony@rapsys.eu>
- * 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.
*/
* file that was distributed with this source code.
*/
- * @var integer
- */
- private $id;
-
- /**
- * @var string
+ private ?int $id = null;
- protected $description;
+ private ?string $description = null;
+ private ?string $class = null;
+ private ?string $short = null;
+ private ?int $rate = null;
+ private ?bool $hat = null;
+ private ?string $contact = null;
+ private ?string $donate = null;
+ private ?string $link = null;
- protected $profile;
-
- /**
- * @var \DateTime
- */
- protected $created;
-
- /**
- * @var \DateTime
- */
- protected $updated;
+ private ?string $profile = null;
+ private \DateTime $created;
+ private \DateTime $updated;
+ *
+ * @param string $locale The locale
+ * @param Location $location The location instance
+ * @param User $user The user instance
- public function __construct() {
+ public function __construct(private string $locale, private Location $location, private User $user) {
- $this->description = null;
- $this->class = null;
- $this->short = null;
- $this->rate = null;
- $this->hat = null;
- $this->contact = null;
- $this->donate = null;
- $this->link = null;
- $this->profile = null;
- $this->location = null;
$this->created = new \DateTime('now');
$this->updated = new \DateTime('now');
}
$this->created = new \DateTime('now');
$this->updated = new \DateTime('now');
}
- public function getId(): int {
+ public function getId(): ?int {
- public function setLocation(Location $location) {
+ public function setLocation(Location $location): Snippet {
$this->location = $location;
return $this;
$this->location = $location;
return $this;
- public function getLocation() {
+ public function getLocation(): Location {
return $this->location;
}
return $this->location;
}
- public function setUser(User $user) {
+ public function setUser(User $user): Snippet {
$this->user = $user;
return $this;
$this->user = $user;
return $this;
- public function getUser() {
+ public function getUser(): User {