-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Use class name as type hint instead of self. #23300
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
Use class name as type hint instead of self. #23300
Conversation
…or when a preference is defined. Fixes magento#22769
Hi @dcabrejas. Thank you for your contribution
For more details, please, review the Magento Contributor Assistant documentation |
Hi @aleron75, thank you for the review.
|
@dcabrejas thank you for contributing. Please accept Community Contributors team invitation here to gain extended permissions for this repository. |
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 class is perfectly valid, interception mechanism must be fixed instead.
Hi @orlangur Please see my comment on the PR description about this being just a fix to the issue users have reported. While I agree more thought is required to provide a generic fix that allows code to typehint self as a return parameter. I believe that can be done as a separate PR. |
@dcabrejas sure.
Please work on such PR and this change is not needed actually. |
Hi @dcabrejas, thank you for your contribution! |
Hi @sivaschenko What is your opinion about this? We discussed this at meet Magento and it was decided this should be fixed in this way. |
Similar poor attempt of "fix" was performed in #21775 (comment). Again: indexer code MUST NOT be changed, interception mechanism is what actually needs to be fixed. |
Technical disagreements are fine, but suggesting that another contributor's work is a waste of time is completely out of line. |
@DrewML, sorry, I wasn't specific enough and my English may sound not how it was intended to sound to native speaker. I just tried to guide contributor in a right direction to avoid waste of efforts by doing a temporary fix, then a proper one, then reverting initial unneeded change. This can be even a bigger trouble if release occur between such connected pull requests. #23300 (comment) is a good example where we faced with similar changes and elaborated a more universal fix. I do appreciate every contributor work and trying to help to not waste contributor efforts on changes which could be avoided, this is what I meant by "our wasted time" - we are all on the same boat, there is no distinction between contributors, maintainers or even EngCom team members on this aspect. Thanks for pointing out, I'll take an additional look into Code of Conduct and do my best to avoid such situations in the future. @dcabrejas sorry that I didn't pick the right words to convey my point and could decrease your enjoyment of contributing to Magento Open Source. I'm taking part in the Magento Contribution Day today and will reach out to @sivaschenko directly. |
@orlangur we have discussed this issue with @dcabrejas at the Meet Magento UK contribution day. As there is no proved solution for generator fix, and such fix may require a substantial amount of time to implement and tests, we decided to apply a local fix to this file and postpone the generator fix. In case a pull request will be created, tested and delivered within the current release with the fix described in #23300 (comment) - that solution looks more preferable for me. |
@sivaschenko thanks, seems we are on the same page taking into consideration there is a bunch of time till |
Hi @sidolov, thank you for the review.
|
As @orlangur mentioned, the fix should be on the code generation level (internal ticket MC-17251) but should not change Another note, preferences should not be used for classes, only for interfaces. |
Hi @dcabrejas, thank you for your contribution! |
Description (*)
Use class name as type hint instead of
self
.self
breaks code generator when a preference is defined.Fixed Issues (if relevant)
Manual testing scenarios (*)
Questions or comments
I am going to try and work out a solution to the real problem here which should allow us to still use the
self
keyword and use preferences/code generation at the same time. That would be in a different PR though.Contribution checklist (*)