Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Console] FixTreeHelper::addChild when providing a string#61080

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
jtattevin wants to merge3 commits intosymfony:7.3
base:7.3
Choose a base branch
Loading
fromjtattevin:ConsoleFixTreeHelper

Conversation

jtattevin
Copy link

@jtattevinjtattevin commentedJul 9, 2025
edited by OskarStark
Loading

QA
Branch?7.3
Bug fix?yes
New feature?no
Deprecations?no
Issues--
LicenseMIT

When using the tree helper, the method addChild allow to pass a string instead of an instance of TreeNode, for example :

$rootNode =newTreeNode('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 likeLogicException: Cycle detected at node: "Child 1"

This commit remove this second parameter.

@chalasr
Copy link
Member

ping@smnandre

smnandre reacted with thumbs up emoji

@smnandre
Copy link
Member

Oops... I missed that, indeed 😶

PR seems very legit 👍

That said, I think it'd be better to add a new test inTreeNodeTest, since this isn’t really the Helper’s responsibility here..

(and I realize there’s currently no test that simply does $node->addChild('string') in TreeNodeTest ... re 😶 )

@jtattevin
Copy link
Author

I've added the test in TreeNodeTest and also checked that the content is used correctly.

I've kept the test in the helper since it's the visible issue, but I can remove it if it's too redundant.

@OskarStarkOskarStark changed the title[Console] Fix TreeHelper::addChild when providing a string[Console] FixTreeHelper::addChild when providing a stringJul 10, 2025
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@chalasrchalasrAwaiting requested review from chalasrchalasr is a code owner

Assignees
No one assigned
Projects
None yet
Milestone
7.3
Development

Successfully merging this pull request may close these issues.

4 participants
@jtattevin@chalasr@smnandre@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp