chore: cleanup, add PHPStan type annotations

This commit is contained in:
Björn Fromme
2026-04-03 13:45:41 +02:00
parent a264526127
commit fce6d1615a
14 changed files with 91 additions and 41 deletions
+13 -1
View File
@@ -49,8 +49,11 @@ class BookingEditDraft
#[ORM\Column(type: 'integer', nullable: true)]
private ?int $hotelId = null;
/**
* @var array<string, mixed>
*/
#[ORM\Column(type: 'json')]
private array $formData = [];
private array $formData;
#[ORM\Column(type: 'datetime_immutable')]
private \DateTimeImmutable $createdAt;
@@ -58,6 +61,9 @@ class BookingEditDraft
#[ORM\Column(type: 'datetime_immutable')]
private \DateTimeImmutable $updatedAt;
/**
* @param array<string, mixed> $formData
*/
public function __construct(User $user, int $bookingId, \DateTimeImmutable $travelDate, array $formData)
{
$this->user = $user;
@@ -139,11 +145,17 @@ class BookingEditDraft
return null !== $this->dateId && null !== $this->hotelId;
}
/**
* @return array<string, mixed>
*/
public function getFormData(): array
{
return $this->formData;
}
/**
* @param array<string, mixed> $formData
*/
public function setFormData(array $formData): static
{
$this->formData = $formData;
+18
View File
@@ -22,9 +22,15 @@ class LogEntry
#[ORM\Column(type: 'string', length: 255)]
private ?string $message;
/**
* @var array<string, mixed>|null
*/
#[ORM\Column(type: 'json', nullable: true)]
private ?array $context = [];
/**
* @var array<string, mixed>|null
*/
#[ORM\Column(type: 'json', nullable: true)]
private ?array $extra = [];
@@ -70,11 +76,17 @@ class LogEntry
return $this;
}
/**
* @return array<string, mixed>|null
*/
public function getContext(): ?array
{
return $this->context;
}
/**
* @param array<string, mixed>|null $context
*/
public function setContext(?array $context): self
{
$this->context = $context;
@@ -82,11 +94,17 @@ class LogEntry
return $this;
}
/**
* @return array<string, mixed>|null
*/
public function getExtra(): ?array
{
return $this->extra;
}
/**
* @param array<string, mixed>|null $extra
*/
public function setExtra(?array $extra): self
{
$this->extra = $extra;
+18
View File
@@ -26,9 +26,15 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface
#[ORM\Column(type: 'integer', nullable: true)]
private ?int $addressId = null;
/**
* @var array<string>
*/
#[ORM\Column(type: 'json')]
private array $roles = [];
/**
* @var array<string>
*/
#[ORM\Column(type: 'json')]
private array $hotelCodes = [];
@@ -96,11 +102,17 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface
return $this;
}
/**
* @return array<string>
*/
public function getRoles(): array
{
return ['ROLE_USER', ...$this->roles];
}
/**
* @param array<string> $roles
*/
public function setRoles(array $roles): static
{
$this->roles = $roles;
@@ -108,11 +120,17 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface
return $this;
}
/**
* @return array<string>
*/
public function getHotelCodes(): array
{
return $this->hotelCodes;
}
/**
* @param array<string> $hotelCodes
*/
public function setHotelCodes(array $hotelCodes): static
{
$this->hotelCodes = $hotelCodes;