mirror of
https://github.com/retailcrm/graphql-php.git
synced 2024-11-21 20:36:05 +03:00
Better docs and comments on breaks and deprecations for 8.0
This commit is contained in:
parent
b665d267c3
commit
7c0aa4ceec
51
UPGRADE.md
51
UPGRADE.md
@ -1,22 +1,14 @@
|
||||
# Upgrade
|
||||
|
||||
## Upgrade v0.7.x > v0.8.x
|
||||
|
||||
### AST node classes
|
||||
AST node classes were renamed to disambiguate with types. e.g.:
|
||||
|
||||
```
|
||||
GraphQL\Language\AST\Field -> GraphQL\Language\AST\FieldNode
|
||||
GraphQL\Language\AST\OjbectValue -> GraphQL\Language\AST\OjbectValueNode
|
||||
```
|
||||
etc.
|
||||
|
||||
Node kind constants were extracted from `GraphQL\Language\AST\Node` to `GraphQL\Language\AST\NodeKind`
|
||||
All of those changes apply to those who extends various parts of this library.
|
||||
If you only use the library and don't try to extend it - everything should work without breaks.
|
||||
|
||||
|
||||
### Custom directives handling
|
||||
### Breaking: Custom directives handling
|
||||
When passing custom directives to schema, default directives (like `@skip` and `@include`)
|
||||
are not added to schema automatically anymore. If you need them - add them explicitly with your other directives
|
||||
are not added to schema automatically anymore. If you need them - add them explicitly with
|
||||
your other directives.
|
||||
|
||||
Before the change:
|
||||
```php
|
||||
@ -34,26 +26,31 @@ $schema = new Schema([
|
||||
]);
|
||||
```
|
||||
|
||||
### Protected property and method naming
|
||||
In order to unify coding style, leading underscores were removed from all private and protected properties
|
||||
and methods.
|
||||
### Breaking: Schema protected property and methods visibility
|
||||
Most of the `protected` properties and methods of `GraphQL\Schema` were changed to `private`.
|
||||
Please use public interface instead.
|
||||
|
||||
### Breaking: Node kind constants
|
||||
Node kind constants were extracted from `GraphQL\Language\AST\Node` to
|
||||
separate class `GraphQL\Language\AST\NodeKind`
|
||||
|
||||
### Non-breaking: AST node classes renamed
|
||||
AST node classes were renamed to disambiguate with types. e.g.:
|
||||
|
||||
Example before the change:
|
||||
```php
|
||||
GraphQL\Schema::$_queryType;
|
||||
```
|
||||
|
||||
Correct usage after the change:
|
||||
```php
|
||||
GraphQL\Schema::$queryType;
|
||||
GraphQL\Language\AST\Field -> GraphQL\Language\AST\FieldNode
|
||||
GraphQL\Language\AST\OjbectValue -> GraphQL\Language\AST\OjbectValueNode
|
||||
```
|
||||
etc.
|
||||
|
||||
So if you rely on any protected properties or methods of any GraphQL class, make sure to
|
||||
delete leading underscores.
|
||||
Old names are still available via `class_alias` defined in `src/deprecated.php`.
|
||||
This file is included automatically when using composer autoloading.
|
||||
|
||||
### Deprecations
|
||||
There are also several deprecations which still work, but trigger `E_USER_DEPRECATED`
|
||||
when used.
|
||||
There are several deprecations which still work, but trigger `E_USER_DEPRECATED` when used.
|
||||
|
||||
For example `GraphQL\Executor\Executor::setDefaultResolveFn()` is renamed to `setDefaultResolver()`
|
||||
but still works with old name.
|
||||
|
||||
## Upgrade v0.6.x > v0.7.x
|
||||
|
||||
|
@ -14,7 +14,7 @@ use GraphQL\Utils;
|
||||
class FormattedError
|
||||
{
|
||||
/**
|
||||
* @deprecated since 2016-10-21
|
||||
* @deprecated as of 8.0
|
||||
* @param $error
|
||||
* @param SourceLocation[] $locations
|
||||
* @return array
|
||||
|
@ -894,7 +894,7 @@ class Executor
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated as of 19.11.2016
|
||||
* @deprecated as of 8.0
|
||||
*/
|
||||
public static function defaultResolveFn($source, $args, $context, ResolveInfo $info)
|
||||
{
|
||||
@ -903,7 +903,7 @@ class Executor
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated as of 19.11.2016
|
||||
* @deprecated as of 8.0
|
||||
*/
|
||||
public static function setDefaultResolveFn($fn)
|
||||
{
|
||||
|
@ -162,7 +162,7 @@ class Values
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Moved to Utils\AST::valueFromAST
|
||||
* @deprecated as of 8.0 (Moved to Utils\AST::valueFromAST)
|
||||
*
|
||||
* @param $valueNode
|
||||
* @param InputType $type
|
||||
|
@ -19,7 +19,7 @@ class Directive
|
||||
|
||||
/**
|
||||
* @var array
|
||||
* @deprecated as of 8.0 (use constants directly)
|
||||
* @deprecated as of 8.0 (use DirectiveLocation constants directly)
|
||||
*/
|
||||
public static $directiveLocations = [
|
||||
// Operations:
|
||||
|
@ -89,7 +89,6 @@ class FieldArgument
|
||||
|
||||
/**
|
||||
* @return InputType
|
||||
* @deprecated in favor of setting 'fields' as closure per objectType vs on individual field/argument level
|
||||
*/
|
||||
public function getType()
|
||||
{
|
||||
|
@ -24,7 +24,7 @@ class ResolveInfo
|
||||
|
||||
/**
|
||||
* @var FieldNode[]
|
||||
* @deprecated Renamed to $fieldNodes as of 19.11.2016, will be removed after several releases
|
||||
* @deprecated as of 8.0 (Renamed to $fieldNodes)
|
||||
*/
|
||||
public $fieldASTs;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user