Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bug #40603 [Config] Fixed support for nodes not extending BaseNode (N…
…yholm) This PR was merged into the 4.4 branch. Discussion ---------- [Config] Fixed support for nodes not extending BaseNode | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | | License | MIT | Doc PR | Too many times we assume that a `NodeInterface` extends `BaseNode`. This PR adds a small test with a new `CustomNodeDefinition` and `CustomNode` that implements `NodeInterface`. Commits ------- 6827656 Fixed support for nodes not extending BaseNode
- Loading branch information
Showing
9 changed files
with
114 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -137,6 +137,7 @@ enum: ~ # One of "this"; "that" | |
# Prototype | ||
name: [] | ||
custom_node: true | ||
EOL; | ||
} | ||
|
49 changes: 49 additions & 0 deletions
49
src/Symfony/Component/Config/Tests/Fixtures/Configuration/CustomNode.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<?php | ||
|
||
|
||
namespace Symfony\Component\Config\Tests\Fixtures\Configuration; | ||
|
||
use Symfony\Component\Config\Definition\NodeInterface; | ||
|
||
class CustomNode implements NodeInterface | ||
{ | ||
public function getName() | ||
{ | ||
return 'custom_node'; | ||
} | ||
|
||
public function getPath() | ||
{ | ||
return 'custom'; | ||
} | ||
|
||
public function isRequired() | ||
{ | ||
return false; | ||
} | ||
|
||
public function hasDefaultValue() | ||
{ | ||
return true; | ||
} | ||
|
||
public function getDefaultValue() | ||
{ | ||
return true; | ||
} | ||
|
||
public function normalize($value) | ||
{ | ||
return $value; | ||
} | ||
|
||
public function merge($leftSide, $rightSide) | ||
{ | ||
return array_merge($leftSide, $rightSide); | ||
} | ||
|
||
public function finalize($value) | ||
{ | ||
return $value; | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
src/Symfony/Component/Config/Tests/Fixtures/Configuration/CustomNodeDefinition.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?php | ||
|
||
|
||
namespace Symfony\Component\Config\Tests\Fixtures\Configuration; | ||
|
||
use Symfony\Component\Config\Definition\Builder\NodeDefinition; | ||
|
||
class CustomNodeDefinition extends NodeDefinition | ||
{ | ||
protected function createNode() | ||
{ | ||
return new CustomNode(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters