Skip to content

Commit b38441b

Browse files
authored
Move symfony/var-dumper to dev dependencies (#2898)
Use `Command::isEnabled()` to conditionally enable the `odm:query` command when the dependency is available.
1 parent 3552b4e commit b38441b

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

composer.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
"psr/cache": "^1.0 || ^2.0 || ^3.0",
3838
"symfony/console": "^5.4 || ^6.0 || ^7.0",
3939
"symfony/deprecation-contracts": "^2.2 || ^3.0",
40-
"symfony/var-dumper": "^5.4 || ^6.0 || ^7.0",
4140
"symfony/var-exporter": "^6.2 || ^7.0"
4241
},
4342
"require-dev": {
@@ -53,14 +52,16 @@
5352
"phpunit/phpunit": "^10.5.58",
5453
"squizlabs/php_codesniffer": "^4",
5554
"symfony/cache": "^5.4 || ^6.0 || ^7.0",
56-
"symfony/uid": "^5.4 || ^6.0 || ^7.0"
55+
"symfony/uid": "^5.4 || ^6.0 || ^7.0",
56+
"symfony/var-dumper": "^5.4 || ^6.0 || ^7.0"
5757
},
5858
"conflict": {
5959
"doctrine/annotations": "<1.12 || >=3.0"
6060
},
6161
"suggest": {
6262
"doctrine/annotations": "For annotation mapping support",
63-
"ext-bcmath": "Decimal128 type support"
63+
"ext-bcmath": "Decimal128 type support",
64+
"symfony/var-dumper": "To enable the odm:query command"
6465
},
6566
"autoload": {
6667
"psr-4": { "Doctrine\\ODM\\MongoDB\\": "src" }

src/Tools/Console/Command/QueryCommand.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use Symfony\Component\VarDumper\Dumper\CliDumper;
1515

1616
use function assert;
17+
use function class_exists;
1718
use function is_numeric;
1819
use function is_string;
1920
use function json_decode;
@@ -108,4 +109,9 @@ private function doExecute(InputInterface $input, OutputInterface $output): int
108109

109110
return 0;
110111
}
112+
113+
public function isEnabled(): bool
114+
{
115+
return class_exists(VarCloner::class);
116+
}
111117
}

0 commit comments

Comments
 (0)