getSchema(); $alreadyDefined = $oldSchema !== null ? ( $oldSchema->getAstNode() !== null || $oldSchema->getQueryType() !== null || $oldSchema->getMutationType() !== null || $oldSchema->getSubscriptionType() !== null ) : false; $schemaDefinitionsCount = 0; return [ NodeKind::SCHEMA_DEFINITION => static function (SchemaDefinitionNode $node) use ($alreadyDefined, $context, &$schemaDefinitionsCount) : void { if ($alreadyDefined !== false) { $context->reportError(new Error(self::canNotDefineSchemaWithinExtensionMessage(), $node)); return; } if ($schemaDefinitionsCount > 0) { $context->reportError(new Error(self::schemaDefinitionNotAloneMessage(), $node)); } ++$schemaDefinitionsCount; }, ]; } }