Skip to content

Commit 4c407fe

Browse files
alexander-schranznicolas-grekas
authored andcommitted
[Config] Define TreeBuilder default generic type
1 parent 5ec5bd9 commit 4c407fe

File tree

4 files changed

+8
-3
lines changed

4 files changed

+8
-3
lines changed

Definition/Builder/ArrayNodeDefinition.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
/**
2020
* This class provides a fluent interface for defining an array node.
2121
*
22-
* @template TParent of NodeParentInterface|null
22+
* @template TParent of NodeParentInterface|null = null
2323
*
2424
* @extends NodeDefinition<TParent>
2525
*

Definition/Builder/TreeBuilder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
/**
1717
* This is the entry class for building a config tree.
1818
*
19-
* @template T of 'array'|'variable'|'scalar'|'string'|'boolean'|'integer'|'float'|'enum'
19+
* @template T of 'array'|'variable'|'scalar'|'string'|'boolean'|'integer'|'float'|'enum' = 'array'
2020
*
2121
* @author Johannes M. Schmitt <schmittjoh@gmail.com>
2222
*/

Definition/Configuration.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,12 @@ public function __construct(
3131
) {
3232
}
3333

34+
/**
35+
* @return TreeBuilder<'array'>
36+
*/
3437
public function getConfigTreeBuilder(): TreeBuilder
3538
{
36-
$treeBuilder = new TreeBuilder($this->alias);
39+
$treeBuilder = new TreeBuilder($this->alias, 'array');
3740
$file = (new \ReflectionObject($this->subject))->getFileName();
3841
$loader = new DefinitionFileLoader($treeBuilder, new FileLocator(\dirname($file)), $this->container);
3942
$configurator = new DefinitionConfigurator($treeBuilder, $loader, $file, $file);

Definition/ConfigurationInterface.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ interface ConfigurationInterface
2222
{
2323
/**
2424
* Generates the configuration tree builder.
25+
*
26+
* @return TreeBuilder<'array'>
2527
*/
2628
public function getConfigTreeBuilder(): TreeBuilder;
2729
}

0 commit comments

Comments
 (0)