Skip to content

Commit e5e8eb0

Browse files
authored
Fix: improve return type hints and return docblocks for query classes (#470)
1 parent fad09ad commit e5e8eb0

File tree

2 files changed

+111
-111
lines changed

2 files changed

+111
-111
lines changed

Diff for: src/Query/Query.php

+42-42
Original file line numberDiff line numberDiff line change
@@ -640,7 +640,7 @@ public function getByUidLowerThan(int $uid): MessageCollection {
640640
*
641641
* @return $this
642642
*/
643-
public function leaveUnread(): Query {
643+
public function leaveUnread(): static {
644644
$this->setFetchOptions(IMAP::FT_PEEK);
645645

646646
return $this;
@@ -651,7 +651,7 @@ public function leaveUnread(): Query {
651651
*
652652
* @return $this
653653
*/
654-
public function markAsRead(): Query {
654+
public function markAsRead(): static {
655655
$this->setFetchOptions(IMAP::FT_UID);
656656

657657
return $this;
@@ -663,7 +663,7 @@ public function markAsRead(): Query {
663663
*
664664
* @return $this
665665
*/
666-
public function setSequence(int $sequence): Query {
666+
public function setSequence(int $sequence): static {
667667
$this->sequence = $sequence;
668668

669669
return $this;
@@ -699,7 +699,7 @@ public function getClient(): Client {
699699
*
700700
* @return $this
701701
*/
702-
public function limit(int $limit, int $page = 1): Query {
702+
public function limit(int $limit, int $page = 1): static {
703703
if ($page >= 1) $this->page = $page;
704704
$this->limit = $limit;
705705

@@ -719,9 +719,9 @@ public function getQuery(): Collection {
719719
* Set all query parameters
720720
* @param array $query
721721
*
722-
* @return Query
722+
* @return $this
723723
*/
724-
public function setQuery(array $query): Query {
724+
public function setQuery(array $query): static {
725725
$this->query = new Collection($query);
726726
return $this;
727727
}
@@ -739,9 +739,9 @@ public function getRawQuery(): string {
739739
* Set the raw query
740740
* @param string $raw_query
741741
*
742-
* @return Query
742+
* @return $this
743743
*/
744-
public function setRawQuery(string $raw_query): Query {
744+
public function setRawQuery(string $raw_query): static {
745745
$this->raw_query = $raw_query;
746746
return $this;
747747
}
@@ -759,9 +759,9 @@ public function getExtensions(): array {
759759
* Set all extensions that should be used
760760
* @param string[] $extensions
761761
*
762-
* @return Query
762+
* @return $this
763763
*/
764-
public function setExtensions(array $extensions): Query {
764+
public function setExtensions(array $extensions): static {
765765
$this->extensions = $extensions;
766766
if (count($this->extensions) > 0) {
767767
if (in_array("UID", $this->extensions) === false) {
@@ -775,9 +775,9 @@ public function setExtensions(array $extensions): Query {
775775
* Set the client instance
776776
* @param Client $client
777777
*
778-
* @return Query
778+
* @return $this
779779
*/
780-
public function setClient(Client $client): Query {
780+
public function setClient(Client $client): static {
781781
$this->client = $client;
782782
return $this;
783783
}
@@ -795,9 +795,9 @@ public function getLimit(): ?int {
795795
* Set the fetch limit
796796
* @param int $limit
797797
*
798-
* @return Query
798+
* @return $this
799799
*/
800-
public function setLimit(int $limit): Query {
800+
public function setLimit(int $limit): static {
801801
$this->limit = $limit <= 0 ? null : $limit;
802802
return $this;
803803
}
@@ -815,9 +815,9 @@ public function getPage(): int {
815815
* Set the page
816816
* @param int $page
817817
*
818-
* @return Query
818+
* @return $this
819819
*/
820-
public function setPage(int $page): Query {
820+
public function setPage(int $page): static {
821821
$this->page = $page;
822822
return $this;
823823
}
@@ -826,9 +826,9 @@ public function setPage(int $page): Query {
826826
* Set the fetch option flag
827827
* @param int $fetch_options
828828
*
829-
* @return Query
829+
* @return $this
830830
*/
831-
public function setFetchOptions(int $fetch_options): Query {
831+
public function setFetchOptions(int $fetch_options): static {
832832
$this->fetch_options = $fetch_options;
833833
return $this;
834834
}
@@ -837,9 +837,9 @@ public function setFetchOptions(int $fetch_options): Query {
837837
* Set the fetch option flag
838838
* @param int $fetch_options
839839
*
840-
* @return Query
840+
* @return $this
841841
*/
842-
public function fetchOptions(int $fetch_options): Query {
842+
public function fetchOptions(int $fetch_options): static {
843843
return $this->setFetchOptions($fetch_options);
844844
}
845845

@@ -865,9 +865,9 @@ public function getFetchBody(): bool {
865865
* Set the fetch body flag
866866
* @param boolean $fetch_body
867867
*
868-
* @return Query
868+
* @return $this
869869
*/
870-
public function setFetchBody(bool $fetch_body): Query {
870+
public function setFetchBody(bool $fetch_body): static {
871871
$this->fetch_body = $fetch_body;
872872
return $this;
873873
}
@@ -876,9 +876,9 @@ public function setFetchBody(bool $fetch_body): Query {
876876
* Set the fetch body flag
877877
* @param boolean $fetch_body
878878
*
879-
* @return Query
879+
* @return $this
880880
*/
881-
public function fetchBody(bool $fetch_body): Query {
881+
public function fetchBody(bool $fetch_body): static {
882882
return $this->setFetchBody($fetch_body);
883883
}
884884

@@ -895,9 +895,9 @@ public function getFetchFlags(): bool {
895895
* Set the fetch flag
896896
* @param bool $fetch_flags
897897
*
898-
* @return Query
898+
* @return $this
899899
*/
900-
public function setFetchFlags(bool $fetch_flags): Query {
900+
public function setFetchFlags(bool $fetch_flags): static {
901901
$this->fetch_flags = $fetch_flags;
902902
return $this;
903903
}
@@ -906,9 +906,9 @@ public function setFetchFlags(bool $fetch_flags): Query {
906906
* Set the fetch order
907907
* @param string $fetch_order
908908
*
909-
* @return Query
909+
* @return $this
910910
*/
911-
public function setFetchOrder(string $fetch_order): Query {
911+
public function setFetchOrder(string $fetch_order): static {
912912
$fetch_order = strtolower($fetch_order);
913913

914914
if (in_array($fetch_order, ['asc', 'desc'])) {
@@ -922,9 +922,9 @@ public function setFetchOrder(string $fetch_order): Query {
922922
* Set the fetch order
923923
* @param string $fetch_order
924924
*
925-
* @return Query
925+
* @return $this
926926
*/
927-
public function fetchOrder(string $fetch_order): Query {
927+
public function fetchOrder(string $fetch_order): static {
928928
return $this->setFetchOrder($fetch_order);
929929
}
930930

@@ -940,56 +940,56 @@ public function getFetchOrder(): string {
940940
/**
941941
* Set the fetch order to ascending
942942
*
943-
* @return Query
943+
* @return $this
944944
*/
945-
public function setFetchOrderAsc(): Query {
945+
public function setFetchOrderAsc(): static {
946946
return $this->setFetchOrder('asc');
947947
}
948948

949949
/**
950950
* Set the fetch order to ascending
951951
*
952-
* @return Query
952+
* @return $this
953953
*/
954-
public function fetchOrderAsc(): Query {
954+
public function fetchOrderAsc(): static {
955955
return $this->setFetchOrderAsc();
956956
}
957957

958958
/**
959959
* Set the fetch order to descending
960960
*
961-
* @return Query
961+
* @return $this
962962
*/
963-
public function setFetchOrderDesc(): Query {
963+
public function setFetchOrderDesc(): static {
964964
return $this->setFetchOrder('desc');
965965
}
966966

967967
/**
968968
* Set the fetch order to descending
969969
*
970-
* @return Query
970+
* @return $this
971971
*/
972-
public function fetchOrderDesc(): Query {
972+
public function fetchOrderDesc(): static {
973973
return $this->setFetchOrderDesc();
974974
}
975975

976976
/**
977977
* Set soft fail mode
978978
* @var boolean $state
979979
*
980-
* @return Query
980+
* @return $this
981981
*/
982-
public function softFail(bool $state = true): Query {
982+
public function softFail(bool $state = true): static {
983983
return $this->setSoftFail($state);
984984
}
985985

986986
/**
987987
* Set soft fail mode
988988
*
989989
* @var boolean $state
990-
* @return Query
990+
* @return $this
991991
*/
992-
public function setSoftFail(bool $state = true): Query {
992+
public function setSoftFail(bool $state = true): static {
993993
$this->soft_fail = $state;
994994

995995
return $this;

0 commit comments

Comments
 (0)