Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Messenger] Fix middleware docblocks #28717

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
Oct 6, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function __construct(MiddlewareInterface $inner, $activated)
}

/**
* @param Envelope $message
* @param Envelope $envelope
Copy link
Member

Choose a reason for hiding this comment

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

What about type-hinting the parameter instead and remove the docbloc instead?

Copy link
Member

@chalasr chalasr Oct 5, 2018

Choose a reason for hiding this comment

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

IIRC it cannot have a type hint because messages can be any object (as per MiddlewareInterface), middlewares that expect the envelope to be passed need to implement the EnvelopeAwareInterface marker

Copy link
Contributor

Choose a reason for hiding this comment

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

Yep, exactly, we can't typehint (as the interface does not have any). That's the subtlety of the EnvelopeAwareInterface. Having the PhpDoc "forces" your IDE to know about the right object it gets.

*/
public function handle($envelope, callable $next)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

namespace Symfony\Component\Messenger\Middleware;

use Symfony\Component\Messenger\Envelope;
use Symfony\Component\Messenger\EnvelopeAwareInterface;
use Symfony\Component\Messenger\Exception\ValidationFailedException;
use Symfony\Component\Messenger\Middleware\Configuration\ValidationConfiguration;
Expand All @@ -28,6 +29,9 @@ public function __construct(ValidatorInterface $validator)
$this->validator = $validator;
}

/**
* @param Envelope $envelope
Copy link
Member

Choose a reason for hiding this comment

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

Same here

*/
Copy link
Member

Choose a reason for hiding this comment

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

should be backported to 4.1

Copy link
Member

Choose a reason for hiding this comment

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

I don't think we need to backport this, not worth it.

public function handle($envelope, callable $next)
{
$message = $envelope->getMessage();
Expand Down