Automattic\WooCommerce\Vendor\GraphQL\Utils

SchemaPrinter::printDeprecatedprotected staticWC 1.0

Method of the class: SchemaPrinter{}

No Hooks.

Returns

null. Nothing (null).

Usage

$result = SchemaPrinter::printDeprecated( $deprecation ): string;
$deprecation(FieldDefinition|EnumValueDefinition|InputObjectField|Argument) (required)
.

SchemaPrinter::printDeprecated() code WC 10.9.1

protected static function printDeprecated($deprecation): string
{
    $reason = $deprecation->deprecationReason;
    if ($reason === null) {
        return '';
    }

    if ($reason === '' || $reason === Directive::DEFAULT_DEPRECATION_REASON) {
        return ' @deprecated';
    }

    $reasonAST = AST::astFromValue($reason, Type::string());
    assert($reasonAST instanceof StringValueNode);

    $reasonASTString = Printer::doPrint($reasonAST);

    return " @deprecated(reason: {$reasonASTString})";
}