Skip to content

Using tagged_iterators for the markup listener #7403

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 5 commits into
base: 2.6
Choose a base branch
from

Conversation

mamazu
Copy link
Contributor

@mamazu mamazu commented May 6, 2024

Q A
Bug fix? no
New feature? no
BC breaks? no
Deprecations? yes
Fixed tickets -
Related issues/PRs #7402
License MIT
Documentation PR -

What's in this PR?

Using the tagged iterator concept to reduce the amount of code that sulu has to create.

Why?

See linked issue.

Example Usage

<argument type="tagged_iterator" tag="testing" />

More info on Symfony Tagged Services

To Do

  • Create a documentation PR
  • Add breaking changes to UPGRADE.md

public const SERVICE_ID = 'sulu_markup.response_listener';

/**
* @deprecated Use the value instead
*/
public const TAG_NAME = 'sulu_markup.parser';
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe we could move this to the ParserInterface as a constant. Could be helpful for people who use PHP to Configure their app?

@mamazu mamazu force-pushed the using_tagged_iterators branch 2 times, most recently from 738dfae to ff726c6 Compare May 6, 2024 12:34
@mamazu mamazu added DX Affecting the end developer Technical Debt Impacts code quality, no or just small impact on end developers and users labels May 6, 2024
@mamazu mamazu force-pushed the using_tagged_iterators branch from 2047f0f to 5786b9b Compare May 7, 2024 21:01
@mamazu
Copy link
Contributor Author

mamazu commented May 7, 2024

@alexander-schranz This should be BC break free now. We can still remove those classes in 3.0 but that's a different MR.

@mamazu mamazu force-pushed the using_tagged_iterators branch 4 times, most recently from 5f13ec7 to 32ee9eb Compare July 12, 2024 08:20
@mamazu mamazu force-pushed the using_tagged_iterators branch from 32ee9eb to 85f1f03 Compare October 23, 2024 13:06
@mamazu mamazu force-pushed the using_tagged_iterators branch from 85f1f03 to b9d17de Compare November 5, 2024 22:53
@mamazu mamazu force-pushed the using_tagged_iterators branch 3 times, most recently from 3dedd16 to f97c26a Compare November 26, 2024 11:41
@mamazu mamazu force-pushed the using_tagged_iterators branch from f97c26a to 29df2d7 Compare December 18, 2024 17:14
@mamazu mamazu force-pushed the using_tagged_iterators branch from 29df2d7 to 923e314 Compare January 8, 2025 13:26
@mamazu
Copy link
Contributor Author

mamazu commented Feb 20, 2025

@mamazu This should be using a tagged_locator instead because we do not need all services here.

@mamazu mamazu force-pushed the using_tagged_iterators branch from 923e314 to d986090 Compare February 25, 2025 17:15
Comment on lines 76 to 101
$container = new class([
'html' => $this->markupParser->reveal(),
]) implements ContainerInterface {
public function __construct(private array $services)
{
}

public function get($id)
{
return $this->services[$id];
}

public function has($id): bool
{
return \array_key_exists($id, this->services);
}
};
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe this should be generalized or we could pull this from the container if it's a KernelTestCase

@mamazu mamazu force-pushed the using_tagged_iterators branch 3 times, most recently from 57a6e85 to 2a9d31e Compare April 21, 2025 13:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DX Affecting the end developer Technical Debt Impacts code quality, no or just small impact on end developers and users
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant