Skip to content

Commit

Permalink
Merge pull request #8 from simPod/symfony5
Browse files Browse the repository at this point in the history
Use new API for rootnode
  • Loading branch information
enumag authored Aug 22, 2019
2 parents 7ee3b87 + ca1362a commit 081b549
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ cache:
php:
- 7.1
- 7.2
- 7.3
- 7.4snapshot
- nightly

before_install:
Expand All @@ -27,6 +29,9 @@ stages:
- Code Quality

jobs:
allow_failures:
- php: nightly

include:
- stage: Test
env: DEV_DEPENDENCIES
Expand Down
10 changes: 8 additions & 2 deletions src/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use Kdyby\StrictObjects\Scream;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;
use function method_exists;

class Configuration implements ConfigurationInterface
{
Expand All @@ -27,8 +28,13 @@ class Configuration implements ConfigurationInterface

public function getConfigTreeBuilder() : TreeBuilder
{
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('kdyby_datetime_provider');
$treeBuilder = new TreeBuilder('kdyby_datetime_provider');
if (method_exists($treeBuilder, 'getRootNode')) {
$rootNode = $treeBuilder->getRootNode();
} else {
// BC layer for symfony/config 4.1 and older
$rootNode = $treeBuilder->root('kdyby_datetime_provider');
}

// @codingStandardsIgnoreStart
$rootNode
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,6 @@ public function getRequestTime() : DateTimeImmutable
{
return $this->dateTime;
}

};
}

Expand Down

0 comments on commit 081b549

Please sign in to comment.