Skip to content

Commit

Permalink
[4.x] Fix fluent return type (#1622)
Browse files Browse the repository at this point in the history
  • Loading branch information
stayallive authored Nov 2, 2023
1 parent fe6a68b commit 661cffb
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 22 deletions.
44 changes: 33 additions & 11 deletions src/Tracing/Span.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,10 @@ public function getTraceId(): TraceId
* Sets the ID that determines which trace the span belongs to.
*
* @param TraceId $traceId The ID
*
* @return $this
*/
public function setTraceId(TraceId $traceId): self
public function setTraceId(TraceId $traceId)
{
$this->traceId = $traceId;

Expand All @@ -150,8 +152,10 @@ public function getParentSpanId(): ?SpanId
* Sets the ID that determines which span is the parent of the current one.
*
* @param SpanId|null $parentSpanId The ID
*
* @return $this
*/
public function setParentSpanId(?SpanId $parentSpanId): self
public function setParentSpanId(?SpanId $parentSpanId)

Check warning on line 158 in src/Tracing/Span.php

View check run for this annotation

Codecov / codecov/patch

src/Tracing/Span.php#L158

Added line #L158 was not covered by tests
{
$this->parentSpanId = $parentSpanId;

Expand All @@ -170,8 +174,10 @@ public function getStartTimestamp(): float
* Sets the timestamp representing when the measuring started.
*
* @param float $startTimestamp The timestamp
*
* @return $this
*/
public function setStartTimestamp(float $startTimestamp): self
public function setStartTimestamp(float $startTimestamp)

Check warning on line 180 in src/Tracing/Span.php

View check run for this annotation

Codecov / codecov/patch

src/Tracing/Span.php#L180

Added line #L180 was not covered by tests
{
$this->startTimestamp = $startTimestamp;

Expand Down Expand Up @@ -200,8 +206,10 @@ public function getDescription(): ?string
* the span but is consistent across instances of the span.
*
* @param string|null $description The description
*
* @return $this
*/
public function setDescription(?string $description): self
public function setDescription(?string $description)

Check warning on line 212 in src/Tracing/Span.php

View check run for this annotation

Codecov / codecov/patch

src/Tracing/Span.php#L212

Added line #L212 was not covered by tests
{
$this->description = $description;

Expand All @@ -220,8 +228,10 @@ public function getOp(): ?string
* Sets a short code identifying the type of operation the span is measuring.
*
* @param string|null $op The short code
*
* @return $this
*/
public function setOp(?string $op): self
public function setOp(?string $op)

Check warning on line 234 in src/Tracing/Span.php

View check run for this annotation

Codecov / codecov/patch

src/Tracing/Span.php#L234

Added line #L234 was not covered by tests
{
$this->op = $op;

Expand All @@ -240,8 +250,10 @@ public function getStatus(): ?SpanStatus
* Sets the status of the span/transaction.
*
* @param SpanStatus|null $status The status
*
* @return $this
*/
public function setStatus(?SpanStatus $status): self
public function setStatus(?SpanStatus $status)
{
$this->status = $status;

Expand All @@ -252,8 +264,10 @@ public function setStatus(?SpanStatus $status): self
* Sets the HTTP status code and the status of the span/transaction.
*
* @param int $statusCode The HTTP status code
*
* @return $this
*/
public function setHttpStatus(int $statusCode): self
public function setHttpStatus(int $statusCode)

Check warning on line 270 in src/Tracing/Span.php

View check run for this annotation

Codecov / codecov/patch

src/Tracing/Span.php#L270

Added line #L270 was not covered by tests
{
$this->tags['http.status_code'] = (string) $statusCode;

Expand Down Expand Up @@ -281,8 +295,10 @@ public function getTags(): array
* the existing ones.
*
* @param array<string, string> $tags The tags
*
* @return $this
*/
public function setTags(array $tags): self
public function setTags(array $tags)

Check warning on line 301 in src/Tracing/Span.php

View check run for this annotation

Codecov / codecov/patch

src/Tracing/Span.php#L301

Added line #L301 was not covered by tests
{
$this->tags = array_merge($this->tags, $tags);

Expand All @@ -309,8 +325,10 @@ public function getSampled(): ?bool
* Sets the flag determining whether this span should be sampled or not.
*
* @param bool $sampled Whether to sample or not this span
*
* @return $this
*/
public function setSampled(?bool $sampled): self
public function setSampled(?bool $sampled)
{
$this->sampled = $sampled;

Expand All @@ -332,8 +350,10 @@ public function getData(): array
* the existing one.
*
* @param array<string, mixed> $data The data
*
* @return $this
*/
public function setData(array $data): self
public function setData(array $data)

Check warning on line 356 in src/Tracing/Span.php

View check run for this annotation

Codecov / codecov/patch

src/Tracing/Span.php#L356

Added line #L356 was not covered by tests
{
$this->data = array_merge($this->data, $data);

Expand Down Expand Up @@ -440,8 +460,10 @@ public function getSpanRecorder(): ?SpanRecorder

/**
* Detaches the span recorder from this instance.
*
* @return $this
*/
public function detachSpanRecorder(): self
public function detachSpanRecorder()
{
$this->spanRecorder = null;

Expand Down
53 changes: 42 additions & 11 deletions src/Tracing/SpanContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,10 @@ public function getDescription(): ?string
return $this->description;
}

public function setDescription(?string $description): self
/**
* @return $this
*/
public function setDescription(?string $description)
{
$this->description = $description;

Expand All @@ -78,7 +81,10 @@ public function getOp(): ?string
return $this->op;
}

public function setOp(?string $op): self
/**
* @return $this
*/
public function setOp(?string $op)
{
$this->op = $op;

Expand All @@ -90,7 +96,10 @@ public function getStatus(): ?SpanStatus
return $this->status;
}

public function setStatus(?SpanStatus $status): self
/**
* @return $this
*/
public function setStatus(?SpanStatus $status)

Check warning on line 102 in src/Tracing/SpanContext.php

View check run for this annotation

Codecov / codecov/patch

src/Tracing/SpanContext.php#L102

Added line #L102 was not covered by tests
{
$this->status = $status;

Expand All @@ -102,7 +111,10 @@ public function getParentSpanId(): ?SpanId
return $this->parentSpanId;
}

public function setParentSpanId(?SpanId $parentSpanId): self
/**
* @return $this
*/
public function setParentSpanId(?SpanId $parentSpanId)
{
$this->parentSpanId = $parentSpanId;

Expand All @@ -114,7 +126,10 @@ public function getSampled(): ?bool
return $this->sampled;
}

public function setSampled(?bool $sampled): self
/**
* @return $this
*/
public function setSampled(?bool $sampled)
{
$this->sampled = $sampled;

Expand All @@ -126,7 +141,10 @@ public function getSpanId(): ?SpanId
return $this->spanId;
}

public function setSpanId(?SpanId $spanId): self
/**
* @return $this
*/
public function setSpanId(?SpanId $spanId)
{
$this->spanId = $spanId;

Expand All @@ -138,7 +156,10 @@ public function getTraceId(): ?TraceId
return $this->traceId;
}

public function setTraceId(?TraceId $traceId): self
/**
* @return $this
*/
public function setTraceId(?TraceId $traceId)
{
$this->traceId = $traceId;

Expand All @@ -155,8 +176,10 @@ public function getTags(): array

/**
* @param array<string, string> $tags
*
* @return $this
*/
public function setTags(array $tags): self
public function setTags(array $tags)
{
$this->tags = $tags;

Expand All @@ -173,8 +196,10 @@ public function getData(): array

/**
* @param array<string, mixed> $data
*
* @return $this
*/
public function setData(array $data): self
public function setData(array $data)
{
$this->data = $data;

Expand All @@ -186,7 +211,10 @@ public function getStartTimestamp(): ?float
return $this->startTimestamp;
}

public function setStartTimestamp(?float $startTimestamp): self
/**
* @return $this
*/
public function setStartTimestamp(?float $startTimestamp)
{
$this->startTimestamp = $startTimestamp;

Expand All @@ -198,7 +226,10 @@ public function getEndTimestamp(): ?float
return $this->endTimestamp;
}

public function setEndTimestamp(?float $endTimestamp): self
/**
* @return $this
*/
public function setEndTimestamp(?float $endTimestamp)

Check warning on line 232 in src/Tracing/SpanContext.php

View check run for this annotation

Codecov / codecov/patch

src/Tracing/SpanContext.php#L232

Added line #L232 was not covered by tests
{
$this->endTimestamp = $endTimestamp;

Check warning on line 234 in src/Tracing/SpanContext.php

View check run for this annotation

Codecov / codecov/patch

src/Tracing/SpanContext.php#L234

Added line #L234 was not covered by tests

Expand Down

0 comments on commit 661cffb

Please sign in to comment.