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

Appearance settings

[ObjectMapper] embed collection transformer #60442

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

Open
wants to merge 3 commits into
base: 7.4
Choose a base branch
Loading
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Update src/Symfony/Component/ObjectMapper/Transform/MapCollection.php
Co-authored-by: Oskar Stark <oskarstark@googlemail.com>
  • Loading branch information
soyuka and OskarStark authored May 20, 2025
commit 6420b1b79a96dee19537560b1f4261fca46899ec
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
*/
class MapCollection implements TransformCallableInterface
{
public function __construct(private ?ObjectMapperInterface $objectMapper = new ObjectMapper())
public function __construct(private ObjectMapperInterface $objectMapper = new ObjectMapper())
{
}

Expand All @@ -34,7 +34,7 @@
}

foreach ($value as &$v) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it'd be best to create a new array this is probably why psalm is not happy :P

Copy link
Contributor

Choose a reason for hiding this comment

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

Indeed. Plus, if the iterator is not rewindable, the actual implementation can cause troubles.

$v = $this->objectMapper->map($v);

Check failure on line 37 in src/Symfony/Component/ObjectMapper/Transform/MapCollection.php

View workflow job for this annotation

GitHub Actions / Psalm

NoValue

src/Symfony/Component/ObjectMapper/Transform/MapCollection.php:37:13: NoValue: All possible types for this assignment were invalidated - This may be dead code (see https://psalm.dev/179)

Check failure on line 37 in src/Symfony/Component/ObjectMapper/Transform/MapCollection.php

View workflow job for this annotation

GitHub Actions / Psalm

NoValue

src/Symfony/Component/ObjectMapper/Transform/MapCollection.php:37:13: NoValue: All possible types for this assignment were invalidated - This may be dead code (see https://psalm.dev/179)
}

return $value;
Expand Down
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.