for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Digia\GraphQL\SchemaValidator\Rule;
use Digia\GraphQL\Error\InvariantException;
use Digia\GraphQL\SchemaValidator\ValidationContextInterface;
use function Digia\GraphQL\Util\isValidNameError;
trait ValidatesNamesTrait
{
/**
* @param ValidationContextInterface $context
* @param mixed $node
* @throws InvariantException
*/
protected function validateName(ValidationContextInterface $context, $node): void
// Ensure names are valid, however introspection types opt out.
/** @noinspection PhpUndefinedMethodInspection */
$error = isValidNameError($node->getName(), $node);
if (null !== $error) {
$context->reportError($error);
}