This commit is contained in:
2025-04-22 23:42:07 +02:00
parent 7b05e52d95
commit 0f07e7eabf
15 changed files with 51 additions and 43 deletions

View File

@@ -72,7 +72,7 @@ class Answer
return $this;
}
public function isRightAnswer(): ?bool
public function isRightAnswer(): bool
{
return $this->isRightAnswer;
}

View File

@@ -18,21 +18,24 @@ class Elimination
#[ORM\Column(type: UuidType::NAME, unique: true)]
#[ORM\GeneratedValue(strategy: 'CUSTOM')]
#[ORM\CustomIdGenerator(class: UuidGenerator::class)]
private ?Uuid $id = null;
private Uuid $id;
/** @var array<string, mixed> */
#[ORM\Column(type: Types::JSON)]
private array $data = [];
public function getId(): ?int
public function getId(): Uuid
{
return $this->id;
}
/** @return array<string, mixed> */
public function getData(): array
{
return $this->data;
}
/** @param array<string, mixed> $data */
public function setData(array $data): static
{
$this->data = $data;

View File

@@ -20,7 +20,7 @@ class GivenAnswer
#[ORM\Column(type: UuidType::NAME, unique: true)]
#[ORM\GeneratedValue(strategy: 'CUSTOM')]
#[ORM\CustomIdGenerator(class: UuidGenerator::class)]
private ?Uuid $id = null;
private Uuid $id;
#[ORM\ManyToOne(inversedBy: 'givenAnswers')]
#[ORM\JoinColumn(nullable: false)]
@@ -35,7 +35,7 @@ class GivenAnswer
private ?Answer $answer = null;
#[ORM\Column(type: Types::DATETIME_IMMUTABLE, nullable: false)]
private \DateTimeInterface $created;
private \DateTimeImmutable $created;
public function getId(): ?Uuid
{
@@ -78,7 +78,7 @@ class GivenAnswer
return $this;
}
public function getCreated(): \DateTimeInterface
public function getCreated(): \DateTimeImmutable
{
return $this->created;
}

View File

@@ -103,7 +103,7 @@ class Question
return 'This question has no answers';
}
$correctAnswers = $this->answers->filter(static fn (Answer $answer): ?bool => $answer->isRightAnswer())->count();
$correctAnswers = $this->answers->filter(static fn (Answer $answer): bool => $answer->isRightAnswer())->count();
if (0 === $correctAnswers) {
return 'This question has no correct answers';

View File

@@ -76,13 +76,16 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface
*/
public function getUserIdentifier(): string
{
return $this->email;
/** @var non-empty-string $identifier */
$identifier = $this->email;
return $identifier;
}
/**
* @see UserInterface
*
* @return non-empty-list<string>
* @return non-empty-array<int<0, max>, string>
*/
public function getRoles(): array
{