Skip to content

Fix the toArray function to start the array at the root node xml#8

Merged
byjg merged 3 commits intobyjg:masterfrom
leonardomunsa:fix/xml-to-array
Jul 2, 2025
Merged

Fix the toArray function to start the array at the root node xml#8
byjg merged 3 commits intobyjg:masterfrom
leonardomunsa:fix/xml-to-array

Conversation

@leonardomunsa
Copy link
Copy Markdown
Contributor

@leonardomunsa leonardomunsa commented Jul 1, 2025

Description by Korbit AI

What change is being made?

Fix the toArray function in the XmlNode class to ensure the generated array starts at the root node of the XML structure and update the corresponding test cases.

Why are these changes being made?

Previously, the toArray method did not correctly represent the hierarchy starting with the root node, which could lead to a misrepresentation of the XML data structure. This change ensures that the hierarchical context is preserved, resulting in more accurate and intuitive array transformations. Additional test cases have been added to verify the correct conversion of XML attributes and mixed content to an array format, reflecting real-world XML complexity more accurately.

Is this description stale? Ask me to generate a new description by commenting /korbit-generate-pr-description

Copy link
Copy Markdown

@korbit-ai korbit-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review by Korbit AI

Korbit automatically attempts to detect when you fix issues in new commits.
Category Issue Status
Performance Inefficient DOM to SimpleXML Conversion ▹ view ✅ Fix detected
Error Handling Missing XML import validation ▹ view
Functionality Missing callable validation in array transformation ▹ view ✅ Fix detected
Files scanned
File Path Reviewed
src/XmlNode.php

Explore our documentation to understand the languages and file types we support and the files we ignore.

Check out our docs on how you can make Korbit work best for you and your team.

Loving Korbit!? Share us on LinkedIn Reddit and X

Comment thread src/XmlNode.php
Comment thread src/XmlNode.php Outdated
Comment thread src/XmlNode.php Outdated
Comment thread tests/XmlUtilTest.php
@byjg byjg merged commit 02a39db into byjg:master Jul 2, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants