From 5c5084a1eedc12aa50b3cad2227c1e7c550c3cc6 Mon Sep 17 00:00:00 2001 From: Robin Chalas Date: Wed, 20 Nov 2019 11:19:35 +0100 Subject: [PATCH] Fix symfony 5 compatibility --- Command/InfoDoctrineODMCommand.php | 2 ++ Command/LoadDataFixturesDoctrineODMCommand.php | 4 +++- Command/TailCursorDoctrineODMCommand.php | 2 ++ .../DoctrineMongoDBExtension.php | 5 +++++ Tests/Form/Type/DocumentTypeTest.php | 4 ++-- Tests/Form/Type/TypeGuesserTest.php | 4 ++-- composer.json | 18 +++++++++--------- 7 files changed, 25 insertions(+), 14 deletions(-) diff --git a/Command/InfoDoctrineODMCommand.php b/Command/InfoDoctrineODMCommand.php index f7a19ea4..e98f7f74 100644 --- a/Command/InfoDoctrineODMCommand.php +++ b/Command/InfoDoctrineODMCommand.php @@ -75,5 +75,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $output->write('', true); } } + + return 0; } } diff --git a/Command/LoadDataFixturesDoctrineODMCommand.php b/Command/LoadDataFixturesDoctrineODMCommand.php index 26566e01..ead652d0 100644 --- a/Command/LoadDataFixturesDoctrineODMCommand.php +++ b/Command/LoadDataFixturesDoctrineODMCommand.php @@ -90,7 +90,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $question = new ConfirmationQuestion('Careful, database will be purged. Do you want to continue (y/N) ?', false); if (! $helper->ask($input, $output, $question)) { - return; + return 0; } } @@ -118,5 +118,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $output->writeln(sprintf(' > %s', $message)); }); $executor->execute($fixtures, $input->getOption('append')); + + return 0; } } diff --git a/Command/TailCursorDoctrineODMCommand.php b/Command/TailCursorDoctrineODMCommand.php index eaaebb09..65cca98c 100644 --- a/Command/TailCursorDoctrineODMCommand.php +++ b/Command/TailCursorDoctrineODMCommand.php @@ -89,6 +89,8 @@ protected function execute(InputInterface $input, OutputInterface $output) $dm->clear(); } + + return 0; } /** diff --git a/DependencyInjection/DoctrineMongoDBExtension.php b/DependencyInjection/DoctrineMongoDBExtension.php index 92f44433..d6bd65b7 100644 --- a/DependencyInjection/DoctrineMongoDBExtension.php +++ b/DependencyInjection/DoctrineMongoDBExtension.php @@ -420,6 +420,11 @@ protected function getMappingResourceExtension() return 'mongodb'; } + protected function getMetadataDriverClass(string $driverType) : string + { + return '%' . $this->getObjectManagerElementName('metadata.' . $driverType . '.class') . '%'; + } + public function getAlias() { return 'doctrine_mongodb'; diff --git a/Tests/Form/Type/DocumentTypeTest.php b/Tests/Form/Type/DocumentTypeTest.php index d92ec87b..8af133d7 100644 --- a/Tests/Form/Type/DocumentTypeTest.php +++ b/Tests/Form/Type/DocumentTypeTest.php @@ -30,7 +30,7 @@ class DocumentTypeTest extends TypeTestCase private $typeFQCN; - public function setUp() + public function setUp() : void { $this->typeFQCN = method_exists(AbstractType::class, 'getBlockPrefix'); @@ -42,7 +42,7 @@ public function setUp() parent::setUp(); } - protected function tearDown() + protected function tearDown() : void { $documentClasses = [ Document::class, diff --git a/Tests/Form/Type/TypeGuesserTest.php b/Tests/Form/Type/TypeGuesserTest.php index e887f38b..f656b56b 100644 --- a/Tests/Form/Type/TypeGuesserTest.php +++ b/Tests/Form/Type/TypeGuesserTest.php @@ -27,7 +27,7 @@ class TypeGuesserTest extends TypeTestCase private $typeFQCN; - public function setUp() + public function setUp() : void { $this->typeFQCN = method_exists(AbstractType::class, 'getBlockPrefix'); @@ -39,7 +39,7 @@ public function setUp() parent::setUp(); } - protected function tearDown() + protected function tearDown() : void { $documentClasses = [ Document::class, diff --git a/composer.json b/composer.json index 5a572560..9a387229 100644 --- a/composer.json +++ b/composer.json @@ -15,21 +15,21 @@ "doctrine/annotations": "^1.2", "doctrine/mongodb-odm": "^2.0.0", "psr/log": "^1.0", - "symfony/console": "^3.4 || ^4.0", - "symfony/dependency-injection": "^3.4 || ^4.0", - "symfony/doctrine-bridge": "^3.4 || ^4.0", - "symfony/config": "^3.4 || ^4.0", - "symfony/framework-bundle": "^3.4 || ^4.0", - "symfony/options-resolver": "^3.4 || ^4.0" + "symfony/console": "^3.4 || ^4.0 || ^5.0", + "symfony/dependency-injection": "^3.4 || ^4.0 || ^5.0", + "symfony/doctrine-bridge": "^3.4 || ^4.0 || ^5.0", + "symfony/config": "^3.4 || ^4.0 || ^5.0", + "symfony/framework-bundle": "^3.4 || ^4.0 || ^5.0", + "symfony/options-resolver": "^3.4 || ^4.0 || ^5.0" }, "require-dev": { "doctrine/coding-standard": "^6.0", "doctrine/data-fixtures": "^1.2.2", "phpunit/phpunit": "^7.3", "squizlabs/php_codesniffer": "^3.5", - "symfony/form": "^3.4 || ^4.0", - "symfony/phpunit-bridge": "^3.4 || ^4.0", - "symfony/yaml": "^3.4 || ^4.0" + "symfony/form": "^3.4 || ^4.0 || ^5.0", + "symfony/phpunit-bridge": "^3.4 || ^4.0 || ^5.0", + "symfony/yaml": "^3.4 || ^4.0 || ^5.0" }, "suggest": { "doctrine/data-fixtures": "Load data fixtures"