-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[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
Conversation
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 | |||
*/ |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
Thank you @pamil. |
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