-
-
Notifications
You must be signed in to change notification settings - Fork 13
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
Add PSR-17 StreamFactoryInterface
Support in ImplicitHeadMiddleware
#48
Conversation
@gsteel |
I'll create the branch if this is approved 👍 |
Can we please go with the logic as in https://github.com/mezzio/mezzio-authorization/pull/11/files? |
I'm not sure I understand the point of preserving support for callables @boesing - As this lib is only useful to a Mezzio app, it's most likely that Stream|Response factories are already wired up in the container via Diactoros, making migration a zero effort chore. The callable response decorator was already deprecated, and I'll have to introduce a callable stream decorator to satisfy I thought that this patch was more about removing support for callables than adding PSR-17 because at least |
It is not supported in this component for quite a while and thus I dont understand why you think it is already supported. So overall, adding support for both makes sense as a first step while dropping support in next major. But maybe I am missing something, can you probably elaborate why you think that there is already PSR-17 support in this component? So all I want to say is, I spent quite a lot of time in providing proper forward compatibility for PSR-17 so that we can switch to full PSR-17 in the next major. All I want is that we provide compatibility layer in |
Replaces all callable parameters and properties with `StreamFactoryInterface` and `ResponseFactoryInterface` where appropriate and removes the callable compatability layer. Closes mezzio#29 Signed-off-by: George Steel <george@net-glue.co.uk>
This reverts commit c127396. Signed-off-by: George Steel <george@net-glue.co.uk>
…ctoryInterface` where appropriate Signed-off-by: George Steel <george@net-glue.co.uk>
@boesing - I reverted the patch and added compatibility for |
Signed-off-by: George Steel <george@net-glue.co.uk>
StreamFactoryInterface
Support in ImplicitHeadMiddleware
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.
Works for me, the only thing which might happen is that there are custom factories provided by upstream factories for the StreamInterface
which could be slightly modified to i.e. decorate the StreamInterface
by default which won't be the case once the StreamFactoryInterface
creates the StreamInterface
.
If you need more input on the problem I try to outline, just let me know.
I guess you can adapt the tests regarding the ResponseFactoryInterface
, that should outline the issue quite good.
That was probably my fault. I did not properly detected the callable in #23 :-/ |
…Middleware The decorator enables a StreamFactoryInterface type internally whilst preserving BC with callable stream factories. Signed-off-by: George Steel <george@net-glue.co.uk>
… the deprecated callable Signed-off-by: George Steel <george@net-glue.co.uk>
review is based on the assumption that this PR will target v4. |
This patch is targeting 3.x - In v4, callable will be dropped along with the decorators @boesing - when you get a chance, can you review again please? |
Can you probably adapt the unit tests from the other PRs we've already created? I havent had a full look on this as I currently dont want to spend time on non-SM or psalm stuff. |
Pretty confident everything is covered - the StreamFactory only has 1 responsibility here and that is to generate an empty stream for implicit HEAD requests. Perhaps @weierophinney or @Ocramius could review to get this one over the line - we'll need it to get v4 out the door right? |
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.
Functionality looks sane, and tests cover the changes. 🚢
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.
🚢 LGTM, thanks @gsteel!
throw new RuntimeException('This method will not be implemented'); | ||
} | ||
|
||
/** @inheritDoc */ |
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.
We should probably document @returns never
?
return ($this->streamFactory)(); | ||
} | ||
|
||
/** @inheritDoc */ |
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.
We should probably document @returns never
?
Description
Replaces all callable parameters and properties with
StreamFactoryInterface
andResponseFactoryInterface
where appropriate and removes the callable compatability layer.Closes #29