diff --git a/src/SchemaDumper.php b/src/SchemaDumper.php index a2c8f8cf6..08cd3990c 100644 --- a/src/SchemaDumper.php +++ b/src/SchemaDumper.php @@ -57,7 +57,7 @@ public function dump( string $fqcn, array $excludedTablesRegexes = [], bool $formatted = false, - bool $nowdocOutput = false, + bool|null $nowdocOutput = null, int $lineLength = 120, ): string { $schema = $this->schemaManager->introspectSchema(); diff --git a/src/Tools/Console/Command/DiffCommand.php b/src/Tools/Console/Command/DiffCommand.php index ec82d8ccc..751a142b3 100644 --- a/src/Tools/Console/Command/DiffCommand.php +++ b/src/Tools/Console/Command/DiffCommand.php @@ -67,7 +67,7 @@ protected function configure(): void 'nowdoc', null, InputOption::VALUE_NEGATABLE, - 'Output the generated SQL as a nowdoc string (always active for formatted queries).', + 'Output the generated SQL as a nowdoc string (enabled by default for formatted queries).', ) ->addOption( 'line-length', @@ -108,7 +108,8 @@ protected function execute( } $formatted = filter_var($input->getOption('formatted'), FILTER_VALIDATE_BOOLEAN); - $nowdocOutput = filter_var($input->getOption('nowdoc'), FILTER_VALIDATE_BOOLEAN); + $nowdocOutput = $input->getOption('nowdoc'); + $nowdocOutput = $nowdocOutput === null ? null : filter_var($input->getOption('nowdoc'), FILTER_VALIDATE_BOOLEAN); $lineLength = (int) $input->getOption('line-length'); $allowEmptyDiff = $input->getOption('allow-empty-diff'); $checkDbPlatform = filter_var($input->getOption('check-database-platform'), FILTER_VALIDATE_BOOLEAN); diff --git a/src/Tools/Console/Command/DumpSchemaCommand.php b/src/Tools/Console/Command/DumpSchemaCommand.php index 43be069bb..86a37e493 100644 --- a/src/Tools/Console/Command/DumpSchemaCommand.php +++ b/src/Tools/Console/Command/DumpSchemaCommand.php @@ -55,8 +55,8 @@ protected function configure(): void ->addOption( 'nowdoc', null, - InputOption::VALUE_NONE, - 'Output the generated SQL as a nowdoc string (always active for formatted queries).', + InputOption::VALUE_NEGATABLE, + 'Output the generated SQL as a nowdoc string (enabled by default for formatted queries).', ) ->addOption( 'namespace', @@ -85,7 +85,8 @@ public function execute( OutputInterface $output, ): int { $formatted = filter_var($input->getOption('formatted'), FILTER_VALIDATE_BOOLEAN); - $nowdocOutput = filter_var($input->getOption('nowdoc'), FILTER_VALIDATE_BOOLEAN); + $nowdocOutput = $input->getOption('nowdoc'); + $nowdocOutput = $nowdocOutput === null ? null : filter_var($input->getOption('nowdoc'), FILTER_VALIDATE_BOOLEAN); $lineLength = (int) $input->getOption('line-length'); $schemaDumper = $this->getDependencyFactory()->getSchemaDumper();