From 661cffb6f22e3c92001d840f1189b8c76d64c237 Mon Sep 17 00:00:00 2001 From: Alex Bouma Date: Thu, 2 Nov 2023 13:07:00 +0100 Subject: [PATCH] [4.x] Fix fluent return type (#1622) --- src/Tracing/Span.php | 44 ++++++++++++++++++++++-------- src/Tracing/SpanContext.php | 53 +++++++++++++++++++++++++++++-------- 2 files changed, 75 insertions(+), 22 deletions(-) diff --git a/src/Tracing/Span.php b/src/Tracing/Span.php index 496efb2d4..3db829d3a 100644 --- a/src/Tracing/Span.php +++ b/src/Tracing/Span.php @@ -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; @@ -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) { $this->parentSpanId = $parentSpanId; @@ -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) { $this->startTimestamp = $startTimestamp; @@ -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) { $this->description = $description; @@ -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) { $this->op = $op; @@ -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; @@ -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) { $this->tags['http.status_code'] = (string) $statusCode; @@ -281,8 +295,10 @@ public function getTags(): array * the existing ones. * * @param array $tags The tags + * + * @return $this */ - public function setTags(array $tags): self + public function setTags(array $tags) { $this->tags = array_merge($this->tags, $tags); @@ -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; @@ -332,8 +350,10 @@ public function getData(): array * the existing one. * * @param array $data The data + * + * @return $this */ - public function setData(array $data): self + public function setData(array $data) { $this->data = array_merge($this->data, $data); @@ -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; diff --git a/src/Tracing/SpanContext.php b/src/Tracing/SpanContext.php index a1afa3f77..65df6dab9 100644 --- a/src/Tracing/SpanContext.php +++ b/src/Tracing/SpanContext.php @@ -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; @@ -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; @@ -90,7 +96,10 @@ public function getStatus(): ?SpanStatus return $this->status; } - public function setStatus(?SpanStatus $status): self + /** + * @return $this + */ + public function setStatus(?SpanStatus $status) { $this->status = $status; @@ -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; @@ -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; @@ -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; @@ -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; @@ -155,8 +176,10 @@ public function getTags(): array /** * @param array $tags + * + * @return $this */ - public function setTags(array $tags): self + public function setTags(array $tags) { $this->tags = $tags; @@ -173,8 +196,10 @@ public function getData(): array /** * @param array $data + * + * @return $this */ - public function setData(array $data): self + public function setData(array $data) { $this->data = $data; @@ -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; @@ -198,7 +226,10 @@ public function getEndTimestamp(): ?float return $this->endTimestamp; } - public function setEndTimestamp(?float $endTimestamp): self + /** + * @return $this + */ + public function setEndTimestamp(?float $endTimestamp) { $this->endTimestamp = $endTimestamp;