Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6059bdc

Browse files
feature #26308 [Config] Introduce BuilderAwareInterface (ro0NL)
This PR was squashed before being merged into the 4.1-dev branch (closes #26308). Discussion ---------- [Config] Introduce BuilderAwareInterface | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes | BC breaks? | no <!-- see https://symfony.com/bc --> | Deprecations? | no | Tests pass? | yes <!-- please add some, will be required by reviewers --> | Fixed tickets | #... <!-- #-prefixed issue number(s), if any --> | License | MIT | Doc PR | symfony/symfony-docs#... <!-- required for new features --> Split `ParentNodeDefinitionInterface` into `BuilderAwareInterface`. Use case is custom node definition (extended from VariableNodeDef) with a corresponding prototyped array node. To set the actual prototype i need the builder at definition level, provided by `ParentNodeDefinitionInterface`. However i don't implement `children()` + `append()`, i solely need the builder scope. To go after #26297 Commits ------- 1353694 [Config] Introduce BuilderAwareInterface
2 parents 9446fa0 + 1353694 commit 6059bdc

File tree

3 files changed

+24
-4
lines changed

3 files changed

+24
-4
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Component\Config\Definition\Builder;
13+
14+
/**
15+
* An interface that can be implemented by nodes which build other nodes.
16+
*
17+
* @author Roland Franssen <[email protected]>
18+
*/
19+
interface BuilderAwareInterface
20+
{
21+
public function setBuilder(NodeBuilder $builder);
22+
}

src/Symfony/Component/Config/Definition/Builder/NodeBuilder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ public function node($name, $type)
179179
*/
180180
public function append(NodeDefinition $node)
181181
{
182-
if ($node instanceof ParentNodeDefinitionInterface) {
182+
if ($node instanceof BuilderAwareInterface) {
183183
$builder = clone $this;
184184
$builder->setParent(null);
185185
$node->setBuilder($builder);

src/Symfony/Component/Config/Definition/Builder/ParentNodeDefinitionInterface.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,12 @@
1818
*
1919
* @method NodeDefinition[] getChildNodeDefinitions() should be implemented since 4.1
2020
*/
21-
interface ParentNodeDefinitionInterface
21+
interface ParentNodeDefinitionInterface extends BuilderAwareInterface
2222
{
2323
/**
2424
* @return NodeBuilder
2525
*/
2626
public function children();
2727

2828
public function append(NodeDefinition $node);
29-
30-
public function setBuilder(NodeBuilder $builder);
3129
}

0 commit comments

Comments
 (0)