Skip to content

Commit

Permalink
refactor: run rector and phpstan again
Browse files Browse the repository at this point in the history
  • Loading branch information
ynnoig committed May 31, 2024
1 parent 53ab409 commit f6adee4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
8 changes: 3 additions & 5 deletions src/CXml/Model/Request/ConfirmationHeader.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function __construct(
#[Serializer\XmlAttribute]
private readonly string $type,
#[Serializer\XmlAttribute]
private ?\DateTimeInterface $noticeDate = null,
private readonly \DateTimeInterface $noticeDate = new \DateTime(),
) {
Assertion::inArray($type, [
self::TYPE_ACCEPT,
Expand All @@ -48,11 +48,9 @@ public function __construct(
self::TYPE_REQUESTTOPAY,
self::TYPE_REPLACE,
]);

$this->noticeDate = $noticeDate ?? new \DateTime();
}

public static function create(string $type, \DateTimeInterface $noticeDate = null): self
public static function create(string $type, \DateTimeInterface $noticeDate = new \DateTime()): self
{
return new self(
$type,
Expand All @@ -65,7 +63,7 @@ public function getType(): string
return $this->type;
}

public function getNoticeDate(): ?\DateTimeInterface
public function getNoticeDate(): \DateTimeInterface
{
return $this->noticeDate;
}
Expand Down
10 changes: 8 additions & 2 deletions src/CXml/Model/Request/OrderRequestHeader.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,15 @@ protected function __construct(
#[Serializer\XmlList(entry: 'Contact', inline: true)]
private ?array $contacts = null,
) {
if (null !== $contacts && [] !== $contacts) {
Assertion::allIsInstanceOf($contacts, Contact::class);
if (null === $contacts) {
return;
}

if ([] === $contacts) {
return;
}

Assertion::allIsInstanceOf($contacts, Contact::class);
}

public static function create(
Expand Down

0 comments on commit f6adee4

Please sign in to comment.