8000 Make it more obvious what the $handler is on Messenger docs by jpjoao · Pull Request #13349 · symfony/symfony-docs · GitHub
[go: up one dir, main page]

Skip to content

Make it more obvious what the $handler is on Messenger docs #13349

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
merged 1 commit into from
Mar 17, 2020

Conversation

jpjoao
Copy link
Contributor
@jpjoao jpjoao commented Mar 15, 2020

fixes #13148

As mentioned in the issue $handler was not obvious. I referenced the next item in the docs in the hope that this makes things more clear.

This issue is present on other versions of the documentation but the behaviour of the function also changed (parameter now can be an array). I am unsure of how to proceed in such a case.

@javiereguiluz
Copy link
Member

@Nyholm does this proposed change look good to you? Thanks!

Copy link
Member
@Nyholm Nyholm left a comment

Choose a reason for hiding this comment

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

I like this change because we don't use an undefined variable $handler anymore.

The MyMessageHandler is explained in the very next sentence after the code block, so I think it is fine.

This issue is present on other versions of the documentation but the behaviour of the function also changed (parameter now can be an array)

I believe we should only document the normal and simple case where we have a callable class.

This code block you changed is the first one. We can assume the reader does not know anything about the Messenger component. Where are the other places you refer to? Can one assume that the reader knows what $handler is without us telling them?

@jpjoao
Copy link
Contributor Author
jpjoao commented Mar 16, 2020

Hi @Nyholm

I refer to the available documentation for the component since it's release. It changed 3 times until getting into the current state:
4.1: The parameter is just $handler
https://symfony.com/doc/4.1/components/messenger.html#bus
4.2: The parameter is an array with named keys: ['dummy' => $handler]
https://symfony.com/doc/4.2/components/messenger.html#bus
4.3 onwards: The parameter is an array without keys: [$handler]
https://symfony.com/doc/4.3/components/messenger.html#bus

I don know what we want to do to document this. If needed I can go and make PRs aiming each of the versions and document $handler on each of them.

Answering your question about $handler: I considered adding a comment "see next item" or something similar when declaring the $handler and this is also why I choose not to do it inline inside the MessageBus creation.

Let me know how you want me to proceed with this PR, I am happy with any decision made about the comments and the number of PRs needed to close the issue.

@Nyholm
Copy link
Member
Nyholm commented Mar 16, 2020

Excellent question.

The docs team is super of moving changes to different branches. I know that this will be merged in master and "copied" down to 5.0 and 4.4.

We dont bother about 4.1, 4.2 and 4.3 since those versions are not maintained anymore.

considered adding a comment "see next item

I think the current solution is fine for now.


I think this PR is ready for merge. @jpjoao thank you for this. No more changes is needed at the moment.

👍

@javiereguiluz javiereguiluz changed the base branch from master to 4.4 March 17, 2020 14:03
@javiereguiluz javiereguiluz force-pushed the component-messenger-handler branch from a89e32e to 41d017a Compare March 17, 2020 14:03
@javiereguiluz
Copy link
Member

@jpjoao merged! Thanks ... and congrats on your first Symfony Docs contribution!

@javiereguiluz javiereguiluz merged commit 2309998 into symfony:4.4 Mar 17, 2020
@jpjoao jpjoao deleted the component-messenger-handler branch March 21, 2020 16:45
@xabbuh xabbuh added this to the 4.4 milestone Apr 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Messenger] Confusing variable in a code example
5 participants
0