Skip to content

Add examples + readme #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
trappar opened this issue Aug 17, 2015 · 2 comments
Closed

Add examples + readme #2

trappar opened this issue Aug 17, 2015 · 2 comments

Comments

@trappar
Copy link

trappar commented Aug 17, 2015

Without more information this project looks interesting but I'm not sure how to even get started. Is this something you're going to be expanding on in the future?

@vladar
Copy link
Member

vladar commented Aug 19, 2015

Definitely. It's really in pre-release state now. We still explore usage scenarious ourselves and will probably make significant changes to API before first usable release.

But if you want to experiment with it, check out tests as usage examples, say:

https://github.com/webonyx/graphql-php/blob/master/tests/StarWarsSchema.php
https://github.com/webonyx/graphql-php/blob/master/tests/StarWarsQueryTest.php

@vladar
Copy link
Member

vladar commented Aug 19, 2015

Added quick README for now. Feel free to open specific issues if something requires additional clarifications in Readme.

@vladar vladar closed this as completed Aug 19, 2015
yura3d added a commit to yura3d/graphql-php that referenced this issue Jul 15, 2019
vladar pushed a commit that referenced this issue Oct 13, 2019
* Added inline fragments support to ResolveInfo

* Revert "Added inline fragments support to ResolveInfo"

This reverts commit c35379c.

* Inline fragments and union type support for QueryPlan

* Introduced $options to prevent BC

* No more underscores for fragments data

* Fixed Scrutinizer

* Fixed Scrutinizer #2

* Fixed Scrutinizer #3

* Renamings; merging fields inside fragments

* Fixed fields order for merged types

* Grouping implementor fields for abstract types
ruudk added a commit to ruudk/graphql-php that referenced this issue Feb 26, 2025
When creating a node visitor that uses more specific types, we get this error:

```
Parameter webonyx#2 $visitor of static method GraphQL\Language\Visitor::visit() expects array<string, array<string, callable(GraphQL\Language\AST\Node): (GraphQL\Language\VisitorOperation|void|false|null)>|(callable(GraphQL\Language\AST\Node): (GraphQL\Language\VisitorOperation|void|false|null))>, array{OperationDefinition: array{enter: Closure(GraphQL\Language\AST\OperationDefinitionNode): void, leave: Closure(): void}, Field: array{enter: Closure(GraphQL\Language\AST\FieldNode): void, leave: Closure(GraphQL\Language\AST\FieldNode): void}, InlineFragment: array{enter: Closure(GraphQL\Language\AST\InlineFragmentNode): void, leave: Closure(GraphQL\Language\AST\InlineFragmentNode): void}, FragmentDefinition: array{enter: Closure(GraphQL\Language\AST\FragmentDefinitionNode): void, leave: Closure(GraphQL\Language\AST\FragmentDefinitionNode): void}, SelectionSet: Closure(GraphQL\Language\AST\SelectionSetNode): void} given.
```

For the following code:
```php
$ast = Visitor::visit($ast, [
                NodeKind::OPERATION_DEFINITION => [
                    'enter' => function (OperationDefinitionNode $node) : void {
                        $this->parents[] = $node->operation;

                        // Remove the operation name as we don't need this
                        $node->name = null;
                    },
                    'leave' => function () : void {
                        array_pop($this->parents);
                    },
                ],
                NodeKind::FIELD => [
                    'enter' => function (FieldNode $node) : void {
                        $this->parents[] = $node->name->value;
                    },
                    'leave' => function (FieldNode $node) : void {
                        array_pop($this->parents);
                    },
                ],
 // ...
```

By changing the signature to `covariant` the problem goes away.
ruudk added a commit to ruudk/graphql-php that referenced this issue Feb 26, 2025
When creating a node visitor that uses more specific types, we get this error:

```
Parameter webonyx#2 $visitor of static method GraphQL\Language\Visitor::visit() expects array<string, array<string, callable(GraphQL\Language\AST\Node): (GraphQL\Language\VisitorOperation|void|false|null)>|(callable(GraphQL\Language\AST\Node): (GraphQL\Language\VisitorOperation|void|false|null))>, array{OperationDefinition: array{enter: Closure(GraphQL\Language\AST\OperationDefinitionNode): void, leave: Closure(): void}, Field: array{enter: Closure(GraphQL\Language\AST\FieldNode): void, leave: Closure(GraphQL\Language\AST\FieldNode): void}, InlineFragment: array{enter: Closure(GraphQL\Language\AST\InlineFragmentNode): void, leave: Closure(GraphQL\Language\AST\InlineFragmentNode): void}, FragmentDefinition: array{enter: Closure(GraphQL\Language\AST\FragmentDefinitionNode): void, leave: Closure(GraphQL\Language\AST\FragmentDefinitionNode): void}, SelectionSet: Closure(GraphQL\Language\AST\SelectionSetNode): void} given.
```

For the following code:
```php
$ast = Visitor::visit($ast, [
                NodeKind::OPERATION_DEFINITION => [
                    'enter' => function (OperationDefinitionNode $node) : void {
                        $this->parents[] = $node->operation;

                        // Remove the operation name as we don't need this
                        $node->name = null;
                    },
                    'leave' => function () : void {
                        array_pop($this->parents);
                    },
                ],
                NodeKind::FIELD => [
                    'enter' => function (FieldNode $node) : void {
                        $this->parents[] = $node->name->value;
                    },
                    'leave' => function (FieldNode $node) : void {
                        array_pop($this->parents);
                    },
                ],
 // ...
```

By changing the signature to `covariant` the problem goes away.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants