diff --git a/UPGRADE.md b/UPGRADE.md index a502c872e..3132aef98 100644 --- a/UPGRADE.md +++ b/UPGRADE.md @@ -1,5 +1,9 @@ # Upgrade to 2.6 +## Minor BC BREAK: `Doctrine\ORM\Tools\Console\ConsoleRunner` is now final + +Since it's just an utilitarian class and should not be inherited. + ## Minor BC BREAK: removed `Doctrine\ORM\Query\Parser#isInternalFunction` Method `Doctrine\ORM\Query\QueryException::associationPathInverseSideNotSupported` diff --git a/lib/Doctrine/ORM/Tools/Console/ConsoleRunner.php b/lib/Doctrine/ORM/Tools/Console/ConsoleRunner.php index a6f198507..c6a265cc0 100644 --- a/lib/Doctrine/ORM/Tools/Console/ConsoleRunner.php +++ b/lib/Doctrine/ORM/Tools/Console/ConsoleRunner.php @@ -19,44 +19,44 @@ namespace Doctrine\ORM\Tools\Console; +use Doctrine\DBAL\Tools\Console as DBALConsole; +use Doctrine\ORM\EntityManagerInterface; +use Doctrine\ORM\Tools\Console\Helper\EntityManagerHelper; +use Doctrine\ORM\Version; use Symfony\Component\Console\Application; use Symfony\Component\Console\Helper\HelperSet; -use Doctrine\ORM\Version; -use Doctrine\ORM\EntityManagerInterface; - -use Doctrine\DBAL\Tools\Console\Helper\ConnectionHelper; -use Doctrine\ORM\Tools\Console\Helper\EntityManagerHelper; /** * Handles running the Console Tools inside Symfony Console context. */ -class ConsoleRunner +final class ConsoleRunner { /** * Create a Symfony Console HelperSet * * @param EntityManagerInterface $entityManager + * * @return HelperSet */ - public static function createHelperSet(EntityManagerInterface $entityManager) + public static function createHelperSet(EntityManagerInterface $entityManager) : HelperSet { return new HelperSet( [ - 'db' => new ConnectionHelper($entityManager->getConnection()), - 'em' => new EntityManagerHelper($entityManager) + 'db' => new DBALConsole\Helper\ConnectionHelper($entityManager->getConnection()), + 'em' => new EntityManagerHelper($entityManager), ] ); } /** - * Runs console with the given helperset. + * Runs console with the given helper set. * * @param \Symfony\Component\Console\Helper\HelperSet $helperSet * @param \Symfony\Component\Console\Command\Command[] $commands * * @return void */ - static public function run(HelperSet $helperSet, $commands = []) + public static function run(HelperSet $helperSet, array $commands = []) : void { $cli = self::createApplication($helperSet, $commands); $cli->run(); @@ -71,7 +71,7 @@ class ConsoleRunner * * @return \Symfony\Component\Console\Application */ - static public function createApplication(HelperSet $helperSet, $commands = []) + public static function createApplication(HelperSet $helperSet, array $commands = []) : Application { $cli = new Application('Doctrine Command Line Interface', Version::VERSION); $cli->setCatchExceptions(true); @@ -87,40 +87,40 @@ class ConsoleRunner * * @return void */ - static public function addCommands(Application $cli) + public static function addCommands(Application $cli) : void { $cli->addCommands( [ // DBAL Commands - new \Doctrine\DBAL\Tools\Console\Command\ImportCommand(), - new \Doctrine\DBAL\Tools\Console\Command\ReservedWordsCommand(), - new \Doctrine\DBAL\Tools\Console\Command\RunSqlCommand(), + new DBALConsole\Command\ImportCommand(), + new DBALConsole\Command\ReservedWordsCommand(), + new DBALConsole\Command\RunSqlCommand(), // ORM Commands - new \Doctrine\ORM\Tools\Console\Command\ClearCache\CollectionRegionCommand(), - new \Doctrine\ORM\Tools\Console\Command\ClearCache\EntityRegionCommand(), - new \Doctrine\ORM\Tools\Console\Command\ClearCache\MetadataCommand(), - new \Doctrine\ORM\Tools\Console\Command\ClearCache\QueryCommand(), - new \Doctrine\ORM\Tools\Console\Command\ClearCache\QueryRegionCommand(), - new \Doctrine\ORM\Tools\Console\Command\ClearCache\ResultCommand(), - new \Doctrine\ORM\Tools\Console\Command\SchemaTool\CreateCommand(), - new \Doctrine\ORM\Tools\Console\Command\SchemaTool\UpdateCommand(), - new \Doctrine\ORM\Tools\Console\Command\SchemaTool\DropCommand(), - new \Doctrine\ORM\Tools\Console\Command\EnsureProductionSettingsCommand(), - new \Doctrine\ORM\Tools\Console\Command\ConvertDoctrine1SchemaCommand(), - new \Doctrine\ORM\Tools\Console\Command\GenerateRepositoriesCommand(), - new \Doctrine\ORM\Tools\Console\Command\GenerateEntitiesCommand(), - new \Doctrine\ORM\Tools\Console\Command\GenerateProxiesCommand(), - new \Doctrine\ORM\Tools\Console\Command\ConvertMappingCommand(), - new \Doctrine\ORM\Tools\Console\Command\RunDqlCommand(), - new \Doctrine\ORM\Tools\Console\Command\ValidateSchemaCommand(), - new \Doctrine\ORM\Tools\Console\Command\InfoCommand(), - new \Doctrine\ORM\Tools\Console\Command\MappingDescribeCommand(), + new Command\ClearCache\CollectionRegionCommand(), + new Command\ClearCache\EntityRegionCommand(), + new Command\ClearCache\MetadataCommand(), + new Command\ClearCache\QueryCommand(), + new Command\ClearCache\QueryRegionCommand(), + new Command\ClearCache\ResultCommand(), + new Command\SchemaTool\CreateCommand(), + new Command\SchemaTool\UpdateCommand(), + new Command\SchemaTool\DropCommand(), + new Command\EnsureProductionSettingsCommand(), + new Command\ConvertDoctrine1SchemaCommand(), + new Command\GenerateRepositoriesCommand(), + new Command\GenerateEntitiesCommand(), + new Command\GenerateProxiesCommand(), + new Command\ConvertMappingCommand(), + new Command\RunDqlCommand(), + new Command\ValidateSchemaCommand(), + new Command\InfoCommand(), + new Command\MappingDescribeCommand(), ] ); } - static public function printCliConfigTemplate() + public static function printCliConfigTemplate() : void { echo <<<'HELP' You are missing a "cli-config.php" or "config/cli-config.php" file in your @@ -139,6 +139,5 @@ $entityManager = GetEntityManager(); return ConsoleRunner::createHelperSet($entityManager); HELP; - } }