- Issue created by @larowlan
- Status changed to Needs review
11 months ago 4:28am 16 February 2024 - π¦πΊAustralia larowlan π¦πΊπ.au GMT+10
Caught a missing deriver in PluginExample π
- Status changed to Needs work
11 months ago 1:07am 17 February 2024 - π¦πΊAustralia mstrelan
Shall we add a change record and point to it in the assertion?
- π¦πΊAustralia larowlan π¦πΊπ.au GMT+10
Definitely
I did a search for contrib uses of the Plugin attribute but didn't find any - π¦πΊAustralia larowlan π¦πΊπ.au GMT+10
As expected PHPCS doesn't like this.
I think keeping $id and $deriver in the docs is more useful than adding $base
Will see if I can find a way to do both
- π¦πΊAustralia larowlan π¦πΊπ.au GMT+10
If you satisfy PHPCS by adding
$base
, then this breaks auto-complete in IDEs, both `id` and `deriver` aren't suggested. They are type checked if you add@param string ...$base
- π¦πΊAustralia larowlan π¦πΊπ.au GMT+10
Added a draft change record
- Status changed to Needs review
11 months ago 5:32am 18 February 2024 - π¦πΊAustralia larowlan π¦πΊπ.au GMT+10
Crediting @Berdir as this was his idea
- π³πΏNew Zealand quietone
I think this is a good idea. What i notice right now is when I read
$base
I keep asking myself 'base what?' Can$base
be more specific? Maybe$base_definitions
? - Status changed to Needs work
11 months ago 8:20am 19 February 2024 - π¦πΊAustralia dpi Perth, Australia
Concerns about variadics per reviews
- π¬π§United Kingdom longwave UK
In two minds about this. On one hand this future proofs us for adding more base properties. On the other hand the only reason we are doing this is that since the invention of plugins when we had two properties, we are only now looking to add a third, so is this adding DX complexity for something we might never use again?
- π¬π§United Kingdom longwave UK
We could also detect future missing properties at discovery time by reflecting the plugin type class and raising a deprecation if an expected constructor argument (such as $deprecation or whatever else we add) is missing.
- π¬π§United Kingdom longwave UK
Also how will this work with plugin types where we intend to use variadics already to handle any number of additional properties? (such as entity types)
- Status changed to Needs review
11 months ago 8:41am 19 February 2024 - π¬π§United Kingdom alexpott πͺπΊπ
I'm not sure about this. What happens to IDE completion with this? I think IDE completion of plugin attributes is more than just a nice to have.
I think we could detect missing base variables in a different way - like we could change the validator here to ensure that the plugin constructor contains a superset of the arguments of \Drupal\Component\Plugin\Attribute\Plugin::__construct() and preserve the IDE capabilities.
- π¨πSwitzerland berdir Switzerland
#20: Yes, both a dynamic internal and dynamic parent list of properties doesn't work for EntityType. That said, I'm not sure if I even implement that yet, I think it would also be acceptable to require that extra stuff is manually placed inside additional when defined on as an Attribute.
If we want to won't fix this then fair, it just means that we can't introduce generic new features to the plugin system the way π Create a way to declare a plugin as deprecated Needs work currently does, each plugin type that wants it will need to define it. That might be OK, because it will only actually do anything if there is logic for it, for example what we had in the block UI, where it didn't show deprecated plugins unless they were preconfigured.
- π¦πΊAustralia larowlan π¦πΊπ.au GMT+10
Returned to the original intent, which was an assert to catch plugin attribute classes that forget the deriver argument
Back to needs review
- π³πΏNew Zealand quietone
The MR is fine but I am concerned about the implication for deprecating as explained in #22. It seems like we could make our lives easier in the future if we avoided having to create a way to deprecate for according to each plugin type. Could we not add a 'deprecated' and a 'deprecation_message' property now? What are the implications of doing that now? I would like to understand the pros and cons of that.
Thanks - πΊπΈUnited States smustgrave
Following
So would the new properties need to be added to each plugin or be generic?
- π¦πΊAustralia larowlan π¦πΊπ.au GMT+10
With the current state, each plugin
- π«π·France andypost
is there a way to add test (expect assertion)? it maybe tricky after π Remove mentions of assert.active from .htaccess Needs work
- πΊπΈUnited States smustgrave
Would the addition of new properties to each plugins be a big lift?
- Status changed to RTBC
10 months ago 7:56pm 15 March 2024 - πΊπΈUnited States smustgrave
As mentioned in slack this seems like something that probably should go in as probably more then 50% of the attribute tickets have made it in.
Only question I have is should a follow up be opened up to discuss the deprecation question #24 from @quietone?
- Status changed to Needs work
10 months ago 2:36am 16 March 2024 - π¦πΊAustralia mstrelan
A few type hints to fix. Probably worth a rebase to see if the tests still pass.