Skip to content

Commit 7c0aa4c

Browse files
committed
Better docs and comments on breaks and deprecations for 8.0
1 parent b665d26 commit 7c0aa4c

File tree

7 files changed

+30
-34
lines changed

7 files changed

+30
-34
lines changed

UPGRADE.md

Lines changed: 24 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,14 @@
11
# Upgrade
22

33
## Upgrade v0.7.x > v0.8.x
4+
All of those changes apply to those who extends various parts of this library.
5+
If you only use the library and don't try to extend it - everything should work without breaks.
46

5-
### AST node classes
6-
AST node classes were renamed to disambiguate with types. e.g.:
77

8-
```
9-
GraphQL\Language\AST\Field -> GraphQL\Language\AST\FieldNode
10-
GraphQL\Language\AST\OjbectValue -> GraphQL\Language\AST\OjbectValueNode
11-
```
12-
etc.
13-
14-
Node kind constants were extracted from `GraphQL\Language\AST\Node` to `GraphQL\Language\AST\NodeKind`
15-
16-
17-
### Custom directives handling
8+
### Breaking: Custom directives handling
189
When passing custom directives to schema, default directives (like `@skip` and `@include`)
19-
are not added to schema automatically anymore. If you need them - add them explicitly with your other directives
10+
are not added to schema automatically anymore. If you need them - add them explicitly with
11+
your other directives.
2012

2113
Before the change:
2214
```php
@@ -34,26 +26,31 @@ $schema = new Schema([
3426
]);
3527
```
3628

37-
### Protected property and method naming
38-
In order to unify coding style, leading underscores were removed from all private and protected properties
39-
and methods.
29+
### Breaking: Schema protected property and methods visibility
30+
Most of the `protected` properties and methods of `GraphQL\Schema` were changed to `private`.
31+
Please use public interface instead.
4032

41-
Example before the change:
42-
```php
43-
GraphQL\Schema::$_queryType;
44-
```
33+
### Breaking: Node kind constants
34+
Node kind constants were extracted from `GraphQL\Language\AST\Node` to
35+
separate class `GraphQL\Language\AST\NodeKind`
36+
37+
### Non-breaking: AST node classes renamed
38+
AST node classes were renamed to disambiguate with types. e.g.:
4539

46-
Correct usage after the change:
47-
```php
48-
GraphQL\Schema::$queryType;
4940
```
41+
GraphQL\Language\AST\Field -> GraphQL\Language\AST\FieldNode
42+
GraphQL\Language\AST\OjbectValue -> GraphQL\Language\AST\OjbectValueNode
43+
```
44+
etc.
5045

51-
So if you rely on any protected properties or methods of any GraphQL class, make sure to
52-
delete leading underscores.
46+
Old names are still available via `class_alias` defined in `src/deprecated.php`.
47+
This file is included automatically when using composer autoloading.
5348

5449
### Deprecations
55-
There are also several deprecations which still work, but trigger `E_USER_DEPRECATED`
56-
when used.
50+
There are several deprecations which still work, but trigger `E_USER_DEPRECATED` when used.
51+
52+
For example `GraphQL\Executor\Executor::setDefaultResolveFn()` is renamed to `setDefaultResolver()`
53+
but still works with old name.
5754

5855
## Upgrade v0.6.x > v0.7.x
5956

src/Error/FormattedError.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
class FormattedError
1515
{
1616
/**
17-
* @deprecated since 2016-10-21
17+
* @deprecated as of 8.0
1818
* @param $error
1919
* @param SourceLocation[] $locations
2020
* @return array

src/Executor/Executor.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -894,7 +894,7 @@ private static function inferTypeOf($value, $context, ResolveInfo $info, Abstrac
894894
}
895895

896896
/**
897-
* @deprecated as of 19.11.2016
897+
* @deprecated as of 8.0
898898
*/
899899
public static function defaultResolveFn($source, $args, $context, ResolveInfo $info)
900900
{
@@ -903,7 +903,7 @@ public static function defaultResolveFn($source, $args, $context, ResolveInfo $i
903903
}
904904

905905
/**
906-
* @deprecated as of 19.11.2016
906+
* @deprecated as of 8.0
907907
*/
908908
public static function setDefaultResolveFn($fn)
909909
{

src/Executor/Values.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ public static function getArgumentValues($def, $node, $variableValues)
162162
}
163163

164164
/**
165-
* @deprecated Moved to Utils\AST::valueFromAST
165+
* @deprecated as of 8.0 (Moved to Utils\AST::valueFromAST)
166166
*
167167
* @param $valueNode
168168
* @param InputType $type

src/Type/Definition/Directive.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class Directive
1919

2020
/**
2121
* @var array
22-
* @deprecated as of 8.0 (use constants directly)
22+
* @deprecated as of 8.0 (use DirectiveLocation constants directly)
2323
*/
2424
public static $directiveLocations = [
2525
// Operations:

src/Type/Definition/FieldArgument.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ public function __construct(array $def)
8989

9090
/**
9191
* @return InputType
92-
* @deprecated in favor of setting 'fields' as closure per objectType vs on individual field/argument level
9392
*/
9493
public function getType()
9594
{

src/Type/Definition/ResolveInfo.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class ResolveInfo
2424

2525
/**
2626
* @var FieldNode[]
27-
* @deprecated Renamed to $fieldNodes as of 19.11.2016, will be removed after several releases
27+
* @deprecated as of 8.0 (Renamed to $fieldNodes)
2828
*/
2929
public $fieldASTs;
3030

0 commit comments

Comments
 (0)