Automattic\WooCommerce\Vendor\GraphQL\Type

SchemaValidationContext::getDirectivesprivateWC 1.0

Method of the class: SchemaValidationContext{}

No Hooks.

Returns

NodeList.

Usage

// private - for code of main (parent) class only
$result = $this->getDirectives( $object ): NodeList;
$object(Schema|(Type&NamedType)) (required)
.

SchemaValidationContext::getDirectives() code WC 10.9.1

private function getDirectives(object $object): NodeList
{
    $directives = [];
    /**
     * Excluding directiveNode, since $object is not Directive.
     *
     * @var SchemaDefinitionNode|SchemaExtensionNode|ObjectTypeDefinitionNode|ObjectTypeExtensionNode|InterfaceTypeDefinitionNode|InterfaceTypeExtensionNode|UnionTypeDefinitionNode|UnionTypeExtensionNode|EnumTypeDefinitionNode|EnumTypeExtensionNode|InputObjectTypeDefinitionNode|InputObjectTypeExtensionNode $node
     */
    // @phpstan-ignore-next-line union types are not pervasive
    foreach ($this->getAllNodes($object) as $node) {
        foreach ($node->directives as $directive) {
            $directives[] = $directive;
        }
    }

    return new NodeList($directives);
}