Skip to content

Commit

Permalink
fixed deprecations in Configuration for SF4.4
Browse files Browse the repository at this point in the history
  • Loading branch information
Thorsten Rausch committed Mar 5, 2021
1 parent c3e9e03 commit 0188f0a
Showing 1 changed file with 23 additions and 21 deletions.
44 changes: 23 additions & 21 deletions DependencyInjection/Configuration.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ class Configuration implements ConfigurationInterface
*/
public function getConfigTreeBuilder()
{
$treeBuilder = $this->createTreeBuilder();
$children = $treeBuilder->root('ivory_google_map')
$treeBuilder = $this->createTreeBuilder('ivory_google_map');
$children = $treeBuilder->getRootNode()
->children()
->append($this->createMapNode())
->append($this->createStaticMapNode());
Expand Down Expand Up @@ -59,9 +59,9 @@ private function createMapNode()
return $this->createNode('map')
->addDefaultsIfNotSet()
->children()
->booleanNode('debug')->defaultValue('%kernel.debug%')->end()
->scalarNode('language')->defaultValue('%locale%')->end()
->scalarNode('api_key')->end()
->booleanNode('debug')->defaultValue('%kernel.debug%')->end()
->scalarNode('language')->defaultValue('%locale%')->end()
->scalarNode('api_key')->end()
->end();
}

Expand All @@ -73,8 +73,8 @@ private function createStaticMapNode()
return $this->createNode('static_map')
->addDefaultsIfNotSet()
->children()
->scalarNode('api_key')->end()
->append($this->createBusinessAccountNode(false))
->scalarNode('api_key')->end()
->append($this->createBusinessAccountNode(false))
->end();
}

Expand All @@ -95,21 +95,21 @@ private function createServiceNode($service, $http)
if ($http) {
$children
->scalarNode('client')
->isRequired()
->cannotBeEmpty()
->isRequired()
->cannotBeEmpty()
->end()
->scalarNode('message_factory')
->isRequired()
->cannotBeEmpty()
->isRequired()
->cannotBeEmpty()
->end()
->scalarNode('format')->end();
} else {
$node
->beforeNormalization()
->ifNull()
->then(function () {
return [];
})
->ifNull()
->then(function () {
return [];
})
->end();
}

Expand All @@ -126,8 +126,8 @@ private function createBusinessAccountNode($service)
$node = $this->createNode('business_account');
$clientIdNode = $node->children()
->scalarNode('secret')
->isRequired()
->cannotBeEmpty()
->isRequired()
->cannotBeEmpty()
->end()
->scalarNode('channel')->end()
->scalarNode('client_id');
Expand All @@ -147,16 +147,18 @@ private function createBusinessAccountNode($service)
*
* @return ArrayNodeDefinition|NodeDefinition
*/
private function createNode($name, $type = 'array')
private function createNode(string $name = null, string $type = 'array')
{
return $this->createTreeBuilder()->root($name, $type);
return $this->createTreeBuilder($name, $type)->getRootNode();
}

/**
* @param string $name
* @param string $type
* @return TreeBuilder
*/
private function createTreeBuilder()
private function createTreeBuilder(string $name = null, string $type = 'array')
{
return new TreeBuilder();
return new TreeBuilder($name, $type);
}
}

0 comments on commit 0188f0a

Please sign in to comment.