generated from mimmi20/template
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
51 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
/** | ||
* This file is part of the mimmi20/contact package. | ||
* | ||
* Copyright (c) 2020-2021, Thomas Mueller <[email protected]> | ||
* Copyright (c) 2022, Thomas Mueller <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,20 @@ | ||
<?php | ||
/** | ||
* This file is part of the mimmi20/contact package. | ||
* | ||
* Copyright (c) 2022, Thomas Mueller <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
declare(strict_types = 1); | ||
|
||
namespace Mimmi20\Contact; | ||
|
||
use DateTimeInterface; | ||
|
||
class Contact implements ContactInterface | ||
final class Contact implements ContactInterface | ||
{ | ||
private ?int $contactId = null; | ||
|
||
|
@@ -153,8 +161,8 @@ public function setProfession(?string $value): void | |
} | ||
|
||
/** | ||
* @return string[]|null[] | ||
* @phpstan-return array{contactId: string|null, salutation: string|null, firstname: string|null, familyname: string|null, street: string|null, housenumber: string|null, city: string|null, birthdate: string|null, phonenumber: string|null, email: string|null, profession: string|null} | ||
* @return int[]|null[]|string[] | ||
* @phpstan-return array{contactId: int|null, salutation: string|null, firstname: string|null, familyname: string|null, street: string|null, housenumber: string|null, city: string|null, birthdate: string|null, phonenumber: string|null, email: string|null, profession: string|null} | ||
*/ | ||
public function toArray(): array | ||
{ | ||
|
@@ -165,18 +173,18 @@ public function toArray(): array | |
} | ||
|
||
return [ | ||
'contactId' => $this->getContactId(), | ||
'salutation' => $this->getSalutation(), | ||
'firstname' => $this->getFirstname(), | ||
'familyname' => $this->getFamilyname(), | ||
'street' => $this->getStreet(), | ||
'contactId' => $this->getContactId(), | ||
'salutation' => $this->getSalutation(), | ||
'firstname' => $this->getFirstname(), | ||
'familyname' => $this->getFamilyname(), | ||
'street' => $this->getStreet(), | ||
'housenumber' => $this->getHousenumber(), | ||
'postalcode' => $this->getPostalcode(), | ||
'city' => $this->getCity(), | ||
'birthdate' => $birthdate, | ||
'postalcode' => $this->getPostalcode(), | ||
'city' => $this->getCity(), | ||
'birthdate' => $birthdate, | ||
'phonenumber' => $this->getPhonenumber(), | ||
'email' => $this->getEmail(), | ||
'profession' => $this->getProfession(), | ||
'email' => $this->getEmail(), | ||
'profession' => $this->getProfession(), | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,12 @@ | ||
<?php | ||
/** | ||
* This file is part of the mimmi20/contact package. | ||
* | ||
* Copyright (c) 2022, Thomas Mueller <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
declare(strict_types = 1); | ||
|
||
|
@@ -57,8 +65,8 @@ public function getProfession(): ?string; | |
public function setProfession(?string $value): void; | ||
|
||
/** | ||
* @return string[]|null[] | ||
* @phpstan-return array{contactId: string|null, salutation: string|null, firstname: string|null, familyname: string|null, street: string|null, housenumber: string|null, city: string|null, birthdate: string|null, phonenumber: string|null, email: string|null, profession: string|null} | ||
* @return int[]|null[]|string[] | ||
* @phpstan-return array{contactId: int|null, salutation: string|null, firstname: string|null, familyname: string|null, street: string|null, housenumber: string|null, city: string|null, birthdate: string|null, phonenumber: string|null, email: string|null, profession: string|null} | ||
*/ | ||
public function toArray(): array; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,12 @@ | ||
<?php | ||
/** | ||
* This file is part of the mimmi20/contact package. | ||
* | ||
* Copyright (c) 2022, Thomas Mueller <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
declare(strict_types = 1); | ||
|
||
|
@@ -8,7 +16,7 @@ | |
use Exception; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
class ContactTest extends TestCase | ||
final class ContactTest extends TestCase | ||
{ | ||
private Contact $object; | ||
|
||
|
@@ -172,18 +180,18 @@ public function testToArray(): void | |
$this->object->setProfession($profession); | ||
|
||
$expected = [ | ||
'contactId' => $id, | ||
'salutation' => $salutation, | ||
'firstname' => $firstname, | ||
'familyname' => $familyname, | ||
'street' => $street, | ||
'contactId' => $id, | ||
'salutation' => $salutation, | ||
'firstname' => $firstname, | ||
'familyname' => $familyname, | ||
'street' => $street, | ||
'housenumber' => $housenumber, | ||
'postalcode' => $postalcode, | ||
'city' => $city, | ||
'birthdate' => $birthdate->format('Y-m-d'), | ||
'postalcode' => $postalcode, | ||
'city' => $city, | ||
'birthdate' => $birthdate->format('Y-m-d'), | ||
'phonenumber' => $phonenumber, | ||
'email' => $email, | ||
'profession' => $profession, | ||
'email' => $email, | ||
'profession' => $profession, | ||
]; | ||
|
||
self::assertSame($expected, $this->object->toArray()); | ||
|