Skip to content

Commit dcea7b5

Browse files
committed
fix static analysis
1 parent 27d9d53 commit dcea7b5

File tree

3 files changed

+4
-5
lines changed

3 files changed

+4
-5
lines changed

phpstan-baseline.neon

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -280,11 +280,6 @@ parameters:
280280
count: 1
281281
path: src/Tracing/HttpClient/AbstractTraceableResponse.php
282282

283-
-
284-
message: "#^Method Sentry\\\\SentryBundle\\\\Tracing\\\\HttpClient\\\\AbstractTraceableResponse::stream\\(\\) has parameter \\$responses with no value type specified in iterable type iterable.$#"
285-
count: 1
286-
path: src/Tracing/HttpClient/AbstractTraceableResponse.php
287-
288283
-
289284
message: "#^Method Sentry\\\\SentryBundle\\\\Tracing\\\\HttpClient\\\\TraceableHttpClientForV6::withOptions\\(\\) has parameter \\$options with no value type specified in iterable type array.$#"
290285
count: 1

src/Tracing/HttpClient/AbstractTraceableHttpClient.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ public function stream($responses, float $timeout = null): ResponseStreamInterfa
7272
{
7373
if ($responses instanceof AbstractTraceableResponse) {
7474
$responses = [$responses];
75+
} elseif (!is_iterable($responses)) {
76+
throw new \TypeError(sprintf('"%s()" expects parameter 1 to be an iterable of TraceableResponse objects, "%s" given.', __METHOD__, get_debug_type($responses)));
7577
}
7678

7779
return new ResponseStream(AbstractTraceableResponse::stream($this->client, $responses, $timeout));

tests/Tracing/HttpClient/TraceableHttpClientTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ public function testRequest(): void
8787

8888
$response->getContent(false);
8989

90+
$this->assertNotNull($transaction->getSpanRecorder());
9091
$spans = $transaction->getSpanRecorder()->getSpans();
9192
$this->assertCount(2, $spans);
9293
$this->assertNotNull($spans[1]->getEndTimestamp());
@@ -118,6 +119,7 @@ public function testStream(): void
118119
$chunks[] = $chunk->getContent();
119120
}
120121

122+
$this->assertNotNull($transaction->getSpanRecorder());
121123
$spans = $transaction->getSpanRecorder()->getSpans();
122124
$expectedTags = [
123125
'http.method' => 'GET',

0 commit comments

Comments
 (0)