Skip to content

Commit

Permalink
Type fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Kurowski committed Feb 4, 2021
1 parent 9f341c6 commit b0c188f
Show file tree
Hide file tree
Showing 7 changed files with 83 additions and 150 deletions.
35 changes: 11 additions & 24 deletions src/Request/Adoption.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
23 changes: 8 additions & 15 deletions src/Request/EventAttendee.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
6 changes: 3 additions & 3 deletions src/Response/Event/Invitation/Food.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
81 changes: 27 additions & 54 deletions src/Response/Event/Invitation/Invitation.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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,
Expand Down Expand Up @@ -143,7 +116,7 @@ public function getFood()
}

/**
* @return string
* @return string|null
*/
public function getWorkDescription()
{
Expand Down
3 changes: 1 addition & 2 deletions src/Response/Event/Invitation/Presentation.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
63 changes: 22 additions & 41 deletions src/Response/Event/Organizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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,
Expand Down
22 changes: 11 additions & 11 deletions src/Response/OrganizationalUnit/OrganizationalUnit.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit b0c188f

Please sign in to comment.