Skip to content

Commit

Permalink
Merge pull request #22 from mcg-web/support_symfony_4_2
Browse files Browse the repository at this point in the history
Support symfony 4 2
  • Loading branch information
mcg-web committed Dec 8, 2018
2 parents e3164ef + b5bbf33 commit c3b7846
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 14 deletions.
22 changes: 10 additions & 12 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
language: php

git:
depth: 1
depth: 50

branches:
only:
Expand Down Expand Up @@ -30,35 +30,33 @@ matrix:
env: SYMFONY_VERSION=3.4.*
- php: 7.2
env: SYMFONY_VERSION=4.0.*
- php: 7.2
env: SYMFONY_VERSION=4.1.* DEPENDENCIES=dev
- php: 7.3
env: SYMFONY_VERSION=4.1.*
- php: 7.3
env: SYMFONY_VERSION=4.2.*
- php: nightly
env: COMPOSER_UPDATE_FLAGS=--ignore-platform-reqs
allow_failures:
- php: nightly
env: COMPOSER_UPDATE_FLAGS=--ignore-platform-reqs
- php: 7.2
env: SYMFONY_VERSION=4.1.* DEPENDENCIES=dev

cache:
directories:
- $HOME/.composer/cache
- $HOME/.php_cs.cache
- vendor/

before_install:
- if [ "$DEPENDENCIES" = "dev" ]; then perl -pi -e 's/^}$/,"minimum-stability":"dev"}/' composer.json; fi;
- if [ ${TEST_COVERAGE} != true ]; then phpenv config-rm xdebug.ini || true; fi;
- if [ "${TEST_COVERAGE}" != "true" ]; then phpenv config-rm xdebug.ini || true; fi;
- composer selfupdate
- if [ $SYMFONY_VERSION ]; then composer require "symfony/symfony:${SYMFONY_VERSION}" --dev --no-update; fi;
- if [ $GRAPHQLBUNDLE_VERSION ]; then composer require "overblog/graphql-bundle:${GRAPHQLBUNDLE_VERSION}" --dev --no-update; fi;

install: composer update --prefer-source --no-interaction --optimize-autoloader ${COMPOSER_UPDATE_FLAGS}

script:
- ./bin/phpunit --debug $( if [ $TEST_COVERAGE = true ]; then echo "-d xdebug.max_nesting_level=1000 --coverage-clover=build/logs/clover.xml"; fi; )
- if [ ${TEST_COVERAGE} = true ]; then wget http://cs.sensiolabs.org/download/php-cs-fixer-v2.phar -O php-cs-fixer && php ./php-cs-fixer fix --diff --dry-run -v; fi;
- ./bin/phpunit --debug $( if [ "$TEST_COVERAGE" = "true" ]; then echo "-d xdebug.max_nesting_level=1000 --coverage-clover=build/logs/clover.xml"; fi; )
- if [ "${TEST_COVERAGE}" = "true" ]; then wget http://cs.sensiolabs.org/download/php-cs-fixer-v2.phar -O php-cs-fixer && php ./php-cs-fixer fix --diff --dry-run -v; fi;

after_script:
- if [ ${TEST_COVERAGE} = true ]; then wget https://scrutinizer-ci.com/ocular.phar && travis_retry php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml; fi;
- if [ ${TEST_COVERAGE} = true ]; then composer require "satooshi/php-coveralls:^1.0" && travis_retry php ./vendor/bin/coveralls -v; fi;
- if [ "${TEST_COVERAGE}" = "true" ]; then wget https://scrutinizer-ci.com/ocular.phar && travis_retry php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml; fi;
- if [ "${TEST_COVERAGE}" = "true" ]; then composer require "satooshi/php-coveralls:^1.0" && travis_retry php ./vendor/bin/coveralls -v; fi;
18 changes: 16 additions & 2 deletions DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@
namespace Overblog\GraphiQLBundle\DependencyInjection;

use Overblog\GraphiQLBundle\Config\GraphQLEndpoint\Helpers\OverblogGraphQLBundleEndpointResolver;
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;

final class Configuration implements ConfigurationInterface
{
public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('overblog_graphiql');
$treeBuilder = new TreeBuilder('overblog_graphiql');
$rootNode = self::getRootNodeWithoutDeprecation($treeBuilder, 'overblog_graphiql');

$rootNode
->addDefaultsIfNotSet()
Expand All @@ -36,4 +37,17 @@ public function getConfigTreeBuilder()

return $treeBuilder;
}

/**
* @param TreeBuilder $builder
* @param string|null $name
* @param string $type
*
* @return ArrayNodeDefinition|\Symfony\Component\Config\Definition\Builder\NodeDefinition
*/
private static function getRootNodeWithoutDeprecation(TreeBuilder $builder, $name, $type = 'array')
{
// BC layer for symfony/config 4.1 and older
return \method_exists($builder, 'getRootNode') ? $builder->getRootNode() : $builder->root($name, $type);
}
}

0 comments on commit c3b7846

Please sign in to comment.