Problem/Motivation
The ContextAwarePluginTrait defines the following (source):
/**
* {@inheritdoc}
*/
abstract protected function getPluginDefinition();
But the PluginInspectionInterface defines this as a public function (source):
/**
* Gets the definition of the plugin implementation.
*
* @return array
* The plugin definition, as returned by the discovery object used by the
* plugin manager.
*/
public function getPluginDefinition();
My IDE highlighted this error when creating a plugin that extends the ConditionPluginBase class (which uses the ContextAwarePluginTrait). Changing the function visibility to be public clears the error, but is there a special reason this function was private? Maybe because it was abstract inside the trait?
I tried to search for an existing issue (with this search) but didn't find anything; it seems like this trait was only added recently via: #2273381: Convert ContextAwarePluginBase to traits
In that issue I didn't see any discussion around the visibility of the getPluginDefinition method - it seems like it was recommended as a abstract protected getPluginDefinition in this comment, and that was it: https://www.drupal.org/project/drupal/issues/2273381#comment-13712658
Steps to reproduce
N/A
Proposed resolution
Change the abstract function visibility from protected to public.
Remaining tasks
N/A - I don't think this would be breaking?
User interface changes
N/A
API changes
N/A
Data model changes
N/A
Release notes snippet
N/A
Issue fork drupal-3229714
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:
Comments
Comment #3
dubs commented+1 to get this added in. The visibility isn't correct and it causes problems further down the chain for some plugins
Comment #4
paul121 commentedComment #5
longwaveMakes sense to me, I don't see an issue with it being public.
Comment #7
alexpottGiven the interface this has to be public in anything that implements the trait so let's do this.
Committed and pushed c636d19ce48 to 10.0.x and b4fc8c9be9c to 9.4.x and ed3c0ea4e32 to 9.3.x. Thanks!