You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
bug #61080 [Console] Fix TreeHelper::addChild when providing a string (jtattevin)
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
-------
f53504aabb8 [Console] Fix `TreeHelper::addChild` when providing a string
0 commit comments