\Drupal\Core\Plugin\MapperInterface is a general-purpose interface to get plugin 'singletons' based on arbitrary 'options'. It is by no means a proper API, and it's only used by a handful of plugin managers.
$options parameter is so generic, and different plugin managers behave differently based on the array's contents, the interface is useless by definition.
PluginManagerBase::getInstance() uses a mapper object that does not exist, causing a fatal error when called. Only a handful of core's plugin managers actually have a working implementation of this method, and they all override the parent. This means that
PluginManagerBase::getInstance() is not only broken, it is also never used in core.
Remove the interface and transfer the method definition to the interfaces of the plugin managers that actually use it. In doing so, we can provide specific documentation for the
$options parameter in the interface of every plugin manager.
User interface changes
\Drupal\Core\Plugin\MapperInterface optional for plugin managers. In core, only the plugin managers that already override
::getInstance() will continue to implement this interface.
Beta phase evaluation
|Issue category||Task, because nothing is broken, but the impossibility to standardize/document the interface makes it useless and decreases DX|
|Prioritized changes||The main goal of this issue is DX and documentation improvements.|
|Disruption||Possibly disruptive for contributed modules. If any code uses MapperInterface, modules can cope with this change by copying MapperInterface's old method to their own interfaces. This also allows them to improve their own documentation.|