The description given for FactoryInterface::createInstance() and MapperInterface::getInstance() are too similar.
Creates a pre-configured instance of a plugin.
Gets a preconfigured instance of a plugin.
These two sentences are almost identical. They seem to mean the same thing. There are two different methods which surely do different things, so the description should be different.
| Comment | File | Size | Author |
|---|---|---|---|
| #20 | 2960381-20.patch | 1.15 KB | roshni27 |
Comments
Comment #2
msankhala commented@joachim Yes it seems identical, In your opinion what should be the better explanation?
I think createInstance() delegate the creation of plugin instance to the Factory while getInstance() gets the plugin instance by passing configuration to Factory which creates the plugin instance. Correct?
Comment #10
larowlanComment #11
larowlanComment #12
joachim commentedTo summarise:
- createInstance() instantiates a plugin for a specific ID, with optionally, options. I don't think 'preconfigured' applies here.
- getInstance() allows you to pass just some options, and it figured out a suitable plugin ID
getInstance() is *weird*. Its docs and signature make it look like you pass in some plugin options, and you get a plugin that satisfied those which, I dunno, just happened to be lying around already. But in most cases,
Comment #13
avpadernoThe difference between those methods is exactly what the documentation says: A method creates a plugin instance, while the other gets an existing plugin instance (if it exists) or creates it (if it doesn't exist).
The short documentation line is required to be a single line; it's quite hard to make the difference clearer with that restriction. Eventually, it's the longer description that should give more details.
Comment #14
avpadernoThose methods are defined in two different interfaces extended by
PluginManagerInterface, which is interface implemented by classes likeDefaultPluginManager.Comment #15
avpadernoAlso, it's true that both the methods return pre-configured instances of plugins, but those are the only plugin instances. There is no need to say pre-configured.
Comment #16
joachim commentedThe first lines should be changed. We really should be able to come up with something to differentiate them.
How about:
- Creates an instance of a plugin.
- Gets an instance of a plugin which satisfies given options, or creates one.
Comment #20
roshni27 commentedI have made changes according to #15 and #16.
Comment #21
smustgrave commentedSeems suggestion in #15 has been implemented.
@roshni27 thank you for working on it. Looking at your post history believe you can work on non-novice issue now. Novice issues are meant to be reserved for new users. Thanks!
Comment #22
roshni27 commentedThank you for your feedback! I appreciate your guidance on the issue categorization. I'll make sure to focus on non-novice issues going forward.
Comment #26
xjmNice improvement, thanks!
Crediting @joachim and @apaderno for researching and proposing the improvements, @smustgrave for mentoring, and @roshni27 for the patch.
Committed to 11.x, 10.2.x, and 10.1.x as a patch-eligible documentation improvement. Thanks everyone!
Comment #27
xjm