From 406637ae6fb59c8b9ee6f6a2b0c16c8a30d097d0 Mon Sep 17 00:00:00 2001 From: core23 Date: Thu, 21 Nov 2019 22:43:13 +0100 Subject: [PATCH] [MINOR] Drop support for symfony < 4.2 --- .travis.yml | 3 --- composer.json | 18 +++++++++--------- phpstan.neon.dist | 10 ---------- src/DependencyInjection/Configuration.php | 8 ++------ 4 files changed, 11 insertions(+), 28 deletions(-) diff --git a/.travis.yml b/.travis.yml index 2711c4c1..b5f10497 100644 --- a/.travis.yml +++ b/.travis.yml @@ -40,9 +40,6 @@ matrix: - stage: test php: 7.2 env: COMPOSER_FLAGS="--prefer-lowest" - - stage: test - php: 7.3 - env: SYMFONY_VERSION=3.4.* - stage: test php: 7.3 env: SYMFONY_VERSION=4.2.* diff --git a/composer.json b/composer.json index bf9bd867..ab22a9c8 100644 --- a/composer.json +++ b/composer.json @@ -31,15 +31,15 @@ "psr/http-message": "^1.0", "sonata-project/block-bundle": "^3.18", "sonata-project/core-bundle": "^3.17", - "symfony/config": "^3.4 || ^4.2", - "symfony/dependency-injection": "^3.4 || ^4.2", - "symfony/expression-language": "^3.4 || ^4.2", - "symfony/form": "^3.4 || ^4.2", - "symfony/framework-bundle": "^3.4 || ^4.2", - "symfony/http-foundation": "^3.4 || ^4.2", - "symfony/http-kernel": "^3.4 || ^4.2", - "symfony/options-resolver": "^3.4 || ^4.2", - "symfony/twig-bundle": "^3.4 || ^4.2" + "symfony/config": "^4.2", + "symfony/dependency-injection": "^4.2", + "symfony/expression-language": "^4.2", + "symfony/form": "^4.2", + "symfony/framework-bundle": "^4.2", + "symfony/http-foundation": "^4.2", + "symfony/http-kernel": "^4.2", + "symfony/options-resolver": "^4.2", + "symfony/twig-bundle": "^4.2" }, "require-dev": { "bamarni/composer-bin-plugin": "^1.3", diff --git a/phpstan.neon.dist b/phpstan.neon.dist index d80d631d..00656576 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -21,13 +21,3 @@ parameters: message: "#^Offset 'host' does not exist on array\\(\\)\\|array\\('scheme' \\=\\> string, 'host' \\=\\> string, 'port' \\=\\> int, 'user' \\=\\> string, 'pass' \\=\\> string, 'path' \\=\\> string, 'query' \\=\\> string, 'fragment' \\=\\> string\\)\\.$#" count: 1 path: src/Backend/PsrBackend.php - - - - message: "#^Call to function method_exists\\(\\) with 'Symfony\\\\\\\\Component…' and 'getRootNode' will always evaluate to false\\.$#" - count: 1 - path: src/DependencyInjection/Configuration.php - - - - message: "#^Call to an undefined method Symfony\\\\Component\\\\Config\\\\Definition\\\\Builder\\\\TreeBuilder\\:\\:root\\(\\)\\.$#" - count: 1 - path: src/DependencyInjection/Configuration.php diff --git a/src/DependencyInjection/Configuration.php b/src/DependencyInjection/Configuration.php index b40324e1..a516c3e9 100644 --- a/src/DependencyInjection/Configuration.php +++ b/src/DependencyInjection/Configuration.php @@ -22,12 +22,8 @@ public function getConfigTreeBuilder() { $treeBuilder = new TreeBuilder('core23_shariff'); - // Keep compatibility with symfony/config < 4.2 - if (!method_exists(TreeBuilder::class, 'getRootNode')) { - $rootNode = $treeBuilder->root('core23_shariff'); - } else { - $rootNode = $treeBuilder->getRootNode(); - } + $rootNode = $treeBuilder->getRootNode(); + \assert($rootNode instanceof ArrayNodeDefinition); $this->addAliases($rootNode);