Skip to content

Commit 3bc8a35

Browse files
committed
fix: use valid hook signature
1 parent 963cff3 commit 3bc8a35

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

src/Instrumentation/PDO/src/PDOInstrumentation.php

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,14 @@ public static function register(): void
3636
hook(
3737
PDO::class,
3838
'connect',
39-
pre: static function (PDO $pdo, array $params, string $class, string $function, ?string $filename, ?int $lineno) use ($instrumentation) {
39+
pre: static function (
40+
$object,
41+
array $params,
42+
string $class,
43+
string $function,
44+
?string $filename,
45+
?int $lineno,
46+
) use ($instrumentation) {
4047
/** @psalm-suppress ArgumentTypeCoercion */
4148
$builder = self::makeBuilder($instrumentation, 'PDO::connect', $function, $class, $filename, $lineno)
4249
->setSpanKind(SpanKind::KIND_CLIENT);
@@ -49,7 +56,12 @@ public static function register(): void
4956
$span = $builder->startSpan();
5057
Context::storage()->attach($span->storeInContext($parent));
5158
},
52-
post: static function (PDO $pdo, array $params, mixed $statement, ?Throwable $exception) use ($pdoTracker) {
59+
post: static function (
60+
$object,
61+
array $params,
62+
$result,
63+
?Throwable $exception,
64+
) use ($pdoTracker) {
5365
$scope = Context::storage()->scope();
5466
if (!$scope) {
5567
return;
@@ -58,7 +70,7 @@ public static function register(): void
5870

5971
$dsn = $params[0] ?? '';
6072

61-
$attributes = $pdoTracker->trackPdoAttributes($pdo, $dsn);
73+
$attributes = $pdoTracker->trackPdoAttributes($object, $dsn);
6274
$span->setAttributes($attributes);
6375

6476
self::end($exception);

0 commit comments

Comments
 (0)