-
Notifications
You must be signed in to change notification settings - Fork 824
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
Make extension hook methods protected #10514
Comments
Generally I'm in favour of this change, I just can see how someone would be calling now-public methods we think should be protected. Even with everything documented in a changelog I just can't foresee how big an issue that might be, but I guess if someone does that and won't know how to move away from that during a CMS5 upgrade then we can possibly say they're doing something wrong anyway — is that enough of an excuse? |
Extension hook methods aren't meant to be called directly - if someone's doing that then yeah I think it's okay to say they're doing something wrong and should call |
If this gets done in time for the beta, it can be in CMS5. Otherwise it will have to wait for CMS6. |
I just moved this in refinement. Are there other aspect we think should be refactored?
|
Fully agree - though we might want to have an early idea of how many of these sorts of changes we're looking to make. This is the sort of change that on its own wouldn't be too painful in an upgrade, but with a few others like it you start to want a tool to assist you in finding and replacing things.
This issue deals with deprecating
Seems like it'd be easy enough, though perhaps low value since |
I don't really agree with changing ->owner - searching for |
I made a rough script for finding implementations of extension hooks, it's not 100% though I bashed it out in less than an hour, easy enough to get it to do everything we need to automate most of it - https://github.com/emteknetnz/extension-protector/blob/main/run.php |
I've put this into peer review to discuss what should be done with the list of Options:
|
It looks like 2 is actually "1, and create cards to consider doing 2 later" which is what I'd opt for. |
Just one PR left with failing CI |
PRs merged. Once that card exists, this issue can be closed. |
Created a new card Created a new PR for changelog |
PR merged |
#10457 made it so that extension hook methods can be
protected
and won't be exposed as callable methods on the object being extended.It should now be considered best practice to make hook methods
protected
- the only methods which should bepublic
are methods that are intended to be called directly on the object being extended.e.g. you wouldn't call
$record->updateCMSFields()
but you might call$record->getCustomField()
. SoupdateCMSFields()
should beprotected
andgetCustomField()
would be public on theExtension
class.Acceptance Criteria
protected
methods for their extension hook methodsprotected
method signaturesFollow up
PRs
DOC PRs
The text was updated successfully, but these errors were encountered: