Automattic\WooCommerce\Vendor\GraphQL\Utils

ASTDefinitionBuilder::getDeprecationReasonprivateWC 1.0

Given a collection of directives, returns the string value for the deprecation reason.

Method of the class: ASTDefinitionBuilder{}

No Hooks.

Returns

null. Nothing (null).

Usage

// private - for code of main (parent) class only
$result = $this->getDeprecationReason( $node ): ?string;
$node(EnumValueDefinitionNode|FieldDefinitionNode|InputValueDefinitionNode) (required)
.

ASTDefinitionBuilder::getDeprecationReason() code WC 10.9.1

private function getDeprecationReason(Node $node): ?string
{
    $deprecated = Values::getDirectiveValues(
        Directive::deprecatedDirective(),
        $node
    );

    return $deprecated['reason'] ?? null;
}