From b0c188f43475c882a83fea4a764be46e2b950d61 Mon Sep 17 00:00:00 2001
From: Daniel Kurowski <daniel.kurowski@grifart.cz>
Date: Thu, 4 Feb 2021 17:27:01 +0100
Subject: [PATCH] Type fixes

---
 src/Request/Adoption.php                      | 35 +++-----
 src/Request/EventAttendee.php                 | 23 ++----
 src/Response/Event/Invitation/Food.php        |  6 +-
 src/Response/Event/Invitation/Invitation.php  | 81 +++++++------------
 .../Event/Invitation/Presentation.php         |  3 +-
 src/Response/Event/Organizer.php              | 63 +++++----------
 .../OrganizationalUnit/OrganizationalUnit.php | 22 ++---
 7 files changed, 83 insertions(+), 150 deletions(-)

diff --git a/src/Request/Adoption.php b/src/Request/Adoption.php
index 2d1fb39..9ccc658 100644
--- a/src/Request/Adoption.php
+++ b/src/Request/Adoption.php
@@ -6,31 +6,18 @@
 final class Adoption extends Parameters
 {
 
-	/**
-	 * @param int $amount
-	 * @param string $firstName
-	 * @param string $lastName
-	 * @param string $streetAddress
-	 * @param string $streetNumber
-	 * @param string $postalCode
-	 * @param string $city
-	 * @param string $emailAddress
-	 * @param int|null $preferredUnitOfTypeRegional
-	 * @param int|null $preferredUnitOfTypeBase
-	 * @param bool $excludeFromPublic
-	 */
 	public function __construct(
-		$amount,
-		$firstName,
-		$lastName,
-		$streetAddress,
-		$streetNumber,
-		$postalCode,
-		$city,
-		$emailAddress,
-		$preferredUnitOfTypeRegional = null,
-		$preferredUnitOfTypeBase = null,
-		$excludeFromPublic
+		int $amount,
+		string $firstName,
+		string $lastName,
+		string $streetAddress,
+		string $streetNumber,
+		string $postalCode,
+		string $city,
+		string $emailAddress,
+		?int $preferredUnitOfTypeRegional,
+		?int $preferredUnitOfTypeBase,
+		bool $excludeFromPublic,
 	) {
 		parent::__construct([
 			self::PARAM_QUERY => 'adopce',
diff --git a/src/Request/EventAttendee.php b/src/Request/EventAttendee.php
index 2e8f5c0..cd18c8b 100644
--- a/src/Request/EventAttendee.php
+++ b/src/Request/EventAttendee.php
@@ -7,24 +7,17 @@ final class EventAttendee extends Parameters
 {
 
 	/**
-	 * @param int $eventId
-	 * @param string $firstName
-	 * @param string $lastName
-	 * @param string $birthDate
-	 * @param string $phoneNumber
-	 * @param string $emailAddress
-	 * @param string|null $note
 	 * @param string[]|null $questionAnswers
 	 */
 	public function __construct(
-		$eventId,
-		$firstName,
-		$lastName,
-		$birthDate,
-		$phoneNumber,
-		$emailAddress,
-		$note,
-		array $questionAnswers = null
+		int $eventId,
+		string $firstName,
+		string $lastName,
+		string $birthDate,
+		string $phoneNumber,
+		string $emailAddress,
+		?string $note,
+		?array $questionAnswers,
 	) {
 		parent::__construct([
 			self::PARAM_QUERY => 'prihlaska',
diff --git a/src/Response/Event/Invitation/Food.php b/src/Response/Event/Invitation/Food.php
index 8bf73f5..9c2e867 100644
--- a/src/Response/Event/Invitation/Food.php
+++ b/src/Response/Event/Invitation/Food.php
@@ -6,9 +6,9 @@
 final class Food
 {
 
-	/* private */ const CHOOSEABLE = 0;
-	/* private */ const VEGETARIAN = 1;
-	/* private */ const NON_VEGETARIAN = 2;
+	private const CHOOSEABLE = 0;
+	private const VEGETARIAN = 1;
+	private const NON_VEGETARIAN = 2;
 
 
 	/** @var bool */
diff --git a/src/Response/Event/Invitation/Invitation.php b/src/Response/Event/Invitation/Invitation.php
index f6f9ef3..8faa66b 100644
--- a/src/Response/Event/Invitation/Invitation.php
+++ b/src/Response/Event/Invitation/Invitation.php
@@ -6,47 +6,27 @@
 final class Invitation
 {
 
-	/** @var string */
-	private $introduction;
-
-	/** @var string */
-	private $organizationalInformation;
-
-	/** @var string|null */
-	private $accommodation;
-
-	/** @var Food */
-	private $food;
-
-	/** @var string */
-	private $workDescription;
-
-	/** @var int|null */
-	private $workHoursPerDay;
-
-	/** @var Presentation|null */
-	private $presentation;
+	private string $introduction;
+	private string $organizationalInformation;
+	private ?string $accommodation;
+	private Food $food;
+	private ?string $workDescription;
+	private ?int $workHoursPerDay;
+	private ?Presentation $presentation;
 
 
 	/**
-	 * @param string $introduction
-	 * @param string $organizationalInformation
-	 * @param string|null $accommodation
-	 * @param int|null $food
-	 * @param string $workDescription
-	 * @param int|null $workHoursPerDay
-	 * @param string|null $presentationText
 	 * @param string[] $presentationPhotos
 	 */
 	private function __construct(
-		$introduction,
-		$organizationalInformation = null,
-		$accommodation = null,
-		$food,
-		$workDescription,
-		$workHoursPerDay = null,
-		$presentationText = null,
-		array $presentationPhotos = []
+		string $introduction,
+		string $organizationalInformation,
+		?string $accommodation,
+		?int $food,
+		?string $workDescription,
+		?int $workHoursPerDay,
+		?string $presentationText,
+		array $presentationPhotos,
 	) {
 		$this->introduction = $introduction;
 		$this->organizationalInformation = $organizationalInformation;
@@ -69,27 +49,20 @@ private function __construct(
 	}
 
 	/**
-	 * @param string $introduction
-	 * @param string $organizationalInformation
-	 * @param string|null $accommodation
-	 * @param int|null $food
-	 * @param string $workDescription
-	 * @param int|null $workHoursPerDay
-	 * @param string|null $presentationText
 	 * @param string[] $presentationPhotos
-	 * @return self
 	 */
 	public static function from(
-		$introduction,
-		$organizationalInformation,
-		$accommodation = null,
-		$food = null,
-		$workDescription,
-		$workHoursPerDay = null,
-		$presentationText = null,
-		array $presentationPhotos = []
-	) {
-		return new self(
+		string $introduction,
+		string $organizationalInformation,
+		?string $accommodation,
+		?int $food,
+		?string $workDescription,
+		?int $workHoursPerDay,
+		?string $presentationText,
+		array $presentationPhotos,
+	): static
+	{
+		return new static(
 			$introduction,
 			$organizationalInformation,
 			$accommodation,
@@ -143,7 +116,7 @@ public function getFood()
 	}
 
 	/**
-	 * @return string
+	 * @return string|null
 	 */
 	public function getWorkDescription()
 	{
diff --git a/src/Response/Event/Invitation/Presentation.php b/src/Response/Event/Invitation/Presentation.php
index c242e18..42d4a28 100644
--- a/src/Response/Event/Invitation/Presentation.php
+++ b/src/Response/Event/Invitation/Presentation.php
@@ -33,11 +33,10 @@ private function __construct($text, array $photoPaths)
 
 
 	/**
-	 * @param string|null $text
 	 * @param string[] $photoPaths
 	 * @return self
 	 */
-	public static function from($text = null, array $photoPaths)
+	public static function from(?string $text, array $photoPaths)
 	{
 		return new self($text, $photoPaths);
 	}
diff --git a/src/Response/Event/Organizer.php b/src/Response/Event/Organizer.php
index f8ed0f8..e3be99e 100644
--- a/src/Response/Event/Organizer.php
+++ b/src/Response/Event/Organizer.php
@@ -6,42 +6,22 @@
 final class Organizer
 {
 
-	/** @var OrganizerOrganizationalUnit|null */
-	private $organizationalUnit;
+	private ?OrganizerOrganizationalUnit $organizationalUnit;
+	private ?string $responsiblePerson;
+	private ?string $organizers;
+	private ?string $contactPersonName;
+	private string $contactPhone;
+	private string $contactEmail;
 
-	/** @var string|null */
-	private $responsiblePerson;
 
-	/** @var string|null */
-	private $organizers;
-
-	/** @var string|null */
-	private $contactPersonName;
-
-	/** @var string */
-	private $contactPhone;
-
-	/** @var string */
-	private $contactEmail;
-
-
-	/**
-	 * @param int|null $organizationalUnitId
-	 * @param string|null $organizationalUnitName
-	 * @param string|null $responsiblePerson
-	 * @param string|null $organizers
-	 * @param string|null $contactPersonName
-	 * @param string $contactPhone
-	 * @param string $contactEmail
-	 */
 	private function __construct(
-		$organizationalUnitId = null,
-		$organizationalUnitName = null,
-		$responsiblePerson = null,
-		$organizers = null,
-		$contactPersonName = null,
-		$contactPhone,
-		$contactEmail
+		?int $organizationalUnitId,
+		?string $organizationalUnitName,
+		?string $responsiblePerson,
+		?string $organizers,
+		?string $contactPersonName,
+		string $contactPhone,
+		string $contactEmail,
 	) {
 		$this->organizationalUnit = ($organizationalUnitId !== null && $organizationalUnitName !== null) ? OrganizerOrganizationalUnit::from($organizationalUnitId, $organizationalUnitName) : null;
 		$this->responsiblePerson = $responsiblePerson;
@@ -63,14 +43,15 @@ private function __construct(
 	 * @return self
 	 */
 	public static function from(
-		$organizationalUnitId = null,
-		$organizationalUnitName = null,
-		$responsiblePerson = null,
-		$organizers = null,
-		$contactPersonName = null,
-		$contactPhone,
-		$contactEmail
-	) {
+		?int $organizationalUnitId,
+		?string $organizationalUnitName,
+		?string $responsiblePerson,
+		?string $organizers,
+		?string $contactPersonName,
+		string $contactPhone,
+		string $contactEmail
+	): self
+	{
 		return new self(
 			$organizationalUnitId,
 			$organizationalUnitName,
diff --git a/src/Response/OrganizationalUnit/OrganizationalUnit.php b/src/Response/OrganizationalUnit/OrganizationalUnit.php
index aa25c2f..847cfdd 100644
--- a/src/Response/OrganizationalUnit/OrganizationalUnit.php
+++ b/src/Response/OrganizationalUnit/OrganizationalUnit.php
@@ -60,17 +60,17 @@ final class OrganizationalUnit
 	 * @param string|null $manager
 	 */
 	private function __construct(
-		$id,
-		$name,
-		$street,
-		$city,
-		$postCode,
-		$phone = null,
-		$email = null,
-		$website = null,
-		$type,
-		$chairman = null,
-		$manager = null
+		int $id,
+		string $name,
+		string $street,
+		string $city,
+		string $postCode,
+		?string $phone,
+		?string $email,
+		?string $website,
+		int $type,
+		?string $chairman,
+		?string $manager,
 	) {
 		$this->id = $id;
 		$this->name = $name;