Skip to content

Commit

Permalink
Fix deprecations in CommandDataCollector
Browse files Browse the repository at this point in the history
  • Loading branch information
andrey-tech committed Sep 30, 2024
1 parent 48c2900 commit 2d109f2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions DataCollector/CommandDataCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use Doctrine\ODM\MongoDB\APM\Command;
use Doctrine\ODM\MongoDB\APM\CommandLogger;
use MongoDB\BSON\Document;
use stdClass;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
Expand All @@ -16,8 +17,6 @@
use function array_reduce;
use function count;
use function json_decode;
use function MongoDB\BSON\fromPHP;
use function MongoDB\BSON\toCanonicalExtendedJSON;

/** @internal since version 4.7.0 */
class CommandDataCollector extends DataCollector
Expand All @@ -33,10 +32,11 @@ public function collect(Request $request, Response $response, ?Throwable $except
'commands' => array_map(
static function (Command $command): array {
$dbProperty = '$db';
$document = Document::fromPHP($command->getCommand());

Check failure on line 35 in DataCollector/CommandDataCollector.php

View workflow job for this annotation

GitHub Actions / Coding Standards / Coding Standards (8.2)

Equals sign not aligned with surrounding assignments; expected 3 spaces but found 1 space

return [
'database' => $command->getCommand()->$dbProperty ?? '',
'command' => json_decode(toCanonicalExtendedJSON(fromPHP($command->getCommand()))),
'command' => json_decode($document->toCanonicalExtendedJSON()),
'durationMicros' => $command->getDurationMicros(),
];
},
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"homepage": "http://www.doctrine-project.org",
"require": {
"php": "^8.1",
"ext-mongodb": "^1.5",
"ext-mongodb": "^1.16",
"doctrine/annotations": "^1.13 || ^2.0",
"doctrine/mongodb-odm": "^2.3",
"doctrine/persistence": "^2.2 || ^3.0",
Expand Down

0 comments on commit 2d109f2

Please sign in to comment.