Skip to content

Commit 1b88fcb

Browse files
authored
Merge pull request #1526 from gharlan/nowdoc
Fix handling of `--nowdoc` options
2 parents cd12028 + c234173 commit 1b88fcb

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

src/SchemaDumper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public function dump(
5757
string $fqcn,
5858
array $excludedTablesRegexes = [],
5959
bool $formatted = false,
60-
bool $nowdocOutput = false,
60+
bool|null $nowdocOutput = null,
6161
int $lineLength = 120,
6262
): string {
6363
$schema = $this->schemaManager->introspectSchema();

src/Tools/Console/Command/DiffCommand.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ protected function configure(): void
6767
'nowdoc',
6868
null,
6969
InputOption::VALUE_NEGATABLE,
70-
'Output the generated SQL as a nowdoc string (always active for formatted queries).',
70+
'Output the generated SQL as a nowdoc string (enabled by default for formatted queries).',
7171
)
7272
->addOption(
7373
'line-length',
@@ -108,7 +108,8 @@ protected function execute(
108108
}
109109

110110
$formatted = filter_var($input->getOption('formatted'), FILTER_VALIDATE_BOOLEAN);
111-
$nowdocOutput = filter_var($input->getOption('nowdoc'), FILTER_VALIDATE_BOOLEAN);
111+
$nowdocOutput = $input->getOption('nowdoc');
112+
$nowdocOutput = $nowdocOutput === null ? null : filter_var($input->getOption('nowdoc'), FILTER_VALIDATE_BOOLEAN);
112113
$lineLength = (int) $input->getOption('line-length');
113114
$allowEmptyDiff = $input->getOption('allow-empty-diff');
114115
$checkDbPlatform = filter_var($input->getOption('check-database-platform'), FILTER_VALIDATE_BOOLEAN);

src/Tools/Console/Command/DumpSchemaCommand.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ protected function configure(): void
5555
->addOption(
5656
'nowdoc',
5757
null,
58-
InputOption::VALUE_NONE,
59-
'Output the generated SQL as a nowdoc string (always active for formatted queries).',
58+
InputOption::VALUE_NEGATABLE,
59+
'Output the generated SQL as a nowdoc string (enabled by default for formatted queries).',
6060
)
6161
->addOption(
6262
'namespace',
@@ -85,7 +85,8 @@ public function execute(
8585
OutputInterface $output,
8686
): int {
8787
$formatted = filter_var($input->getOption('formatted'), FILTER_VALIDATE_BOOLEAN);
88-
$nowdocOutput = filter_var($input->getOption('nowdoc'), FILTER_VALIDATE_BOOLEAN);
88+
$nowdocOutput = $input->getOption('nowdoc');
89+
$nowdocOutput = $nowdocOutput === null ? null : filter_var($input->getOption('nowdoc'), FILTER_VALIDATE_BOOLEAN);
8990
$lineLength = (int) $input->getOption('line-length');
9091

9192
$schemaDumper = $this->getDependencyFactory()->getSchemaDumper();

0 commit comments

Comments
 (0)