Problem/Motivation

I'm trying to update the JSON-RPC module to support attributes in addition to annotations.

JSON-RPC annotations extend a custom MethodInterface, which extends core's PluginDefinitionInterface.

This doesn't work with attributes because core's AttributeBase setClass returns void, while PluginDefinitionInterface setClass does not have an explicit return type.

Attempting to use a JsonRpcMethod Attribute that extends MethodInterface results in this fatal error:

Fatal error: Declaration of Drupal\Component\Plugin\Attribute\AttributeBase::setClass(string $class): void must be compatible with Drupal\Component\Plugin\Definition\PluginDefinitionInterface::setClass($class) in

Proposed resolution

I humbly request that core provide a way to have Attributes implement an interface that extends PluginDefinitionInterface.

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

Comments

ptmkenny created an issue. See original summary.

ptmkenny’s picture

Status: Active » Closed (outdated)

Found a way to work around this; see the referenced issue.