for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Drupal\graphql\Plugin\GraphQL\Scalars;
use Drupal\Component\Plugin\PluginBase;
use Drupal\graphql\Plugin\GraphQL\PluggableSchemaBuilder;
use Drupal\graphql\Plugin\GraphQL\Traits\CacheablePluginTrait;
use Drupal\graphql\Plugin\GraphQL\TypeSystemPluginInterface;
use GraphQL\Type\Definition\CustomScalarType;
abstract class ScalarPluginBase extends PluginBase implements TypeSystemPluginInterface {
use CacheablePluginTrait;
/**
* {@inheritdoc}
*/
public static function createInstance(PluggableSchemaBuilder $builder, $definition, $id) {
$callable = ['GraphQL\Type\Definition\Type', strtolower($definition['name'])];
if (is_callable($callable)) {
return $callable();
}
return new CustomScalarType($definition);
public function getDefinition() {
return $this->getPluginDefinition();
* @param mixed $value
public static function serialize($value) {
throw new \LogicException('Missing method.');
*
* @return mixed
public static function parseValue($value) {
* @param mixed $node
public static function parseLiteral($node) {