Problem/Motivation
ImageStyle::getReplacementID is written like its implementing an interface but it doesn't exist on the interface:
/**
* {@inheritdoc}
*/
public function getReplacementID() {
This means the method doesn't actually have any documentation.
Steps to reproduce
Code issue. You'll have to look at ImageStyle.php and ImageStyleInterface.php or see the missing hints in your IDE.
Proposed resolution
Deprecate the method for removal because no usages of it can be found anywhere.
Remaining tasks
User interface changes
Introduced terminology
API changes
Data model changes
Release notes snippet
Issue fork drupal-3498540
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
- 3498540-imagestylegetreplacementid-missing-from
changes, plain diff MR !10902
Comments
Comment #2
neclimdulThis actually shows up in the phpstan report as well.
I think this might actually be a dead method as well so removing it might also be an option. It just proxies through to the storage method of the similar name(different capitalization) and using that might be the correct way of accomplishing this.
Comment #3
quietone commentedComment #6
neclimdulLooks good for the straightforward fix.
Will leave questions of the not strictly camelcacse code and possible code removal to committer review and RTBC this.
Comment #7
quietone commentedIf it really isn't used we should deprecate it now instead of postponing that..
I didn't find usages in core. I didn't find one in contrib either. Did I miss a usage? Can someone check on that?
Comment #8
shalini_jha commented@quietone You are correct. I have also checked the usage of ImageStyle::getReplacementID, and I could not find any.
Comment #9
catchI think @quietone is right and we should deprecate this instead.
Comment #10
shalini_jha commentedI’ve deprecated the getReplacementID() method after confirming it isn’t used in core or contrib, and I followed a similar approach to other deprecated methods. Moving this NR , Could you please review and let me know if anything needs to be updated or improved?
Thank you for the guidance!
Comment #11
smustgrave commentedFeedback appears to be addressed.
Comment #12
shalini_jha commentedThank you for the feedback , yes {@inheritDoc} is there so no need to add the deprecation here , i have checked other deprecated method also for same with {@inheritDoc}. i have updated here also.
Comment #13
catchThe change record is incorrect here - it needs to talk about the method being added to the interface, not the deprecation that was removed from the MR.
Comment #14
neclimdulTalked to catch to clarify and we don't really need to push the method to the interface at all since this is dead code and it just adds complexity.
I shuffled Shalini's code around to accomplish this. Also bumped code and CR to 11.3 as well as point the unlikely user that finds this to the method on the storage class that still has this functionality.
Comment #15
catchLooks good and the CR lines up.
Updated the proposed resolution which was still out of date.
Comment #16
mondrakeShouldn’t this have a deprecation @trigger_error anyway?
Comment #17
catchIt should. Also updating the issue title for what's actually happening.
Comment #18
shalini_jha commentedI’ve addressed the feedback related to @trigger_error. Moving this back to Needs Review. Please review and let me know if any further updates are required.
Comment #19
dcam commentedThis looks great. The issue summary contained all the information I needed to understand the issue. The edited docblock contains correct information now. The change record URLs point to the correct place. I edited the CR a little to fix a typo and add before/after examples.
We often use
@trigger_error(__METHOD__ . "() is deprecated...");when deprecating a class method so its FQCN and name are dynamically included. But I don't consider this to be a reason to set the issue back to Needs Work status. I'm only mentioning it so people can learn. I wouldn't make the change unless someone insists on it.Comment #22
catchI looked for why this was unused, using
git log -S getReplacementId, it was originally deprecated in Drupal 8.0.0, but then didn't get properly removed #2479487: ImageStyles can be deleted while having dependent configuration..Since this is long dead code, I went ahead and cherry-picked to 11.3.x rather than updating the deprecation to 11.4.x.
Committed/pushed to 11.x and cherry-picked to 11.3.x, thanks!