Skip to content

Commit c607527

Browse files
committed
Merge branch 'master' into fix-baggage-sample-rate
2 parents 6c42472 + 466d340 commit c607527

18 files changed

Lines changed: 60 additions & 59 deletions

.github/workflows/ci.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,15 @@ jobs:
2727
- ubuntu-latest
2828
- windows-latest
2929
php:
30-
- { version: '7.2', phpunit: '^8.5.40' }
31-
- { version: '7.3', phpunit: '^9.6.21' }
32-
- { version: '7.4', phpunit: '^9.6.21' }
33-
- { version: '8.0', phpunit: '^9.6.21' }
34-
- { version: '8.1', phpunit: '^9.6.21' }
35-
- { version: '8.2', phpunit: '^9.6.21' }
36-
- { version: '8.3', phpunit: '^9.6.21' }
37-
- { version: '8.4', phpunit: '^9.6.21' }
38-
- { version: '8.5', phpunit: '^9.6.25' }
30+
- { version: '7.2', phpunit: '^8.5.52' }
31+
- { version: '7.3', phpunit: '^9.6.34' }
32+
- { version: '7.4', phpunit: '^9.6.34' }
33+
- { version: '8.0', phpunit: '^9.6.34' }
34+
- { version: '8.1', phpunit: '^9.6.34' }
35+
- { version: '8.2', phpunit: '^9.6.34' }
36+
- { version: '8.3', phpunit: '^9.6.34' }
37+
- { version: '8.4', phpunit: '^9.6.34' }
38+
- { version: '8.5', phpunit: '^9.6.34' }
3939
dependencies:
4040
- lowest
4141
- highest

.php-cs-fixer.dist.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
],
3939
'no_whitespace_before_comma_in_array' => false, // Should be dropped when we drop support for PHP 7.x
4040
'stringable_for_to_string' => false,
41+
'modern_serialization_methods' => false, // Could be re-enabled when we drop support for PHP 7.3 and lower
4142
])
4243
->setRiskyAllowed(true)
4344
->setFinder(

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
"monolog/monolog": "^1.6|^2.0|^3.0",
3939
"phpbench/phpbench": "^1.0",
4040
"phpstan/phpstan": "^1.3",
41-
"phpunit/phpunit": "^8.5|^9.6",
41+
"phpunit/phpunit": "^8.5.52|^9.6.34",
4242
"vimeo/psalm": "^4.17"
4343
},
4444
"suggest": {

src/HttpClient/HttpClient.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public function sendRequest(Request $request, Options $options): Response
5757
}
5858

5959
$responseHeaders = [];
60-
$responseHeaderCallback = function ($curlHandle, $headerLine) use (&$responseHeaders): int {
60+
$responseHeaderCallback = static function ($curlHandle, $headerLine) use (&$responseHeaders): int {
6161
return Http::parseResponseHeaders($headerLine, $responseHeaders);
6262
};
6363

src/Logs/LogsAggregator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public function add(
8383
$log->setAttribute('sentry.sdk.version', $client->getSdkVersion());
8484
}
8585

86-
$hub->configureScope(function (Scope $scope) use ($log) {
86+
$hub->configureScope(static function (Scope $scope) use ($log) {
8787
$user = $scope->getUser();
8888
if ($user !== null) {
8989
if ($user->getId() !== null) {
@@ -186,7 +186,7 @@ private function getTraceId(HubInterface $hub): string
186186

187187
$traceId = '';
188188

189-
$hub->configureScope(function (Scope $scope) use (&$traceId) {
189+
$hub->configureScope(static function (Scope $scope) use (&$traceId) {
190190
$traceId = (string) $scope->getPropagationContext()->getTraceId();
191191
});
192192

src/Metrics/Metrics.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ public function timing(
109109
int $stackLevel = 0
110110
) {
111111
return trace(
112-
function () use ($callback) {
112+
static function () use ($callback) {
113113
return $callback();
114114
},
115115
SpanContext::make()

src/Metrics/MetricsAggregator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public function add(
7979
];
8080

8181
if ($options->shouldSendDefaultPii()) {
82-
$hub->configureScope(function (Scope $scope) use (&$defaultAttributes) {
82+
$hub->configureScope(static function (Scope $scope) use (&$defaultAttributes) {
8383
$user = $scope->getUser();
8484
if ($user !== null) {
8585
if ($user->getId() !== null) {
@@ -111,7 +111,7 @@ public function add(
111111
$spanId = $span->getSpanId();
112112
$traceId = $span->getTraceId();
113113
} else {
114-
$hub->configureScope(function (Scope $scope) use (&$traceId, &$spanId) {
114+
$hub->configureScope(static function (Scope $scope) use (&$traceId, &$spanId) {
115115
$propagationContext = $scope->getPropagationContext();
116116
$traceId = $propagationContext->getTraceId();
117117
$spanId = $propagationContext->getSpanId();

src/Tracing/Span.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ public function setStatus(?SpanStatus $status)
300300
*/
301301
public function setHttpStatus(int $statusCode)
302302
{
303-
SentrySdk::getCurrentHub()->configureScope(function (Scope $scope) use ($statusCode) {
303+
SentrySdk::getCurrentHub()->configureScope(static function (Scope $scope) use ($statusCode) {
304304
$scope->setContext('response', [
305305
'status_code' => $statusCode,
306306
]);

src/functions.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ function startTransaction(TransactionContext $context, array $customSamplingCont
252252
*/
253253
function trace(callable $trace, SpanContext $context)
254254
{
255-
return SentrySdk::getCurrentHub()->withScope(function (Scope $scope) use ($context, $trace) {
255+
return SentrySdk::getCurrentHub()->withScope(static function (Scope $scope) use ($context, $trace) {
256256
$parentSpan = $scope->getSpan();
257257

258258
// If there is a span set on the scope and it's sampled there is an active transaction.
@@ -299,7 +299,7 @@ function getTraceparent(): string
299299
}
300300

301301
$traceParent = '';
302-
$hub->configureScope(function (Scope $scope) use (&$traceParent) {
302+
$hub->configureScope(static function (Scope $scope) use (&$traceParent) {
303303
$traceParent = $scope->getPropagationContext()->toTraceparent();
304304
});
305305

@@ -342,7 +342,7 @@ function getBaggage(): string
342342
}
343343

344344
$baggage = '';
345-
$hub->configureScope(function (Scope $scope) use (&$baggage) {
345+
$hub->configureScope(static function (Scope $scope) use (&$baggage) {
346346
$baggage = $scope->getPropagationContext()->toBaggage();
347347
});
348348

@@ -358,7 +358,7 @@ function getBaggage(): string
358358
function continueTrace(string $sentryTrace, string $baggage): TransactionContext
359359
{
360360
$hub = SentrySdk::getCurrentHub();
361-
$hub->configureScope(function (Scope $scope) use ($sentryTrace, $baggage) {
361+
$hub->configureScope(static function (Scope $scope) use ($sentryTrace, $baggage) {
362362
$propagationContext = PropagationContext::fromHeaders($sentryTrace, $baggage);
363363
$scope->setPropagationContext($propagationContext);
364364
});
@@ -393,7 +393,7 @@ function trace_metrics(): TraceMetrics
393393
*/
394394
function addFeatureFlag(string $name, bool $result): void
395395
{
396-
SentrySdk::getCurrentHub()->configureScope(function (Scope $scope) use ($name, $result) {
396+
SentrySdk::getCurrentHub()->configureScope(static function (Scope $scope) use ($name, $result) {
397397
$scope->addFeatureFlag($name, $result);
398398
});
399399
}

tests/ClientTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1033,7 +1033,7 @@ public function testAttachStacktrace(): void
10331033
$transport = $this->createMock(TransportInterface::class);
10341034
$transport->expects($this->once())
10351035
->method('send')
1036-
->with($this->callback(function (Event $event): bool {
1036+
->with($this->callback(static function (Event $event): bool {
10371037
$result = $event->getStacktrace();
10381038

10391039
return $result !== null;

0 commit comments

Comments
 (0)