Skip to content

Commit bbf4c73

Browse files
stayalliveclaudeLitarnus
authored
style: Add void return types to test methods (#2068)
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com> Co-authored-by: Martin Linzmayer <martin.linzmayer@sentry.io>
1 parent 71c84eb commit bbf4c73

11 files changed

Lines changed: 21 additions & 21 deletions

src/ErrorHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ final class ErrorHandler
7676
/**
7777
* @var callable|null The previous exception handler, if any
7878
*
79-
* @phpstan-var null|callable(\Throwable): void
79+
* @phpstan-var (callable(\Throwable): void)|null
8080
*/
8181
private $previousExceptionHandler;
8282

src/State/HubAdapter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ public function __clone()
206206
/**
207207
* @see https://www.php.net/manual/en/language.oop5.magic.php#object.wakeup
208208
*/
209-
public function __wakeup()
209+
public function __wakeup(): void
210210
{
211211
throw new \BadMethodCallException('Unserializing instances of this class is forbidden.');
212212
}

tests/ClientBuilderTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
final class ClientBuilderTest extends TestCase
2525
{
26-
public function testGetOptions()
26+
public function testGetOptions(): void
2727
{
2828
$options = new Options();
2929
$clientBuilder = new ClientBuilder($options);

tests/ExceptionDataBagTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ final class ExceptionDataBagTest extends TestCase
1515
/**
1616
* @dataProvider constructorDataProvider
1717
*/
18-
public function testConstructor(array $constructorArgs, string $expectedType, string $expectedValue, ?Stacktrace $expectedStackTrace, ?ExceptionMechanism $expectedExceptionMechansim)
18+
public function testConstructor(array $constructorArgs, string $expectedType, string $expectedValue, ?Stacktrace $expectedStackTrace, ?ExceptionMechanism $expectedExceptionMechansim): void
1919
{
2020
$exceptionDataBag = new ExceptionDataBag(...$constructorArgs);
2121

tests/HttpClient/ResponseTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
final class ResponseTest extends TestCase
1111
{
12-
public function testResponseSuccess()
12+
public function testResponseSuccess(): void
1313
{
1414
$response = new Response(
1515
200,
@@ -32,7 +32,7 @@ public function testResponseSuccess()
3232
$this->assertFalse($response->hasError());
3333
}
3434

35-
public function testResponseFailure()
35+
public function testResponseFailure(): void
3636
{
3737
$response = new Response(
3838
500,
@@ -51,7 +51,7 @@ public function testResponseFailure()
5151
$this->assertTrue($response->hasError());
5252
}
5353

54-
public function testResponseMultiValueHeader()
54+
public function testResponseMultiValueHeader(): void
5555
{
5656
$response = new Response(
5757
200,

tests/Metrics/TraceMetricsTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ public function testEnableMetrics(): void
141141
$this->assertEmpty(StubTransport::$events);
142142
}
143143

144-
public function testBeforeSendMetricAltersContent()
144+
public function testBeforeSendMetricAltersContent(): void
145145
{
146146
HubAdapter::getInstance()->bindClient(new Client(new Options([
147147
'before_send_metric' => static function (Metric $metric) {
@@ -162,7 +162,7 @@ public function testBeforeSendMetricAltersContent()
162162
$this->assertEquals(99999, $metric->getValue());
163163
}
164164

165-
public function testIntType()
165+
public function testIntType(): void
166166
{
167167
traceMetrics()->count('test-count', 2, ['foo' => 'bar']);
168168
traceMetrics()->flush();

tests/Monolog/LogsHandlerTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ public function testFiltersAndMapsUsingMonologEnumThreshold($threshold, $recordL
100100
}
101101
}
102102

103-
public function testLogsHandlerDestructor()
103+
public function testLogsHandlerDestructor(): void
104104
{
105105
$transport = new StubTransport();
106106
$client = ClientBuilder::create([
@@ -135,7 +135,7 @@ public function testOriginTagAppliedWithHandler(): void
135135
$this->assertSame('auto.log.monolog', $log->attributes()->toSimpleArray()['sentry.origin']);
136136
}
137137

138-
public function testOriginTagNotAppliedWhenUsingDirectly()
138+
public function testOriginTagNotAppliedWhenUsingDirectly(): void
139139
{
140140
\Sentry\logger()->info('No origin attribute');
141141

tests/OptionsTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -587,7 +587,7 @@ public function excludedPathProviders(): array
587587
/**
588588
* @dataProvider includedPathProviders
589589
*/
590-
public function testIncludedAppPathsOverrideExcludedAppPaths(string $value, string $expected)
590+
public function testIncludedAppPathsOverrideExcludedAppPaths(string $value, string $expected): void
591591
{
592592
$configuration = new Options(['in_app_include' => [$value]]);
593593

tests/State/HubAdapterTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ public static function captureLastErrorDataProvider(): \Generator
270270
];
271271
}
272272

273-
public function testCaptureCheckIn()
273+
public function testCaptureCheckIn(): void
274274
{
275275
$hub = new Hub();
276276

tests/Tracing/PropagationContextTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
final class PropagationContextTest extends TestCase
1616
{
17-
public function testFromDefaults()
17+
public function testFromDefaults(): void
1818
{
1919
$propagationContext = PropagationContext::fromDefaults();
2020

@@ -27,7 +27,7 @@ public function testFromDefaults()
2727
/**
2828
* @dataProvider tracingDataProvider
2929
*/
30-
public function testFromHeaders(string $sentryTraceHeader, string $baggageHeader, ?TraceId $expectedTraceId, ?SpanId $expectedParentSpanId, ?bool $expectedDynamicSamplingContextFrozen)
30+
public function testFromHeaders(string $sentryTraceHeader, string $baggageHeader, ?TraceId $expectedTraceId, ?SpanId $expectedParentSpanId, ?bool $expectedDynamicSamplingContextFrozen): void
3131
{
3232
$propagationContext = PropagationContext::fromHeaders($sentryTraceHeader, $baggageHeader);
3333

@@ -49,7 +49,7 @@ public function testFromHeaders(string $sentryTraceHeader, string $baggageHeader
4949
/**
5050
* @dataProvider tracingDataProvider
5151
*/
52-
public function testFromEnvironment(string $sentryTrace, string $baggage, ?TraceId $expectedTraceId, ?SpanId $expectedParentSpanId, ?bool $expectedDynamicSamplingContextFrozen)
52+
public function testFromEnvironment(string $sentryTrace, string $baggage, ?TraceId $expectedTraceId, ?SpanId $expectedParentSpanId, ?bool $expectedDynamicSamplingContextFrozen): void
5353
{
5454
$propagationContext = PropagationContext::fromEnvironment($sentryTrace, $baggage);
5555

@@ -95,7 +95,7 @@ public static function tracingDataProvider(): iterable
9595
];
9696
}
9797

98-
public function testToTraceparent()
98+
public function testToTraceparent(): void
9999
{
100100
$propagationContext = PropagationContext::fromDefaults();
101101
$propagationContext->setTraceId(new TraceId('566e3688a61d4bc888951642d6f14a19'));
@@ -104,7 +104,7 @@ public function testToTraceparent()
104104
$this->assertSame('566e3688a61d4bc888951642d6f14a19-566e3688a61d4bc8', $propagationContext->toTraceparent());
105105
}
106106

107-
public function testToBaggage()
107+
public function testToBaggage(): void
108108
{
109109
$dynamicSamplingContext = DynamicSamplingContext::fromHeader('sentry-trace_id=566e3688a61d4bc888951642d6f14a19');
110110
$propagationContext = PropagationContext::fromDefaults();
@@ -113,7 +113,7 @@ public function testToBaggage()
113113
$this->assertSame('sentry-trace_id=566e3688a61d4bc888951642d6f14a19', $propagationContext->toBaggage());
114114
}
115115

116-
public function testGetTraceContext()
116+
public function testGetTraceContext(): void
117117
{
118118
$propagationContext = PropagationContext::fromDefaults();
119119
$propagationContext->setTraceId(new TraceId('566e3688a61d4bc888951642d6f14a19'));

0 commit comments

Comments
 (0)