src/Command/DropDatabaseDoctrineCommand.php
private function dropDatabase(
        OutputInterface $output,
        string $connectionName,
        Connection $connection,
        string $dbName,
        bool $shouldDropDatabase
    ): int {
        try {
            if ($shouldDropDatabase) {
                $connection->getSchemaManager()->dropDatabase($dbName);
                $output->writeln(
                    sprintf(
                        '<info>Dropped database <comment>%s</comment> for connection'
                            .' named <comment>%s</comment>.</info>',
                        $dbName,
                        $connectionName
                    )
                );
            } else {
                $output->writeln(
                    sprintf(
                        '<info>Database <comment>%s</comment> for connection named <comment>%s</comment>'
                            .' doesn\'t exist. Skipped.</info>',
                        $dbName,
                        $connectionName
                    )
                );
            }
        } catch (\Exception $e) {
            $output->writeln(
                sprintf(
                    '<error>Could not drop database <comment>%s</comment> for connection'
                        .' named <comment>%s</comment>.</error>',
                    $dbName,
                    $connectionName
                )
            );
            $output->writeln(sprintf('<error>%s</error>', $e->getMessage()));

            return self::RETURN_CODE_NOT_DROP;
        }

        return 0;
    }
private function dropDatabase(
        OutputInterface $output,
        string $connectionName,
        Connection $connection,
        string $dbName,
        bool $shouldDropDatabase
    ): int {
        try {
            if ($shouldDropDatabase) {
                $connection->getSchemaManager()->dropDatabase($dbName);
                $output->writeln(
                    sprintf(
                        '<info>Dropped database <comment>%s</comment> for connection'
                            .' named <comment>%s</comment>.</info>',
                        $dbName,
                        $connectionName
                    )
                );
            } else {
                $output->writeln(
                    sprintf(
                        '<info>Database <comment>%s</comment> for connection named <comment>%s</comment>'
                            .' doesn\'t exist. Skipped.</info>',
                        $dbName,
                        $connectionName
                    )
                );
            }
        } catch (\Exception $e) {
            $output->writeln(
                sprintf(
                    '<error>Could not drop database <comment>%s</comment> for connection'
                        .' named <comment>%s</comment>.</error>',
                    $dbName,
                    $connectionName
                )
            );
            $output->writeln(sprintf('<error>%s</error>', $e->getMessage()));

            return self::RETURN_CODE_NOT_DROP;
        }

        return 0;
    }
@param OutputInterface $output
@param string          $connectionName
@param Connection      $connection
@param string          $dbName
@param bool            $shouldNotCreateDatabase

@return int