Updated some type hints

This commit is contained in:
Cédric Belin
2019-03-13 13:24:29 +01:00
parent 3465ba6948
commit a1756d5947
5 changed files with 37 additions and 37 deletions

View File

@ -211,11 +211,11 @@ class PushEvent implements \JsonSerializable {
/** /**
* Sets the URL for comparing the revisions. * Sets the URL for comparing the revisions.
* @param UriInterface|string|null $value The URL for comparing the revisions. * @param UriInterface|null $value The URL for comparing the revisions.
* @return $this This instance. * @return $this This instance.
*/ */
function setCompareUrl($value): self { function setCompareUrl(?UriInterface $value): self {
$this->compareUrl = is_string($value) ? new Uri($value) : $value; $this->compareUrl = $value;
return $this; return $this;
} }

View File

@ -73,8 +73,8 @@ class PayloadCommit implements \JsonSerializable {
return (new static(isset($map->id) && is_string($map->id) ? $map->id : '', isset($map->message) && is_string($map->message) ? $map->message : '')) return (new static(isset($map->id) && is_string($map->id) ? $map->id : '', isset($map->message) && is_string($map->message) ? $map->message : ''))
->setAuthor(isset($map->author) && is_object($map->author) ? PayloadUser::fromJson($map->author) : null) ->setAuthor(isset($map->author) && is_object($map->author) ? PayloadUser::fromJson($map->author) : null)
->setCommitter(isset($map->committer) && is_object($map->committer) ? PayloadUser::fromJson($map->committer) : null) ->setCommitter(isset($map->committer) && is_object($map->committer) ? PayloadUser::fromJson($map->committer) : null)
->setTimestamp(isset($map->timestamp) && is_string($map->timestamp) ? $map->timestamp : null) ->setTimestamp(isset($map->timestamp) && is_string($map->timestamp) ? new \DateTime($map->timestamp) : null)
->setUrl(isset($map->url) && is_string($map->url) ? $map->url : null) ->setUrl(isset($map->url) && is_string($map->url) ? new Uri($map->url) : null)
->setVerification(isset($map->verification) && is_object($map->verification) ? PayloadCommitVerification::fromJson($map->verification) : null); ->setVerification(isset($map->verification) && is_object($map->verification) ? PayloadCommitVerification::fromJson($map->verification) : null);
} }
@ -182,21 +182,21 @@ class PayloadCommit implements \JsonSerializable {
/** /**
* Sets the commit date. * Sets the commit date.
* @param \DateTime|string|null $value The new commit date. * @param \DateTime|null $value The new commit date.
* @return $this This instance. * @return $this This instance.
*/ */
function setTimestamp($value): self { function setTimestamp(?\DateTime $value): self {
$this->timestamp = is_string($value) ? new \DateTime($value) : $value; $this->timestamp = $value;
return $this; return $this;
} }
/** /**
* Sets the URL to the commit's history. * Sets the URL to the commit's history.
* @param UriInterface|string|null $value The new commit URL. * @param UriInterface|null $value The new commit URL.
* @return $this This instance. * @return $this This instance.
*/ */
function setUrl($value): self { function setUrl(?UriInterface $value): self {
$this->url = is_string($value) ? new Uri($value) : $value; $this->url = $value;
return $this; return $this;
} }

View File

@ -393,21 +393,21 @@ class Repository implements \JsonSerializable {
/** /**
* Sets the HTTP-based URL for cloning this repository. * Sets the HTTP-based URL for cloning this repository.
* @param UriInterface|string|null $value The new URL for cloning this repository. * @param UriInterface|null $value The new URL for cloning this repository.
* @return $this This instance. * @return $this This instance.
*/ */
function setCloneUrl($value): self { function setCloneUrl(?UriInterface $value): self {
$this->cloneUrl = is_string($value) ? new Uri($value) : $value; $this->cloneUrl = $value;
return $this; return $this;
} }
/** /**
* Sets the date the repository was created. * Sets the date the repository was created.
* @param \DateTime|string|null $value The new date of creation. * @param \DateTime|null $value The new date of creation.
* @return $this This instance. * @return $this This instance.
*/ */
function setCreatedAt($value): self { function setCreatedAt(?\DateTime $value): self {
$this->createdAt = is_string($value) ? new \DateTime($value) : $value; $this->createdAt = $value;
return $this; return $this;
} }
@ -473,11 +473,11 @@ class Repository implements \JsonSerializable {
/** /**
* Sets the Gitea URL of this repository. * Sets the Gitea URL of this repository.
* @param UriInterface|string|null $value The new Gitea URL. * @param UriInterface|null $value The new Gitea URL.
* @return $this This instance. * @return $this This instance.
*/ */
function setHtmlUrl($value): self { function setHtmlUrl(?UriInterface $value): self {
$this->htmlUrl = is_string($value) ? new Uri($value) : $value; $this->htmlUrl = $value;
return $this; return $this;
} }
@ -563,11 +563,11 @@ class Repository implements \JsonSerializable {
/** /**
* Sets the SSH-based URL for cloning this repository. * Sets the SSH-based URL for cloning this repository.
* @param UriInterface|string|null $value The new URL for cloning this repository. * @param UriInterface|null $value The new URL for cloning this repository.
* @return $this This instance. * @return $this This instance.
*/ */
function setSshUrl($value): self { function setSshUrl(?UriInterface $value): self {
$this->sshUrl = is_string($value) ? new Uri($value) : $value; $this->sshUrl = $value;
return $this; return $this;
} }
@ -583,11 +583,11 @@ class Repository implements \JsonSerializable {
/** /**
* Sets the date the repository was updated. * Sets the date the repository was updated.
* @param \DateTime|string|null $value The new date of update. * @param \DateTime|null $value The new date of update.
* @return $this This instance. * @return $this This instance.
*/ */
function setUpdatedAt($value): self { function setUpdatedAt(?\DateTime $value): self {
$this->updatedAt = is_string($value) ? new \DateTime($value) : $value; $this->updatedAt = $value;
return $this; return $this;
} }
@ -603,11 +603,11 @@ class Repository implements \JsonSerializable {
/** /**
* Sets the URL of the repository website. * Sets the URL of the repository website.
* @param UriInterface|string|null $value The new repository website. * @param UriInterface|null $value The new repository website.
* @return $this This instance. * @return $this This instance.
*/ */
function setWebsite($value): self { function setWebsite(?UriInterface $value): self {
$this->website = is_string($value) ? new Uri($value) : $value; $this->website = $value;
return $this; return $this;
} }
} }

View File

@ -58,7 +58,7 @@ class TrackedTime implements \JsonSerializable {
*/ */
static function fromJson(object $map): self { static function fromJson(object $map): self {
return (new static(isset($map->id) && is_int($map->id) ? $map->id : -1, isset($map->time) && is_int($map->time) ? $map->time : 0)) return (new static(isset($map->id) && is_int($map->id) ? $map->id : -1, isset($map->time) && is_int($map->time) ? $map->time : 0))
->setCreatedAt(isset($map->created) && is_string($map->created) ? $map->created : null) ->setCreatedAt(isset($map->created) && is_string($map->created) ? new \DateTime($map->created) : null)
->setIssueId(isset($map->issue_id) && is_int($map->issue_id) ? $map->issue_id : -1) ->setIssueId(isset($map->issue_id) && is_int($map->issue_id) ? $map->issue_id : -1)
->setUserId(isset($map->user_id) && is_int($map->user_id) ? $map->user_id : -1); ->setUserId(isset($map->user_id) && is_int($map->user_id) ? $map->user_id : -1);
} }
@ -119,11 +119,11 @@ class TrackedTime implements \JsonSerializable {
/** /**
* Sets the date the entry was created. * Sets the date the entry was created.
* @param \DateTime|string|null $value The new date of creation. * @param \DateTime|null $value The new date of creation.
* @return $this This instance. * @return $this This instance.
*/ */
function setCreatedAt($value): self { function setCreatedAt(?\DateTime $value): self {
$this->createdAt = is_string($value) ? new \DateTime($value) : $value; $this->createdAt = $value;
return $this; return $this;
} }

View File

@ -66,7 +66,7 @@ class User implements \JsonSerializable {
*/ */
static function fromJson(object $map): self { static function fromJson(object $map): self {
return (new static(isset($map->id) && is_int($map->id) ? $map->id : -1, isset($map->login) && is_string($map->login) ? $map->login : '')) return (new static(isset($map->id) && is_int($map->id) ? $map->id : -1, isset($map->login) && is_string($map->login) ? $map->login : ''))
->setAvatarUrl(isset($map->avatar_url) && is_string($map->avatar_url) ? $map->avatar_url : null) ->setAvatarUrl(isset($map->avatar_url) && is_string($map->avatar_url) ? new Uri($map->avatar_url) : null)
->setEmail(isset($map->email) && is_string($map->email) ? mb_strtolower($map->email) : '') ->setEmail(isset($map->email) && is_string($map->email) ? mb_strtolower($map->email) : '')
->setFullName(isset($map->full_name) && is_string($map->full_name) ? $map->full_name : '') ->setFullName(isset($map->full_name) && is_string($map->full_name) ? $map->full_name : '')
->setLanguage(isset($map->language) && is_string($map->language) ? $map->language : ''); ->setLanguage(isset($map->language) && is_string($map->language) ? $map->language : '');
@ -137,11 +137,11 @@ class User implements \JsonSerializable {
/** /**
* Sets the URL of the avatar image. * Sets the URL of the avatar image.
* @param UriInterface|string|null $value The new avatar URL. * @param UriInterface|null $value The new avatar URL.
* @return $this This instance. * @return $this This instance.
*/ */
function setAvatarUrl($value): self { function setAvatarUrl(?UriInterface $value): self {
$this->avatarUrl = is_string($value) ? new Uri($value) : $value; $this->avatarUrl = $value;
return $this; return $this;
} }