From 40c1b6e6b1c5e353ab739b4ec5b3f20fbd9ac1f4 Mon Sep 17 00:00:00 2001 From: Andreas Braun Date: Wed, 27 Nov 2019 10:31:38 +0100 Subject: [PATCH 1/4] Fix wrong signature for data collector --- DataCollector/CommandDataCollector.php | 5 ++--- .../CommandDataCollectorTest.php | 21 +++++++++++++++++++ 2 files changed, 23 insertions(+), 3 deletions(-) create mode 100644 Tests/DataCollector/CommandDataCollectorTest.php diff --git a/DataCollector/CommandDataCollector.php b/DataCollector/CommandDataCollector.php index f88bcb01..0cc9aff0 100644 --- a/DataCollector/CommandDataCollector.php +++ b/DataCollector/CommandDataCollector.php @@ -6,10 +6,10 @@ use Doctrine\ODM\MongoDB\APM\Command; use Doctrine\ODM\MongoDB\APM\CommandLogger; -use Exception; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\DataCollector\DataCollector; +use Throwable; use function array_map; use function count; use function json_encode; @@ -24,8 +24,7 @@ public function __construct(CommandLogger $commandLogger) $this->commandLogger = $commandLogger; } - // phpcs:ignore SlevomatCodingStandard.Exceptions.ReferenceThrowableOnly - public function collect(Request $request, Response $response, ?Exception $exception = null) : void + public function collect(Request $request, Response $response, ?Throwable $exception = null) : void { $this->data = [ 'num_commands' => count($this->commandLogger), diff --git a/Tests/DataCollector/CommandDataCollectorTest.php b/Tests/DataCollector/CommandDataCollectorTest.php new file mode 100644 index 00000000..43899cc8 --- /dev/null +++ b/Tests/DataCollector/CommandDataCollectorTest.php @@ -0,0 +1,21 @@ +collect($request = new Request(['group' => '0']), $response = new Response()); + } +} From b81a9bc476108386951e060e72bef2c8b6144eae Mon Sep 17 00:00:00 2001 From: Andreas Braun Date: Wed, 27 Nov 2019 21:03:08 +0100 Subject: [PATCH 2/4] Drop support for Symfony 3.4 --- .travis.yml | 4 ---- DependencyInjection/Configuration.php | 3 +-- README.markdown | 2 +- composer.json | 18 +++++++++--------- 4 files changed, 11 insertions(+), 16 deletions(-) diff --git a/.travis.yml b/.travis.yml index 38f14377..ec22e338 100644 --- a/.travis.yml +++ b/.travis.yml @@ -37,10 +37,6 @@ jobs: - php: 7.2 env: LOWEST DRIVER_VERSION="1.5.0" SYMFONY_DEPRECATIONS_HELPER=weak COMPOSER_FLAGS=" -n --prefer-lowest --prefer-stable --prefer-dist" - # Test against latest Symfony 3.4 stable - - php: 7.3 - env: SYMFONY_REQUIRE="3.4.*" - # Test against latest Symfony 4.3 stable - php: 7.3 env: SYMFONY_REQUIRE="4.3.*" diff --git a/DependencyInjection/Configuration.php b/DependencyInjection/Configuration.php index 06e2ac21..abf2b746 100644 --- a/DependencyInjection/Configuration.php +++ b/DependencyInjection/Configuration.php @@ -18,7 +18,6 @@ use function is_array; use function is_string; use function json_decode; -use function method_exists; use function preg_match; use function sprintf; @@ -35,7 +34,7 @@ class Configuration implements ConfigurationInterface public function getConfigTreeBuilder() { $treeBuilder = new TreeBuilder('doctrine_mongodb'); - $rootNode = method_exists(TreeBuilder::class, 'getRootNode') ? $treeBuilder->getRootNode() : $treeBuilder->root('doctrine_mongodb'); + $rootNode = $treeBuilder->getRootNode(); $this->addDocumentManagersSection($rootNode); $this->addConnectionsSection($rootNode); diff --git a/README.markdown b/README.markdown index aa79dda5..7f37a9ae 100644 --- a/README.markdown +++ b/README.markdown @@ -15,7 +15,7 @@ Compatibility The current version of this bundle has the following requirements: * PHP 7.2 or newer is required * `ext-mongodb` 1.5 or newer - * Symfony 3.4 or newer is required + * Symfony 4.3 or newer is required Support for older Symfony, PHP and MongoDB versions is provided via the `3.0.x` releases (tracked in the `3.0` branch). This version sees bug and security fixes diff --git a/composer.json b/composer.json index cfea4089..b2357cd3 100644 --- a/composer.json +++ b/composer.json @@ -16,21 +16,21 @@ "doctrine/annotations": "^1.2", "doctrine/mongodb-odm": "^2.0.0", "psr/log": "^1.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" + "symfony/console": "^4.3.3|^5.0", + "symfony/dependency-injection": "^4.3.3|^5.0", + "symfony/doctrine-bridge": "^4.3.3|^5.0", + "symfony/config": "^4.3.3|^5.0", + "symfony/framework-bundle": "^4.3.3|^5.0", + "symfony/options-resolver": "^4.3.3|^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 || ^5.0", - "symfony/phpunit-bridge": "^3.4 || ^4.0 || ^5.0", - "symfony/yaml": "^3.4 || ^4.0 || ^5.0" + "symfony/form": "^4.3.3|^5.0", + "symfony/phpunit-bridge": "^4.3.3|^5.0", + "symfony/yaml": "^4.3.3|^5.0" }, "suggest": { "doctrine/data-fixtures": "Load data fixtures" From 6ae9fe7ebdbb8b7b47eb32db7b61f555ecc8345d Mon Sep 17 00:00:00 2001 From: Andreas Braun Date: Wed, 27 Nov 2019 21:16:42 +0100 Subject: [PATCH 3/4] Fix installation of symfony/flex --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index ec22e338..ee768ff4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,7 +21,7 @@ env: before_install: - mv ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini{,.disabled} || echo "xdebug not available" - - composer global require --no-update --no-progress --no-scripts --no-plugins symfony/flex dev-master + - composer global require --no-progress --no-scripts --no-plugins symfony/flex dev-master install: - composer self-update From 086ba137be7604155a37aced02197a944a6c5e1f Mon Sep 17 00:00:00 2001 From: Andreas Braun Date: Wed, 27 Nov 2019 21:20:51 +0100 Subject: [PATCH 4/4] Fix symfony/http-kernel dependency to allow for compatibility with Symfony 5 --- composer.json | 1 + 1 file changed, 1 insertion(+) diff --git a/composer.json b/composer.json index b2357cd3..55d08f00 100644 --- a/composer.json +++ b/composer.json @@ -21,6 +21,7 @@ "symfony/doctrine-bridge": "^4.3.3|^5.0", "symfony/config": "^4.3.3|^5.0", "symfony/framework-bundle": "^4.3.3|^5.0", + "symfony/http-kernel": "^4.3.7|^5.0", "symfony/options-resolver": "^4.3.3|^5.0" }, "require-dev": {