Commit d2b1513
committed
bug symfony#61080 [Console] Fix
This PR was squashed before being merged into the 7.3 branch.
Discussion
----------
[Console] Fix `TreeHelper::addChild` when providing a string
| Q | A
| ------------- | ---
| Branch? | 7.3
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Issues | --
| License | MIT
When using the tree helper, the method addChild allow to pass a string instead of an instance of TreeNode, for example :
```php
$rootNode = new TreeNode('Root');
$rootNode->addChild('Child 1');
$rootNode->addChild('Child 2');
$rootNode->addChild('Child 3');
$tree = TreeHelper::createTree($output, $rootNode);
$tree->render();
```
This method was creating the TreeNode from the string and using the parent as the children iterator, leading to an error like `LogicException: Cycle detected at node: "Child 1"`
This commit remove this second parameter.
Commits
-------
f53504a [Console] Fix `TreeHelper::addChild` when providing a stringTreeHelper::addChild when providing a string (jtattevin)File tree
3 files changed
+39
-1
lines changed- src/Symfony/Component/Console
- Helper
- Tests/Helper
3 files changed
+39
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
61 | | - | |
| 61 | + | |
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
| |||
Lines changed: 20 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
195 | 195 | | |
196 | 196 | | |
197 | 197 | | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
198 | 218 | | |
199 | 219 | | |
200 | 220 | | |
| |||
Lines changed: 18 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
37 | 55 | | |
38 | 56 | | |
39 | 57 | | |
| |||
0 commit comments