diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index df52dd92..92e2fa06 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -280,11 +280,6 @@ parameters: count: 1 path: src/Tracing/HttpClient/AbstractTraceableResponse.php - - - message: "#^Method Sentry\\\\SentryBundle\\\\Tracing\\\\HttpClient\\\\AbstractTraceableResponse::stream\\(\\) has parameter \\$responses with no value type specified in iterable type iterable.$#" - count: 1 - path: src/Tracing/HttpClient/AbstractTraceableResponse.php - - message: "#^Method Sentry\\\\SentryBundle\\\\Tracing\\\\HttpClient\\\\TraceableHttpClientForV6::withOptions\\(\\) has parameter \\$options with no value type specified in iterable type array.$#" count: 1 diff --git a/src/Tracing/HttpClient/AbstractTraceableHttpClient.php b/src/Tracing/HttpClient/AbstractTraceableHttpClient.php index 9dd104ef..3ad27ad4 100644 --- a/src/Tracing/HttpClient/AbstractTraceableHttpClient.php +++ b/src/Tracing/HttpClient/AbstractTraceableHttpClient.php @@ -72,6 +72,8 @@ public function stream($responses, float $timeout = null): ResponseStreamInterfa { if ($responses instanceof AbstractTraceableResponse) { $responses = [$responses]; + } elseif (!is_iterable($responses)) { + throw new \TypeError(sprintf('"%s()" expects parameter 1 to be an iterable of TraceableResponse objects, "%s" given.', __METHOD__, get_debug_type($responses))); } return new ResponseStream(AbstractTraceableResponse::stream($this->client, $responses, $timeout)); diff --git a/tests/Tracing/HttpClient/TraceableHttpClientTest.php b/tests/Tracing/HttpClient/TraceableHttpClientTest.php index ed165254..069d8682 100644 --- a/tests/Tracing/HttpClient/TraceableHttpClientTest.php +++ b/tests/Tracing/HttpClient/TraceableHttpClientTest.php @@ -87,6 +87,7 @@ public function testRequest(): void $response->getContent(false); + $this->assertNotNull($transaction->getSpanRecorder()); $spans = $transaction->getSpanRecorder()->getSpans(); $this->assertCount(2, $spans); $this->assertNotNull($spans[1]->getEndTimestamp()); @@ -118,6 +119,7 @@ public function testStream(): void $chunks[] = $chunk->getContent(); } + $this->assertNotNull($transaction->getSpanRecorder()); $spans = $transaction->getSpanRecorder()->getSpans(); $expectedTags = [ 'http.method' => 'GET',