Skip to content

Commit

Permalink
* rename all param of prop setter methods to $value
Browse files Browse the repository at this point in the history
* change all prop setter methods to fluent setter that `return $this`
@ be
  • Loading branch information
n0099 committed Oct 26, 2024
1 parent d9fbc43 commit a1ab17c
Show file tree
Hide file tree
Showing 24 changed files with 209 additions and 138 deletions.
10 changes: 6 additions & 4 deletions be/src/DTO/Post/Post.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@ public function getIsMatchQuery(): bool
return $this->isMatchQuery;
}

public function setIsMatchQuery(bool $isMatchQuery): void
public function setIsMatchQuery(bool $value): self
{
$this->isMatchQuery = $isMatchQuery;
$this->isMatchQuery = $value;
return $this;
}

#[Ignore]
Expand All @@ -28,9 +29,10 @@ public function getSortingKey(): mixed
return $this->sortingKey;
}

public function setSortingKey(mixed $sortingKey): void
public function setSortingKey(mixed $value): self
{
$this->sortingKey = $sortingKey;
$this->sortingKey = $value;
return $this;
}

public static function fromEntity(\App\Entity\Post\Post $entity): self
Expand Down
5 changes: 3 additions & 2 deletions be/src/DTO/Post/PostWithContent.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ public function getContent(): ?array
return $this->content;
}

public function setContent(?array $content): void
public function setContent(?array $value): self
{
$this->content = $content;
$this->content = $value;
return $this;
}
}
4 changes: 2 additions & 2 deletions be/src/DTO/Post/Reply.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ public function getSubReplies(): Collection
return $this->subReplies;
}

public function setSubReplies(Collection $subReplies): self
public function setSubReplies(Collection $value): self
{
$this->subReplies = $subReplies;
$this->subReplies = $value;
return $this;
}

Expand Down
4 changes: 2 additions & 2 deletions be/src/DTO/Post/SortablePost.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ interface SortablePost
{
public function getIsMatchQuery(): bool;

public function setIsMatchQuery(bool $isMatchQuery): void;
public function setIsMatchQuery(bool $value): self;

#[Ignore]
public function getSortingKey(): mixed;

public function setSortingKey(mixed $sortingKey): void;
public function setSortingKey(mixed $value): self;
}
5 changes: 4 additions & 1 deletion be/src/DTO/Post/SubReply.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,8 @@ public function getIsMatchQuery(): bool
return true;
}

public function setIsMatchQuery(bool $isMatchQuery): void {}
public function setIsMatchQuery(bool $value): self
{
return $this;
}
}
4 changes: 2 additions & 2 deletions be/src/DTO/Post/Thread.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ public function getReplies(): Collection
return $this->replies;
}

public function setReplies(Collection $replies): self
public function setReplies(Collection $value): self
{
$this->replies = $replies;
$this->replies = $value;
return $this;
}

Expand Down
10 changes: 6 additions & 4 deletions be/src/DTO/User/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,21 @@ public function getCurrentForumModerator(): ?ForumModerator
return $this->currentForumModerator;
}

public function setCurrentForumModerator(?ForumModerator $currentForumModerator): void
public function setCurrentForumModerator(?ForumModerator $value): self
{
$this->currentForumModerator = $currentForumModerator;
$this->currentForumModerator = $value;
return $this;
}

public function getCurrentAuthorExpGrade(): ?AuthorExpGrade
{
return $this->currentAuthorExpGrade;
}

public function setCurrentAuthorExpGrade(?AuthorExpGrade $currentAuthorExpGrade): void
public function setCurrentAuthorExpGrade(?AuthorExpGrade $value): self
{
$this->currentAuthorExpGrade = $currentAuthorExpGrade;
$this->currentAuthorExpGrade = $value;
return $this;
}

public static function fromEntity(UserEntity $entity): self
Expand Down
15 changes: 9 additions & 6 deletions be/src/Entity/Forum.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,28 +18,31 @@ public function getFid(): int
return $this->fid;
}

public function setFid(int $fid): void
public function setFid(int $value): self
{
$this->fid = $fid;
$this->fid = $value;
return $this;
}

public function getName(): string
{
return $this->name;
}

public function setName(string $name): void
public function setName(string $value): self
{
$this->name = $name;
$this->name = $value;
return $this;
}

public function isCrawling(): bool
{
return $this->isCrawling;
}

public function setIsCrawling(bool $isCrawling): void
public function setIsCrawling(bool $value): self
{
$this->isCrawling = $isCrawling;
$this->isCrawling = $value;
return $this;
}
}
18 changes: 11 additions & 7 deletions be/src/Entity/LatestReplier.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,29 +20,32 @@ public function getId(): int
return $this->id;
}

public function setId(int $id): void
public function setId(int $value): self
{
$this->id = $id;
$this->id = $value;
return $this;
}

public function getUid(): ?int
{
return $this->uid;
}

public function setUid(?int $uid): void
public function setUid(?int $value): self
{
$this->uid = $uid;
$this->uid = $value;
return $this;
}

public function getName(): ?string
{
return $this->name;
}

public function setName(?string $name): void
public function setName(?string $value): self
{
$this->name = $name;
$this->name = $value;
return $this;
}

public function getDisplayName(): ?string
Expand All @@ -51,8 +54,9 @@ public function getDisplayName(): ?string
}

/** @param ?resource $displayName */
public function setDisplayName($displayName): void
public function setDisplayName($displayName): self
{
$this->displayName = $displayName;
return $this;
}
}
3 changes: 2 additions & 1 deletion be/src/Entity/Post/Content/PostContent.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ public function getContent(): ?array
}

/** @param ?resource $protoBufBytes */
public function setProtoBufBytes($protoBufBytes): void
public function setProtoBufBytes($protoBufBytes): self
{
$this->protoBufBytes = $protoBufBytes;
return $this;
}
}
5 changes: 3 additions & 2 deletions be/src/Entity/Post/Content/ReplyContent.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ public function getPid(): int
return $this->pid;
}

public function setPid(int $pid): void
public function setPid(int $value): self
{
$this->pid = $pid;
$this->pid = $value;
return $this;
}
}
5 changes: 3 additions & 2 deletions be/src/Entity/Post/Content/SubReplyContent.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ public function getSpid(): int
return $this->spid;
}

public function setSpid(int $spid): void
public function setSpid(int $value): self
{
$this->spid = $spid;
$this->spid = $value;
return $this;
}
}
25 changes: 15 additions & 10 deletions be/src/Entity/Post/Post.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,48 +19,53 @@ public function getAuthorUid(): int
return $this->authorUid;
}

public function setAuthorUid(int $authorUid): void
public function setAuthorUid(int $value): self
{
$this->authorUid = $authorUid;
$this->authorUid = $value;
return $this;
}

public function getPostedAt(): int
{
return $this->postedAt;
}

public function setPostedAt(int $postedAt): void
public function setPostedAt(int $value): self
{
$this->postedAt = $postedAt;
$this->postedAt = $value;
return $this;
}

public function getLastSeenAt(): ?int
{
return $this->lastSeenAt;
}

public function setLastSeenAt(?int $lastSeenAt): void
public function setLastSeenAt(?int $value): self
{
$this->lastSeenAt = $lastSeenAt;
$this->lastSeenAt = $value;
return $this;
}

public function getAgreeCount(): int
{
return $this->agreeCount ?? 0;
}

public function setAgreeCount(?int $agreeCount): void
public function setAgreeCount(?int $value): self
{
$this->agreeCount = $agreeCount;
$this->agreeCount = $value;
return $this;
}

public function getDisagreeCount(): int
{
return $this->disagreeCount ?? 0;
}

public function setDisagreeCount(?int $disagreeCount): void
public function setDisagreeCount(?int $value): self
{
$this->disagreeCount = $disagreeCount;
$this->disagreeCount = $value;
return $this;
}
}
33 changes: 20 additions & 13 deletions be/src/Entity/Post/Reply.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,49 +24,54 @@ public function getTid(): int
return $this->tid;
}

public function setTid(int $tid): void
public function setTid(int $value): self
{
$this->tid = $tid;
$this->tid = $value;
return $this;
}

public function getPid(): int
{
return $this->pid;
}

public function setPid(int $pid): void
public function setPid(int $value): self
{
$this->pid = $pid;
$this->pid = $value;
return $this;
}

public function getFloor(): int
{
return $this->floor;
}

public function setFloor(int $floor): void
public function setFloor(int $value): self
{
$this->floor = $floor;
$this->floor = $value;
return $this;
}

public function getSubReplyCount(): int
{
return $this->subReplyCount ?? 0;
}

public function setSubReplyCount(?int $subReplyCount): void
public function setSubReplyCount(?int $value): self
{
$this->subReplyCount = $subReplyCount;
$this->subReplyCount = $value;
return $this;
}

public function getIsFold(): ?int
{
return $this->isFold;
}

public function setIsFold(?int $isFold): void
public function setIsFold(?int $value): self
{
$this->isFold = $isFold;
$this->isFold = $value;
return $this;
}

public function getGeolocation(): ?array
Expand All @@ -75,18 +80,20 @@ public function getGeolocation(): ?array
}

/** @param ?resource $geolocation */
public function setGeolocation($geolocation): void
public function setGeolocation($geolocation): self
{
$this->geolocation = $geolocation;
return $this;
}

public function getSignatureId(): ?int
{
return $this->signatureId;
}

public function setSignatureId(?int $signatureId): void
public function setSignatureId(?int $value): self
{
$this->signatureId = $signatureId;
$this->signatureId = $value;
return $this;
}
}
Loading

0 comments on commit a1ab17c

Please sign in to comment.