Skip to content

Commit

Permalink
Fixed deprecation with Symfony 4.2 (#164)
Browse files Browse the repository at this point in the history
* Fixed deprecation with Symfony 4.2

* Fixed deprecation with Symfony 4.2 - Try to fix CI (phpstan failing)

* Fixed deprecation with Symfony 4.2 - Try to fix CI by increasing composer's memory limit

* Fixed deprecation with Symfony 4.2 - Drop Distribution bundle dependency

* Fixed deprecation with Symfony 4.2 - Removed composer custom memory limit

* Fixed deprecation with Symfony 4.2 - Upgraded phpunit bridge requirement

* resolve phpunit versions

* fix TreeBuilder not having ctor in < sf 4.1

Co-authored-by: Jo Carter <[email protected]>

* move php stan to allowed failures untill phpstan/phpstan#1482 is fixed
  • Loading branch information
jmsche authored and kunicmarko20 committed Dec 15, 2018
1 parent 78dcab7 commit 6f05079
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 16 deletions.
14 changes: 9 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ matrix:
include:
# Minimum supported dependencies with the oldest supported PHP version
- php: 7.1
env: COMPOSER_FLAGS="--prefer-stable --prefer-lowest" SYMFONY_DEPRECATIONS_HELPER="weak_vendors"
env:
- COMPOSER_FLAGS="--prefer-stable --prefer-lowest"
- SYMFONY_DEPRECATIONS_HELPER="weak_vendors"
- SYMFONY_PHPUNIT_VERSION="5.7.26"

# Coverage
- php: 7.1
Expand All @@ -37,16 +40,17 @@ matrix:
env: TARGET=docs

- php: 7.2
env: STABILITY="dev"

- php: 7.1
env: TARGET=phpstan LEVEL=7
env:
- STABILITY="dev"
- SYMFONY_PHPUNIT_VERSION="6.5"

- php: '7.2'
env: PHPUNIT_FLAGS="--group=proxy"

allow_failures:
- env: PHPUNIT_FLAGS="--group=proxy"
- php: 7.1
env: TARGET=phpstan LEVEL=7

before_install:
- if ! [ -z "$STABILITY" ]; then composer config minimum-stability ${STABILITY}; fi;
Expand Down
3 changes: 1 addition & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,8 @@
"friendsofphp/php-cs-fixer": "^2.0",
"matthiasnoback/symfony-dependency-injection-test": "^1.0 || ^2.0",
"phpunit/phpunit": "^6.0",
"sensio/distribution-bundle": "^3.0.12 || ^4.0 || ^5.0",
"symfony/console": "^3.4 || ^4.0",
"symfony/phpunit-bridge": "^4.0",
"symfony/phpunit-bridge": "^4.1",
"symfony/yaml": "^3.4 || ^4.0"
},
"suggest": {
Expand Down
27 changes: 18 additions & 9 deletions src/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,16 @@ final class Configuration implements ConfigurationInterface
{
public function getConfigTreeBuilder(): TreeBuilder
{
$treeBuilder = $this->createTreeBuilder();
$treeBuilder
->root('fos_ck_editor')
if (\method_exists(TreeBuilder::class, 'getRootNode')) {
$treeBuilder = new TreeBuilder('fos_ck_editor');
$rootNode = $treeBuilder->getRootNode();
} else {
// BC layer for symfony/config 4.1 and older
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('fos_ck_editor');
}

$rootNode
->children()
->booleanNode('enable')->defaultTrue()->end()
->booleanNode('async')->defaultFalse()->end()
Expand Down Expand Up @@ -151,15 +158,17 @@ private function createPrototypeNode(string $name): ArrayNodeDefinition

private function createNode(string $name): ArrayNodeDefinition
{
$node = $this->createTreeBuilder()->root($name);
if (\method_exists(TreeBuilder::class, 'getRootNode')) {
$treeBuilder = new TreeBuilder($name);
$node = $treeBuilder->getRootNode();
} else {
// BC layer for symfony/config 4.1 and older
$treeBuilder = new TreeBuilder();
$node = $treeBuilder->root($name);
}

\assert($node instanceof ArrayNodeDefinition);

return $node;
}

private function createTreeBuilder(): TreeBuilder
{
return new TreeBuilder();
}
}

0 comments on commit 6f05079

Please sign in to comment.