-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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 HttpInterface methods and add up-casts for type safety #3746
Add HttpInterface methods and add up-casts for type safety #3746
Conversation
@Vinai - Are we sure we want a backwards incompatible change yet again? Why is this practice encouraged? |
@adragus-inviqa I see your point. I for one still think the platform could use more cleanup. It may be a bit OCB, but every time I see classes depending on an interface, but calling methods on a concrete implementation that are not part of that interface, it just strokes me the wrong way. Question: Have you used custom result types that relied on That said, the changes to the |
I was half-venting, as the amount of BC-breaks in M2 is ridiculous. And BCs are not only about refactoring and clean code - it's about trust (actual, human trust), as I'm sure you know. And, in its current state, it's low. Sea-level-low. Unfortunately, I see no way around some of the issues in here. Maybe things are going to slow down in terms of BC in the future, but until then, I'm mentally working on |
I do hope things will get (a lot) more stable in time. |
BiC = backwards-incompatible change I hate BiCs during one major version, period. But when M2 goes from app/code to Composer packages during a beta, people start thinking it's normal. I do think the codebase needs quite a bit of refactoring, but I don't know how to do that without breaking my own rule (to not create any more BiCs). So I think it boils down to the amount of people impacted. |
Thanks @adragus-inviqa. I also agree that Beta was just like Dev. |
/** | ||
* @var int | ||
*/ | ||
protected $httpResponseCode; |
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.
This is breaking change
Removed the most BC breaking part of the PR, @antonkril |
Internal ticket created: MAGETWO-52571 |
/** | ||
* Set a header | ||
* | ||
* If $replace is true, replaces any headers already defined with that |
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.
- Please add/fix description for all new methods in the interface. E.g. here it does not make sense to split lines 23 and 24
- Please change description of these methods in implementing classes to
{@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.
Done.
Thank you for your review. I've applied the changes you suggested or replied to your comments in 2 cases. |
While Result/Response API still requires bigger rethinking, this PR looks like the best we can do now from prospective of price (breaking changes)/value comparison. |
… and getHttpResponseCode to interface
Rebased onto develop HEAD and resolved merge conflicts. |
…s for type safety #3746 - Merge branch 'httpinterface-methods' of https://github.com/Vinai/magento2 into Vinai-httpinterface-methods
…s for type safety #3746 - Merge commit 'refs/pull/3746/head' of https://github.com/magento/magento2 into develop
…s for type safety #3746 - suppress coupling warning until refactoring can be performed
…s for type safety #3746 - Merge branch 'develop' into okapis-pr-branch
[pangolin]Limit allowed bin/magento commands to specific list (MTF)
This PR does not add any functionality. Its only purpose is to make the usage of the
HttpInterface
response more type safe.As far as I can tell there should be no backward incompatible changes, except for the HTTP related methods from
\Magento\Framework\Controller\AbstractResult
being moved into a new\Magento\Framework\Controller\AbstractHttpResult
child class.All core classes extending
AbstractResult
but referencing HTTP methods now extend the newAbstractHttpResult
. Any non-web result type can still extendAbstractResult
without havingapplyHttpHeaders()
caled during rendering.Please reference issue #3737 for further information.