diff --git a/phpcs.xml.dist b/phpcs.xml.dist index 22ac87315ba442e835ce207c5a5a12287787ace1..8e32af497b2b8bc0dcabe032da9cc36aa7cce98d 100644 --- a/phpcs.xml.dist +++ b/phpcs.xml.dist @@ -35,146 +35,37 @@ <exclude-pattern>src/GraphQL/Execution/FieldContext.php</exclude-pattern> <exclude-pattern>src/GraphQL/Execution/ResolveContext.php</exclude-pattern> <exclude-pattern>src/GraphQL/Utility/FileUpload.php</exclude-pattern> + <exclude-pattern>src/Plugin/GraphQL/DataProducer/DataProducerProxy.php</exclude-pattern> <exclude-pattern>src/Plugin/GraphQL/DataProducer/Utility/Seek.php</exclude-pattern> <exclude-pattern>src/SubRequestResponse.php</exclude-pattern> <exclude-pattern>tests/src/Traits/QueryResultAssertionTrait.php</exclude-pattern> <exclude-pattern>tests/src/Traits/MockingTrait.php</exclude-pattern> - </rule> - - <rule ref="Drupal.Commenting.FunctionComment.MissingParamComment"> - <exclude-pattern>src/PermissionProvider.php</exclude-pattern> - <exclude-pattern>src/Config/LanguageConfigOverride.php</exclude-pattern> - <exclude-pattern>src/GraphQL/Resolver/Path.php</exclude-pattern> - <exclude-pattern>src/GraphQL/Resolver/ResolverInterface.php</exclude-pattern> - <exclude-pattern>src/GraphQL/Resolver/SourceContext.php</exclude-pattern> - <exclude-pattern>src/GraphQL/Resolver/Condition.php</exclude-pattern> - <exclude-pattern>src/GraphQL/Resolver/Callback.php</exclude-pattern> - <exclude-pattern>src/GraphQL/Resolver/Composite.php</exclude-pattern> - <exclude-pattern>src/GraphQL/Resolver/Argument.php</exclude-pattern> - <exclude-pattern>src/GraphQL/Resolver/Value.php</exclude-pattern> - <exclude-pattern>src/GraphQL/Resolver/Context.php</exclude-pattern> - <exclude-pattern>src/GraphQL/Resolver/Map.php</exclude-pattern> - <exclude-pattern>src/GraphQL/Resolver/Tap.php</exclude-pattern> - <exclude-pattern>src/GraphQL/ResolverRegistryInterface.php</exclude-pattern> - <exclude-pattern>src/GraphQL/Execution/Executor.php</exclude-pattern> - <exclude-pattern>src/GraphQL/Execution/FieldContext.php</exclude-pattern> - <exclude-pattern>src/GraphQL/Execution/ExecutorFactory.php</exclude-pattern> - <exclude-pattern>src/GraphQL/Execution/ResolveContext.php</exclude-pattern> - <exclude-pattern>src/GraphQL/ResolverBuilder.php</exclude-pattern> - <exclude-pattern>src/GraphQL/Utility/DocumentSerializer.php</exclude-pattern> - <exclude-pattern>src/GraphQL/Utility/DeferredUtility.php</exclude-pattern> - <exclude-pattern>src/GraphQL/ResolverRegistry.php</exclude-pattern> - <exclude-pattern>src/Event/OperationEvent.php</exclude-pattern> - <exclude-pattern>src/Form/PersistedQueriesForm.php</exclude-pattern> - <exclude-pattern>src/EventSubscriber/OperationSubscriber.php</exclude-pattern> - <exclude-pattern>src/EventSubscriber/SubrequestSubscriber.php</exclude-pattern> - <exclude-pattern>src/Entity/ServerInterface.php</exclude-pattern> - <exclude-pattern>src/Entity/Server.php</exclude-pattern> - <exclude-pattern>src/Plugin/LanguageNegotiation/OperationLanguageNegotiation.php</exclude-pattern> - <exclude-pattern>src/Plugin/PersistedQueryPluginManager.php</exclude-pattern> - <exclude-pattern>src/Plugin/DataProducerPluginInterface.php</exclude-pattern> - <exclude-pattern>src/Plugin/GraphQL/DataProducer/String/Uppercase.php</exclude-pattern> <exclude-pattern>src/Plugin/GraphQL/DataProducer/TypedData/PropertyPath.php</exclude-pattern> - <exclude-pattern>src/Plugin/GraphQL/DataProducer/DataProducerProxy.php</exclude-pattern> - <exclude-pattern>src/Plugin/GraphQL/DataProducer/Images/ImageResourceUrl.php</exclude-pattern> - <exclude-pattern>src/Plugin/GraphQL/DataProducer/Field/EntityReference.php</exclude-pattern> - <exclude-pattern>src/Plugin/GraphQL/DataProducer/Menu/MenuLinks.php</exclude-pattern> - <exclude-pattern>src/Plugin/GraphQL/DataProducer/Menu/MenuTree/MenuTreeLink.php</exclude-pattern> - <exclude-pattern>src/Plugin/GraphQL/DataProducer/Menu/MenuTree/MenuTreeSubtree.php</exclude-pattern> - <exclude-pattern>src/Plugin/GraphQL/DataProducer/Menu/MenuLink/MenuLinkAttribute.php</exclude-pattern> - <exclude-pattern>src/Plugin/GraphQL/DataProducer/Menu/MenuLink/MenuLinkUrl.php</exclude-pattern> - <exclude-pattern>src/Plugin/GraphQL/DataProducer/Menu/MenuLink/MenuLinkExpanded.php</exclude-pattern> - <exclude-pattern>src/Plugin/GraphQL/DataProducer/Menu/MenuLink/MenuLinkLabel.php</exclude-pattern> - <exclude-pattern>src/Plugin/GraphQL/DataProducer/Menu/MenuLink/MenuLinkDescription.php</exclude-pattern> - <exclude-pattern>src/Plugin/GraphQL/DataProducer/Routing/Url/UrlPath.php</exclude-pattern> - <exclude-pattern>src/Plugin/GraphQL/DataProducer/Routing/RouteLoad.php</exclude-pattern> - <exclude-pattern>src/Plugin/GraphQL/DataProducer/Entity/EntityPublished.php</exclude-pattern> - <exclude-pattern>src/Plugin/GraphQL/DataProducer/Entity/EntityLabel.php</exclude-pattern> - <exclude-pattern>src/Plugin/GraphQL/DataProducer/Entity/EntityRendered.php</exclude-pattern> - <exclude-pattern>src/Plugin/GraphQL/DataProducer/Entity/EntityType.php</exclude-pattern> - <exclude-pattern>src/Plugin/GraphQL/DataProducer/Entity/EntityLanguage.php</exclude-pattern> - <exclude-pattern>src/Plugin/GraphQL/DataProducer/Entity/EntityUrl.php</exclude-pattern> - <exclude-pattern>src/Plugin/GraphQL/DataProducer/Entity/EntityLoadMultiple.php</exclude-pattern> - <exclude-pattern>src/Plugin/GraphQL/DataProducer/Entity/EntityOwner.php</exclude-pattern> - <exclude-pattern>src/Plugin/GraphQL/DataProducer/Entity/EntityCreated.php</exclude-pattern> - <exclude-pattern>src/Plugin/GraphQL/DataProducer/Entity/EntityDescription.php</exclude-pattern> - <exclude-pattern>src/Plugin/GraphQL/DataProducer/Entity/EntityTranslation.php</exclude-pattern> - <exclude-pattern>src/Plugin/GraphQL/DataProducer/Entity/EntityLoad.php</exclude-pattern> - <exclude-pattern>src/Plugin/GraphQL/DataProducer/Entity/EntityTranslations.php</exclude-pattern> - <exclude-pattern>src/Plugin/GraphQL/DataProducer/Entity/Fields/Image/ImageDerivative.php</exclude-pattern> - <exclude-pattern>src/Plugin/GraphQL/DataProducer/Entity/Fields/Image/ImageUrl.php</exclude-pattern> - <exclude-pattern>src/Plugin/GraphQL/DataProducer/Entity/EntityChanged.php</exclude-pattern> - <exclude-pattern>src/Plugin/GraphQL/DataProducer/Entity/EntityId.php</exclude-pattern> - <exclude-pattern>src/Plugin/GraphQL/DataProducer/Entity/EntityUuid.php</exclude-pattern> - <exclude-pattern>src/Plugin/GraphQL/DataProducer/Entity/EntityAccess.php</exclude-pattern> - <exclude-pattern>src/Plugin/GraphQL/DataProducer/Entity/EntityLoadByUuid.php</exclude-pattern> - <exclude-pattern>src/Plugin/GraphQL/DataProducer/Entity/EntityBundle.php</exclude-pattern> - <exclude-pattern>src/Plugin/GraphQL/Schema/SdlSchemaPluginBase.php</exclude-pattern> - <exclude-pattern>src/Plugin/DataProducerPluginManager.php</exclude-pattern> - <exclude-pattern>src/Controller/RequestController.php</exclude-pattern> - <exclude-pattern>examples/graphql_example/src/Wrappers/QueryConnection.php</exclude-pattern> - <exclude-pattern>examples/graphql_example/src/Plugin/GraphQL/DataProducer/QueryArticles.php</exclude-pattern> - <exclude-pattern>examples/graphql_example/src/Plugin/GraphQL/Schema/ExampleSchema.php</exclude-pattern> - <exclude-pattern>examples/graphql_example/src/Plugin/GraphQL/SchemaExtension/ExampleSchemaExtension.php</exclude-pattern> - <exclude-pattern>tests/src/Traits/MockingTrait.php</exclude-pattern> - <exclude-pattern>tests/src/Traits/DataProducerExecutionTrait.php</exclude-pattern> - <exclude-pattern>tests/src/Kernel/ResolverBuilderTest.php</exclude-pattern> + <exclude-pattern>src/Plugin/DataProducerPluginInterface.php</exclude-pattern> </rule> <rule ref="Drupal.Commenting.FunctionComment.MissingReturnComment"> - <exclude-pattern>src/GraphQL/Resolver/ResolverInterface.php</exclude-pattern> - <exclude-pattern>src/GraphQL/ResolverRegistryInterface.php</exclude-pattern> - <exclude-pattern>src/GraphQL/Execution/Executor.php</exclude-pattern> - <exclude-pattern>src/GraphQL/Execution/FieldContext.php</exclude-pattern> - <exclude-pattern>src/GraphQL/Execution/ExecutorFactory.php</exclude-pattern> - <exclude-pattern>src/GraphQL/Execution/ResolveContext.php</exclude-pattern> - <exclude-pattern>src/GraphQL/ResolverBuilder.php</exclude-pattern> - <exclude-pattern>src/GraphQL/Utility/DocumentSerializer.php</exclude-pattern> - <exclude-pattern>src/GraphQL/Utility/DeferredUtility.php</exclude-pattern> - <exclude-pattern>src/GraphQL/ResolverRegistry.php</exclude-pattern> - <exclude-pattern>src/Event/OperationEvent.php</exclude-pattern> - <exclude-pattern>src/Form/PersistedQueriesForm.php</exclude-pattern> - <exclude-pattern>src/Routing/QueryRouteEnhancer.php</exclude-pattern> - <exclude-pattern>src/Entity/ServerInterface.php</exclude-pattern> - <exclude-pattern>src/Plugin/SchemaExtensionPluginManager.php</exclude-pattern> - <exclude-pattern>src/Plugin/DataProducerPluginInterface.php</exclude-pattern> - <exclude-pattern>src/Plugin/GraphQL/DataProducer/String/Uppercase.php</exclude-pattern> - <exclude-pattern>src/Plugin/GraphQL/DataProducer/XML/XMLParse.php</exclude-pattern> - <exclude-pattern>src/Plugin/GraphQL/DataProducer/XML/XMLContent.php</exclude-pattern> - <exclude-pattern>src/Plugin/GraphQL/DataProducer/XML/XMLAttribute.php</exclude-pattern> - <exclude-pattern>src/Plugin/GraphQL/DataProducer/XML/XMLXpath.php</exclude-pattern> - <exclude-pattern>src/Plugin/GraphQL/DataProducer/TypedData/PropertyPath.php</exclude-pattern> - <exclude-pattern>src/Plugin/GraphQL/DataProducer/DataProducerProxy.php</exclude-pattern> <exclude-pattern>src/Plugin/GraphQL/DataProducer/Images/ImageResourceUrl.php</exclude-pattern> <exclude-pattern>src/Plugin/GraphQL/DataProducer/Field/EntityReference.php</exclude-pattern> - <exclude-pattern>src/Plugin/GraphQL/DataProducer/Menu/MenuLinks.php</exclude-pattern> <exclude-pattern>src/Plugin/GraphQL/DataProducer/Menu/MenuTree/MenuTreeLink.php</exclude-pattern> - <exclude-pattern>src/Plugin/GraphQL/DataProducer/Menu/MenuTree/MenuTreeSubtree.php</exclude-pattern> <exclude-pattern>src/Plugin/GraphQL/DataProducer/Menu/MenuLink/MenuLinkAttribute.php</exclude-pattern> <exclude-pattern>src/Plugin/GraphQL/DataProducer/Menu/MenuLink/MenuLinkUrl.php</exclude-pattern> <exclude-pattern>src/Plugin/GraphQL/DataProducer/Menu/MenuLink/MenuLinkExpanded.php</exclude-pattern> - <exclude-pattern>src/Plugin/GraphQL/DataProducer/Menu/MenuLink/MenuLinkLabel.php</exclude-pattern> <exclude-pattern>src/Plugin/GraphQL/DataProducer/Menu/MenuLink/MenuLinkDescription.php</exclude-pattern> <exclude-pattern>src/Plugin/GraphQL/DataProducer/Routing/Url/UrlPath.php</exclude-pattern> <exclude-pattern>src/Plugin/GraphQL/DataProducer/Routing/RouteLoad.php</exclude-pattern> <exclude-pattern>src/Plugin/GraphQL/DataProducer/Entity/EntityPublished.php</exclude-pattern> - <exclude-pattern>src/Plugin/GraphQL/DataProducer/Entity/EntityLabel.php</exclude-pattern> <exclude-pattern>src/Plugin/GraphQL/DataProducer/Entity/EntityRendered.php</exclude-pattern> <exclude-pattern>src/Plugin/GraphQL/DataProducer/Entity/EntityType.php</exclude-pattern> <exclude-pattern>src/Plugin/GraphQL/DataProducer/Entity/EntityLanguage.php</exclude-pattern> - <exclude-pattern>src/Plugin/GraphQL/DataProducer/Entity/EntityUrl.php</exclude-pattern> <exclude-pattern>src/Plugin/GraphQL/DataProducer/Entity/EntityLoadMultiple.php</exclude-pattern> <exclude-pattern>src/Plugin/GraphQL/DataProducer/Entity/EntityOwner.php</exclude-pattern> - <exclude-pattern>src/Plugin/GraphQL/DataProducer/Entity/EntityCreated.php</exclude-pattern> <exclude-pattern>src/Plugin/GraphQL/DataProducer/Entity/EntityDescription.php</exclude-pattern> <exclude-pattern>src/Plugin/GraphQL/DataProducer/Entity/EntityTranslation.php</exclude-pattern> <exclude-pattern>src/Plugin/GraphQL/DataProducer/Entity/EntityLoad.php</exclude-pattern> <exclude-pattern>src/Plugin/GraphQL/DataProducer/Entity/EntityTranslations.php</exclude-pattern> <exclude-pattern>src/Plugin/GraphQL/DataProducer/Entity/Fields/Image/ImageDerivative.php</exclude-pattern> <exclude-pattern>src/Plugin/GraphQL/DataProducer/Entity/Fields/Image/ImageUrl.php</exclude-pattern> - <exclude-pattern>src/Plugin/GraphQL/DataProducer/Entity/EntityChanged.php</exclude-pattern> - <exclude-pattern>src/Plugin/GraphQL/DataProducer/Entity/EntityId.php</exclude-pattern> - <exclude-pattern>src/Plugin/GraphQL/DataProducer/Entity/EntityUuid.php</exclude-pattern> <exclude-pattern>src/Plugin/GraphQL/DataProducer/Entity/EntityAccess.php</exclude-pattern> <exclude-pattern>src/Plugin/GraphQL/DataProducer/Entity/EntityLoadByUuid.php</exclude-pattern> <exclude-pattern>src/Plugin/GraphQL/DataProducer/Entity/EntityBundle.php</exclude-pattern> diff --git a/src/Entity/ServerInterface.php b/src/Entity/ServerInterface.php index 6351911da9d3fc891e7d5ce9732f4920d8eb74ba..1538d0d722907c7eef0a2fb61cd1e3ddd53da2cd 100644 --- a/src/Entity/ServerInterface.php +++ b/src/Entity/ServerInterface.php @@ -17,6 +17,12 @@ interface ServerInterface extends ConfigEntityInterface { /** * Execute an operation on this server. + * + * @param \GraphQL\Server\OperationParams $operation + * The operation parameters. + * + * @return \Drupal\graphql\GraphQL\Execution\ExecutionResult + * The execution result. */ public function executeOperation(OperationParams $operation): ExecutionResult; @@ -24,8 +30,10 @@ interface ServerInterface extends ConfigEntityInterface { * Execute multiple operations as batch on this server. * * @param array<\GraphQL\Server\OperationParams> $operations + * A list of operations to execute in the batch. * * @return array<\Drupal\graphql\GraphQL\Execution\ExecutionResult> + * The execution results for each operation. */ public function executeBatch(array $operations): array; @@ -59,6 +67,7 @@ interface ServerInterface extends ConfigEntityInterface { * Returns the current persisted queries set, sorted by the plugins weight. * * @return array<\Drupal\graphql\Plugin\PersistedQueryPluginInterface> + * The persisted query plugin instances, sorted by weight. */ public function getPersistedQueryInstances(): array; diff --git a/src/Form/PersistedQueriesForm.php b/src/Form/PersistedQueriesForm.php index 8aa827378e09e4b713716df263a8c379bcba841c..890f22dcfa89f4c5054debb652b3748f9989e733 100644 --- a/src/Form/PersistedQueriesForm.php +++ b/src/Form/PersistedQueriesForm.php @@ -197,6 +197,7 @@ class PersistedQueriesForm extends EntityForm { * Returns an array with all the available persisted query plugins. * * @return array<\Drupal\graphql\Plugin\PersistedQueryPluginInterface> + * All persisted query plugins available through plugins. */ protected function getAllPersistedQueryPlugins(): array { $plugins = []; diff --git a/src/Plugin/DataProducerPluginInterface.php b/src/Plugin/DataProducerPluginInterface.php index 45cc7b1edc5a677b3e87b8694a09082f125e54a4..e3b4119e91e002a6d2b4e4be3201f8b1a32428a2 100644 --- a/src/Plugin/DataProducerPluginInterface.php +++ b/src/Plugin/DataProducerPluginInterface.php @@ -19,6 +19,12 @@ interface DataProducerPluginInterface extends ContextAwarePluginInterface, Cache /** * Resolves the queried field with the given context. + * + * @param \Drupal\graphql\GraphQL\Execution\FieldContext $field + * The field context that is passed down from the parent. + * + * @return mixed + * The resolved field value based on the plugin's implementation. */ public function resolveField(FieldContext $field): mixed; diff --git a/src/Plugin/GraphQL/DataProducer/DataProducerProxy.php b/src/Plugin/GraphQL/DataProducer/DataProducerProxy.php index 4f74c81fbed4fc915cc45cfefd2777e22550c745..d643737b3ab4981dae605a6f32abcceb6c0cec57 100644 --- a/src/Plugin/GraphQL/DataProducer/DataProducerProxy.php +++ b/src/Plugin/GraphQL/DataProducer/DataProducerProxy.php @@ -88,6 +88,9 @@ class DataProducerProxy implements ResolverInterface { /** * Create a new data producer proxy. + * + * @return mixed + * A new data producer proxy instance created via the plugin manager. */ public static function create(string $id, array $mapping = [], array $config = []): mixed { $manager = \Drupal::service('plugin.manager.graphql.data_producer'); @@ -118,6 +121,9 @@ class DataProducerProxy implements ResolverInterface { * Resolve field value. * * @throws \Drupal\Component\Plugin\Exception\PluginException + * + * @return mixed + * The resolved field value from the data producer plugin. */ public function resolve(mixed $value, array $args, ResolveContext $context, ResolveInfo $info, FieldContext $field): mixed { $plugin = $this->prepare($value, $args, $context, $info, $field); @@ -222,6 +228,8 @@ class DataProducerProxy implements ResolverInterface { * Cache lookup. * * @return array|null + * The cached data containing value and metadata, or NULL if no cache entry + * found. */ protected function cacheRead(string $prefix): ?array { if ($cache = $this->cacheBackend->get("$prefix:context")) { diff --git a/src/Plugin/GraphQL/DataProducer/Entity/EntityChanged.php b/src/Plugin/GraphQL/DataProducer/Entity/EntityChanged.php index 6e3e16606dd370451d2ad0edde9b2a5ef07cca6a..323ac82561b90a2890e357247c8f5321b4c4fe5c 100644 --- a/src/Plugin/GraphQL/DataProducer/Entity/EntityChanged.php +++ b/src/Plugin/GraphQL/DataProducer/Entity/EntityChanged.php @@ -36,6 +36,11 @@ class EntityChanged extends DataProducerPluginBase { * Resolver. * * @throws \Exception + * When there are date handling errors. + * + * @return string|null + * The formatted entity changed timestamp, or NULL if the entity does not + * implement EntityChangedInterface. */ public function resolve(EntityInterface $entity, ?string $format = NULL): ?string { if ($entity instanceof EntityChangedInterface) { diff --git a/src/Plugin/GraphQL/DataProducer/Entity/EntityCreated.php b/src/Plugin/GraphQL/DataProducer/Entity/EntityCreated.php index fd2344ae9697882f471ec65e08de5d02d805bf23..bb47a8e427572c526aaa57553ccdc651c3e3fe9b 100644 --- a/src/Plugin/GraphQL/DataProducer/Entity/EntityCreated.php +++ b/src/Plugin/GraphQL/DataProducer/Entity/EntityCreated.php @@ -33,6 +33,10 @@ class EntityCreated extends DataProducerPluginBase { /** * Resolver. + * + * @return string|null + * The formatted entity creation timestamp, or NULL if the entity does not + * support creation time. */ public function resolve(EntityInterface $entity, ?string $format = NULL): ?string { // `getCreatedTime` is on NodeInterface which feels weird, since there diff --git a/src/Plugin/GraphQL/DataProducer/Entity/EntityId.php b/src/Plugin/GraphQL/DataProducer/Entity/EntityId.php index cbd9e75022bfae01029450c44c4157d38340e20d..aa60d0b8e6e8da1037f57d0f8c7775081b7ce3f0 100644 --- a/src/Plugin/GraphQL/DataProducer/Entity/EntityId.php +++ b/src/Plugin/GraphQL/DataProducer/Entity/EntityId.php @@ -28,6 +28,9 @@ class EntityId extends DataProducerPluginBase { /** * Resolver. + * + * @return int|string|null + * The entity ID as integer or string, null if the entity has no ID yet. */ public function resolve(EntityInterface $entity): int|string|null { return $entity->id(); diff --git a/src/Plugin/GraphQL/DataProducer/Entity/EntityLabel.php b/src/Plugin/GraphQL/DataProducer/Entity/EntityLabel.php index 539d4d2b28c9058cf7efd3cfc3ac379f829004fd..32d53ce2364b748ece84068968eba0d45e0f9342 100644 --- a/src/Plugin/GraphQL/DataProducer/Entity/EntityLabel.php +++ b/src/Plugin/GraphQL/DataProducer/Entity/EntityLabel.php @@ -36,6 +36,10 @@ class EntityLabel extends DataProducerPluginBase implements DataProducerPluginCa /** * Resolver. + * + * @return string|null + * The entity label, or NULL if access to the entity label is denied for the + * given user. */ public function resolve(EntityInterface $entity, ?AccountInterface $accessUser, FieldContext $context): ?string { /** @var \Drupal\Core\Access\AccessResultInterface $accessResult */ diff --git a/src/Plugin/GraphQL/DataProducer/Entity/EntityUrl.php b/src/Plugin/GraphQL/DataProducer/Entity/EntityUrl.php index 01f1a1987e455b4abf0f54ef03d96b172d273e89..4a46b5fe24f2f9f3b7594b729ae82ccb4dbfd48b 100644 --- a/src/Plugin/GraphQL/DataProducer/Entity/EntityUrl.php +++ b/src/Plugin/GraphQL/DataProducer/Entity/EntityUrl.php @@ -43,11 +43,15 @@ class EntityUrl extends DataProducerPluginBase { * @param \Drupal\Core\Entity\EntityInterface $entity * The entity to create a canonical URL for. * @param string|null $rel - * The link relationship type, for example: canonical or edit-form. + * The link relation type, for example: canonical or edit-form. * @param array|null $options * The options to provided to the URL generator. * * @throws \Drupal\Core\Entity\EntityMalformedException + * When the entity cannot provide a URL. + * + * @return \Drupal\Core\Url + * The URL object for the entity with the given relation. */ public function resolve(EntityInterface $entity, ?string $rel, ?array $options): Url { return $entity->toUrl($rel ?? 'canonical', $options ?? []); diff --git a/src/Plugin/GraphQL/DataProducer/Entity/EntityUuid.php b/src/Plugin/GraphQL/DataProducer/Entity/EntityUuid.php index aebda13e26a5a287b65ae58119932f28faa10903..658df01a62e861c59194323e017eecaba3722cba 100644 --- a/src/Plugin/GraphQL/DataProducer/Entity/EntityUuid.php +++ b/src/Plugin/GraphQL/DataProducer/Entity/EntityUuid.php @@ -28,6 +28,9 @@ class EntityUuid extends DataProducerPluginBase { /** * Resolver. + * + * @return string|null + * The entity UUID, or NULL if the entity doesn't have a UUID. */ public function resolve(EntityInterface $entity): ?string { return $entity->uuid(); diff --git a/src/Plugin/GraphQL/DataProducer/Menu/MenuLink/MenuLinkLabel.php b/src/Plugin/GraphQL/DataProducer/Menu/MenuLink/MenuLinkLabel.php index 094b95b6c57e22bb3b29da72d9a3498634883ba8..30fe13b4d7be312441e596c3202b99955ca404fc 100644 --- a/src/Plugin/GraphQL/DataProducer/Menu/MenuLink/MenuLinkLabel.php +++ b/src/Plugin/GraphQL/DataProducer/Menu/MenuLink/MenuLinkLabel.php @@ -30,6 +30,9 @@ class MenuLinkLabel extends DataProducerPluginBase { /** * Resolver. + * + * @return string + * The menu link title. */ public function resolve(MenuLinkInterface $link): string { return $link->getTitle(); diff --git a/src/Plugin/GraphQL/DataProducer/Menu/MenuTree/MenuTreeSubtree.php b/src/Plugin/GraphQL/DataProducer/Menu/MenuTree/MenuTreeSubtree.php index 3dd194ea0445675a133b7993e97aa94ad9ab8524..1368c3fd53171d35014fe37d6e3305228e64eda0 100644 --- a/src/Plugin/GraphQL/DataProducer/Menu/MenuTree/MenuTreeSubtree.php +++ b/src/Plugin/GraphQL/DataProducer/Menu/MenuTree/MenuTreeSubtree.php @@ -33,6 +33,7 @@ class MenuTreeSubtree extends DataProducerPluginBase { * Resolver. * * @return array<\Drupal\Core\Menu\MenuLinkTreeElement> + * An array of enabled menu link tree elements in the subtree. */ public function resolve(MenuLinkTreeElement $element): array { return array_filter($element->subtree, function (MenuLinkTreeElement $item) { diff --git a/src/Plugin/GraphQL/DataProducer/String/Uppercase.php b/src/Plugin/GraphQL/DataProducer/String/Uppercase.php index 0a0ddbd9bc445464e36811000226c710f46db4da..690835404ea9878ae51e37d759539a2c8a6de126 100644 --- a/src/Plugin/GraphQL/DataProducer/String/Uppercase.php +++ b/src/Plugin/GraphQL/DataProducer/String/Uppercase.php @@ -27,6 +27,12 @@ class Uppercase extends DataProducerPluginBase { /** * Value resolver. + * + * @param string $string + * The input string to convert to uppercase. + * + * @return string + * The input string converted to uppercase. */ public function resolve(string $string): string { return strtoupper($string); diff --git a/src/Plugin/GraphQL/DataProducer/TypedData/PropertyPath.php b/src/Plugin/GraphQL/DataProducer/TypedData/PropertyPath.php index d44f49d19bb98c01a016fd7536b9b87034411b51..e6a2de0978b34549fdf15a292dad877bc7088b49 100644 --- a/src/Plugin/GraphQL/DataProducer/TypedData/PropertyPath.php +++ b/src/Plugin/GraphQL/DataProducer/TypedData/PropertyPath.php @@ -43,6 +43,19 @@ class PropertyPath extends DataProducerPluginBase { /** * Resolve the property path. + * + * @param string $path + * The property path to resolve. + * @param mixed $value + * The root value to resolve the path from. + * @param string|null $type + * The type of the value to start from, it will be used to get the + * corresponding type data definition and wrap the value in it. + * @param \Drupal\Core\Cache\RefinableCacheableDependencyInterface $metadata + * The refinable metadata object. + * + * @return mixed + * The resolved value at the given property path, or NULL if not found. */ public function resolve(string $path, mixed $value, ?string $type, RefinableCacheableDependencyInterface $metadata): mixed { if (!($value instanceof TypedDataInterface) && !empty($type)) { diff --git a/src/Plugin/GraphQL/DataProducer/XML/XMLAttribute.php b/src/Plugin/GraphQL/DataProducer/XML/XMLAttribute.php index c6c6b558bab6d6bb14ff5414f16ffdf9c8f0dff7..2ef14faf593b0b66ca09ffcac90972193e2f49de 100644 --- a/src/Plugin/GraphQL/DataProducer/XML/XMLAttribute.php +++ b/src/Plugin/GraphQL/DataProducer/XML/XMLAttribute.php @@ -35,6 +35,9 @@ class XMLAttribute extends DataProducerPluginBase { * The source (root) DOM element. * @param string $name * The name of the attribute. + * + * @return string + * The attribute value. */ public function resolve(\DOMElement $dom, string $name): string { return $dom->getAttribute($name); diff --git a/src/Plugin/GraphQL/DataProducer/XML/XMLContent.php b/src/Plugin/GraphQL/DataProducer/XML/XMLContent.php index e2cc0f4c5bbe4506098819808c5ed00790541573..d01d3eaf47a215988567dcd60e605034bec1f945 100644 --- a/src/Plugin/GraphQL/DataProducer/XML/XMLContent.php +++ b/src/Plugin/GraphQL/DataProducer/XML/XMLContent.php @@ -30,6 +30,9 @@ class XMLContent extends DataProducerPluginBase { * * @param \DOMElement $dom * The source (root) DOM element. + * + * @return string + * The XML content as string. */ public function resolve(\DOMElement $dom): string { return implode('', array_map(function ($child) { diff --git a/src/Plugin/GraphQL/DataProducer/XML/XMLParse.php b/src/Plugin/GraphQL/DataProducer/XML/XMLParse.php index cf77f7c30f4421072cf3aa6edb9f6079d5fa3dba..28109818f8c21bdd41a789775d848455ee3111f4 100644 --- a/src/Plugin/GraphQL/DataProducer/XML/XMLParse.php +++ b/src/Plugin/GraphQL/DataProducer/XML/XMLParse.php @@ -30,6 +30,9 @@ class XMLParse extends DataProducerPluginBase { * * @param string $input * The source input. + * + * @return \DOMElement + * The parsed XML document element. */ public function resolve(string $input): \DOMElement { $document = new \DOMDocument(); diff --git a/src/Plugin/GraphQL/DataProducer/XML/XMLXpath.php b/src/Plugin/GraphQL/DataProducer/XML/XMLXpath.php index 99c6f0911ebe74c2c1e7db4274691af06723a60c..dbd7a34c3d1405bc695e9acb12f32545764a4ead 100644 --- a/src/Plugin/GraphQL/DataProducer/XML/XMLXpath.php +++ b/src/Plugin/GraphQL/DataProducer/XML/XMLXpath.php @@ -38,6 +38,7 @@ class XMLXpath extends DataProducerPluginBase { * The xpath query. * * @return array<\DOMElement> + * Array of DOM elements matching the xpath query. */ public function resolve(\DOMElement $dom, string $query): array { $xpath = new \DOMXPath($dom->ownerDocument); diff --git a/src/Plugin/SchemaExtensionPluginManager.php b/src/Plugin/SchemaExtensionPluginManager.php index 8a1ffb243c60cabea98145734dd342e1cb13a2c0..4ffbb960ee3e9c710b1f99da9bb3c19bb494e71c 100644 --- a/src/Plugin/SchemaExtensionPluginManager.php +++ b/src/Plugin/SchemaExtensionPluginManager.php @@ -72,6 +72,7 @@ class SchemaExtensionPluginManager extends DefaultPluginManager { * The id of the schema plugin to retrieve the extensions for. * * @return array<\Drupal\graphql\Plugin\SchemaExtensionPluginInterface> + * An array of schema extension plugin instances sorted by priority. */ public function getExtensions(string $id): array { if (!isset($this->extensions[$id])) {