Skip to content
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

chore(deps): update phpstan packages #1665

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
"nyholm/psr7": "^1.5",
"phpbench/phpbench": "^1.2",
"phpstan/extension-installer": "^1.1",
"phpstan/phpstan": "1.12.12",
"phpstan/phpstan-phpunit": "1.4.1",
"phpstan/phpstan": "1.12.13",
"phpstan/phpstan-phpunit": "1.4.2",
"phpstan/phpstan-strict-rules": "1.6.1",
"phpunit/phpunit": "^9.5 || ^10.5.21 || ^11",
"psr/http-message": "^1 || ^2",
Expand Down
128 changes: 112 additions & 16 deletions docs/class-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -430,37 +430,35 @@ public $variableValues;

```php
/**
* Helper method that returns names of all fields selected in query for
* $this->fieldName up to $depth levels.
* Returns names of all fields selected in query for `$this->fieldName` up to `$depth` levels.
*
* Example:
* query MyQuery{
* {
* root {
* id,
* id
* nested {
* nested1
* nested2 {
* nested3
* }
* nested1
* nested2 {
* nested3
* }
* }
* }
* }
*
* Given this ResolveInfo instance is a part of "root" field resolution, and $depth === 1,
* method will return:
* Given this ResolveInfo instance is a part of root field resolution, and $depth === 1,
* this method will return:
* [
* 'id' => true,
* 'nested' => [
* nested1 => true,
* nested2 => true
* ]
* 'nested1' => true,
* 'nested2' => true,
* ],
* ]
*
* Warning: this method it is a naive implementation which does not take into account
* conditional typed fragments. So use it with care for fields of interface and union types.
* This method does not consider conditional typed fragments.
* Use it with care for fields of interface and union types.
*
* @param int $depth How many levels to include in output
* @param int $depth How many levels to include in the output beyond the first
*
* @return array<string, mixed>
*
Expand All @@ -469,6 +467,104 @@ public $variableValues;
function getFieldSelection(int $depth = 0): array
```

```php
/**
* Returns names and args of all fields selected in query for `$this->fieldName` up to `$depth` levels, including aliases.
*
* The result maps original field names to a map of selections for that field, including aliases.
* For each of those selections, you can find the following keys:
* - "args" contains the passed arguments for this field/alias
* - "selectionSet" contains potential nested fields of this field/alias. The structure is recursive from here.
*
* Example:
* {
* root {
* id
* nested {
* nested1(myArg: 1)
* nested1Bis: nested1
* }
* alias1: nested {
* nested1(myArg: 2, mySecondAg: "test")
* }
* }
* }
*
* Given this ResolveInfo instance is a part of "root" field resolution, and $depth === 1,
* this method will return:
* [
* 'id' => [
* 'id' => [
* 'args' => [],
* ],
* ],
* 'nested' => [
* 'nested' => [
* 'args' => [],
* 'selectionSet' => [
* 'nested1' => [
* 'nested1' => [
* 'args' => [
* 'myArg' => 1,
* ],
* ],
* 'nested1Bis' => [
* 'args' => [],
* ],
* ],
* ],
* ],
* 'alias1' => [
* 'args' => [],
* 'selectionSet' => [
* 'nested1' => [
* 'nested1' => [
* 'args' => [
* 'myArg' => 2,
* 'mySecondAg' => "test,
* ],
* ],
* ],
* ],
* ],
* ],
* ]
*
* This method does not consider conditional typed fragments.
* Use it with care for fields of interface and union types.
* You can still alias the union type fields with the same name in order to extract their corresponding args.
*
* Example:
* {
* root {
* id
* unionPerson {
* ...on Child {
* name
* birthdate(format: "d/m/Y")
* }
* ...on Adult {
* adultName: name
* adultBirthDate: birthdate(format: "Y-m-d")
* job
* }
* }
* }
* }
*
* @param int $depth How many levels to include in the output beyond the first
*
* @throws \Exception
* @throws Error
* @throws InvariantViolation
*
* @return array<string, mixed>
*
* @api
*/
function getFieldSelectionWithAliases(int $depth = 0): array
```

## GraphQL\Language\DirectiveLocation

Enumeration of available directive locations.
Expand Down