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

Conversation

pamil
Copy link
Contributor

@pamil pamil commented Oct 3, 2018

Q A
Branch? master
Bug fix? no
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets -
License MIT
Doc PR -

@@ -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.

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.

@@ -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.

@@ -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

@@ -35,7 +35,7 @@ public function __construct(MiddlewareInterface $inner, $activated)
}

/**
* @param Envelope $message
* @param Envelope $envelope
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.

@fabpot
Copy link
Member

fabpot commented Oct 6, 2018

Thank you @pamil.

@fabpot fabpot merged commit f06c0c4 into symfony:master Oct 6, 2018
fabpot added a commit that referenced this pull request Oct 6, 2018
This PR was merged into the 4.2-dev branch.

Discussion
----------

[Messenger] Fix middleware docblocks

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

<!--
Write a short README entry for your feature/bugfix here (replace this comment block.)
This will help people understand your PR and can be used as a start of the Doc PR.
Additionally:
 - Bug fixes must be submitted against the lowest branch where they apply
   (lowest branches are regularly merged to upper ones so they get the fixes too).
 - Features and deprecations must be submitted against the master branch.
-->

Commits
-------

f06c0c4 [Messenger] Fix middleware docblocks
@pamil pamil deleted the messenger-fix-typehints branch October 6, 2018 18:17
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.

5 participants