Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace self return type with static return type of implementations #1

Draft
wants to merge 1 commit into
base: trunk
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Http/GenericClientHttpException.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public function suggestStatusCode(): int
return $this->httpStatusCode ?? $this->defaultStatusCode();
}

public function setHttpStatus(?int $code): self
public function setHttpStatus(?int $code): static
{
$this->httpStatusCode = $code;
return $this;
Expand Down
4 changes: 2 additions & 2 deletions src/Support/SupportInternalContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ trait SupportInternalContext
*
* Passing `null` with a key will remove the information under the key.
*/
public function pin(mixed $value, string|int|null $key = null): self
public function pin(mixed $value, string|int|null $key = null): static
{
if ($value === null) {
if ($key !== null) {
Expand All @@ -51,7 +51,7 @@ public function context(): array
/**
* Replace current context with given one.
*/
public function replaceContext(array $context): self
public function replaceContext(array $context): static
{
$this->context = $context;
return $this;
Expand Down
2 changes: 1 addition & 1 deletion src/Support/SupportInternalExplanation.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ trait SupportInternalExplanation
/**
* Add an explanation for internal purposes (logging, debugging, etc.).
*/
public function explain(?string $explanation): self
public function explain(?string $explanation): static
{
$this->explanation = $explanation;
return $this;
Expand Down
4 changes: 2 additions & 2 deletions src/Support/SupportPublicContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ trait SupportPublicContext
*
* Passing `null` with a key will remove the information under the key.
*/
public function pass(mixed $value, string|int|null $key = null): self
public function pass(mixed $value, string|int|null $key = null): static
{
if ($value === null) {
if ($key !== null) {
Expand All @@ -49,7 +49,7 @@ public function publicContext(): array
/**
* Completely replace current client-facing context with given one.
*/
public function replacePublicContext(array $context): self
public function replacePublicContext(array $context): static
{
$this->publicContext = $context;
return $this;
Expand Down
2 changes: 1 addition & 1 deletion src/Support/SupportPublicConveying.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function convey(
mixed $meta = null,
?int $status = null,
?string $code = null,
): self {
): static {
return $this->pass(new ErrorContainer(
message: $message ?? $this->getDefaultMessageToConvey(),
source: $source,
Expand Down
4 changes: 2 additions & 2 deletions src/Support/SupportTagging.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ trait SupportTagging
*
* Both plain string tags and key-tag pairs are supported.
*/
public function tag(string $tag, string|int|null $key = null): self
public function tag(string $tag, string|int|null $key = null): static
{
if ($key !== null) {
$this->tags[$key] = $tag;
Expand All @@ -43,7 +43,7 @@ public function tags(): array
/**
* Replace current tags with given ones.
*/
public function replaceTags(array $tags): self
public function replaceTags(array $tags): static
{
$this->tags = [];
// iterate over the keys for type safety
Expand Down