Skip to content

[MCP SDK] Use foreach instead of array_map because array_map does not accept generators #143

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

dorrogeray
Copy link
Contributor

Q A
Bug fix? yes
New feature? no
Docs? no
Issues N/A
License MIT

Use foreach instead of array_map because array_map does not accept generators and add test coverage.

@dorrogeray dorrogeray force-pushed the fix-array-map-consuming-generators branch from 44750cc to 35c6c5b Compare July 17, 2025 07:12
@welcoMattic welcoMattic changed the title [mcp-sdk] Use foreach instead of array_map because array_map does not accept generators [McpSdk] Use foreach instead of array_map because array_map does not accept generators Jul 17, 2025
@OskarStark OskarStark added the MCP SDK Issues & PRs about the MCP SDK label Jul 17, 2025
@OskarStark OskarStark changed the title [McpSdk] Use foreach instead of array_map because array_map does not accept generators [MCP SDK] Use foreach instead of array_map because array_map does not accept generators Jul 17, 2025
Copy link
Contributor

@chr-hertel chr-hertel left a comment

Choose a reason for hiding this comment

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

Looks quite good to me and fixes #123, right?

Thanks for providing the tests as well - I'm more in the corner of avoiding mocks for simple cases, that's why I left some comments there.

@Nyholm looks good?

@chr-hertel chr-hertel force-pushed the fix-array-map-consuming-generators branch from 35c6c5b to 61b0f0d Compare July 20, 2025 21:57
Copy link
Contributor

@chr-hertel chr-hertel left a comment

Choose a reason for hiding this comment

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

Thanks @dorrogeray for providing that patch! 👍

I quickly changed tests and removed one that actually didn't work with the original code instead the mock. That's always the tricky part with mocks.

It was just so annoying to have that bug - so I took over your PR here -sorry for that!

@chr-hertel
Copy link
Contributor

Thank you @dorrogeray.

@chr-hertel chr-hertel merged commit fd07ce1 into symfony:main Jul 20, 2025
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
MCP SDK Issues & PRs about the MCP SDK
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants