Skip to content

Commit

Permalink
fix(tree builder): remove deprecation about configuration tree builde…
Browse files Browse the repository at this point in the history
…r without a root node
  • Loading branch information
mazsudo committed Aug 26, 2019
1 parent 0665c77 commit a96e760
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG-0.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ after the #.
* Added (optional) replacement for "Add block" button, showing blocks in a categorized popup
* Fixed PHP-CS-Fixer config
* Added integration of a liipMonitor dashboard
* Remove deprecation about configuration tree builder without a root node
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ master
* Enable strict typing
* Add Coveralls Tool for TravisCI
* Add badges in the README
* Remove deprecation about configuration tree builder without a root node
10 changes: 8 additions & 2 deletions src/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,14 @@ class Configuration implements ConfigurationInterface
*/
public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('sonata_helpers');
// Keep compatibility with symfony/config < 4.2
if (!method_exists(TreeBuilder::class, 'getRootNode')) {
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('sonata_helpers');
} else {
$treeBuilder = new TreeBuilder('sonata_helpers');
$rootNode = $treeBuilder->getRootNode();
}

$rootNode
->children()
Expand Down
3 changes: 2 additions & 1 deletion tests/MockBuilderTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

namespace Sonata\HelpersBundle\Tests;

use PHPUnit\Framework\MockObject\MockObject;
use Sonata\HelpersBundle\Tests\Common\TranslationTestHelper;
use Symfony\Component\Translation\TranslatorInterface;

Expand All @@ -26,7 +27,7 @@ trait MockBuilderTrait
/**
* Create TranslatorInterfaceMock and add a callback method to it.
*
* @return TranslatorInterface|\PHPUnit_Framework_MockObject_MockObject
* @return TranslatorInterface|MockObject
*/
protected function mockTranslator()
{
Expand Down

0 comments on commit a96e760

Please sign in to comment.