Skip to content

Commit de79153

Browse files
committed
Docblocks improvements
1 parent d5e3d08 commit de79153

File tree

6 files changed

+40
-13
lines changed

6 files changed

+40
-13
lines changed

src/Type/Definition/DirectiveLocation.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
<?php
22
namespace GraphQL\Type\Definition;
33

4+
/**
5+
* List of available directive locations
6+
*/
47
class DirectiveLocation
58
{
69
const IFACE = 'INTERFACE';

src/Type/Definition/Type.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public static function float()
7070

7171
/**
7272
* @api
73-
* @param ObjectType|InterfaceType|UnionType|ScalarType|InputObjectType|EnumType $wrappedType
73+
* @param ObjectType|InterfaceType|UnionType|ScalarType|InputObjectType|EnumType|ListOfType|NonNull $wrappedType
7474
* @return ListOfType
7575
*/
7676
public static function listOf($wrappedType)
@@ -80,7 +80,7 @@ public static function listOf($wrappedType)
8080

8181
/**
8282
* @api
83-
* @param ObjectType|InterfaceType|UnionType|ScalarType|InputObjectType|EnumType $wrappedType
83+
* @param ObjectType|InterfaceType|UnionType|ScalarType|InputObjectType|EnumType|ListOfType $wrappedType
8484
* @return NonNull
8585
*/
8686
public static function nonNull($wrappedType)

src/Utils/AST.php

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,7 @@
3535
use GraphQL\Utils\Utils;
3636

3737
/**
38-
* Class AST
39-
* @package GraphQL\Utils
38+
* Various utilities dealing with AST
4039
*/
4140
class AST
4241
{
@@ -59,8 +58,9 @@ class AST
5958
* Will produce instance of `ListValueNode` where `values` prop is a lazily-evaluated `NodeList`
6059
* returning instances of `StringValueNode` on access.
6160
*
62-
* This is a reverse operation for $node->toArray(true)
61+
* This is a reverse operation for AST::toArray($node)
6362
*
63+
* @api
6464
* @param array $node
6565
* @return Node
6666
*/
@@ -98,6 +98,7 @@ public static function fromArray(array $node)
9898
/**
9999
* Convert AST node to serializable array
100100
*
101+
* @api
101102
* @param Node $node
102103
* @return array
103104
*/
@@ -124,6 +125,7 @@ public static function toArray(Node $node)
124125
* | Mixed | Enum Value |
125126
* | null | NullValue |
126127
*
128+
* @api
127129
* @param $value
128130
* @param InputType $type
129131
* @return ObjectValueNode|ListValueNode|BooleanValueNode|IntValueNode|FloatValueNode|EnumValueNode|StringValueNode|NullValueNode
@@ -267,8 +269,9 @@ static function astFromValue($value, InputType $type)
267269
* | String | String |
268270
* | Int / Float | Int / Float |
269271
* | Enum Value | Mixed |
270-
* | Null Value | stdClass | instance of NullValue::getNullValue()
272+
* | Null Value | null |
271273
*
274+
* @api
272275
* @param $valueNode
273276
* @param InputType $type
274277
* @param null $variables
@@ -396,6 +399,9 @@ public static function valueFromAST($valueNode, InputType $type, $variables = nu
396399
}
397400

398401
/**
402+
* Returns type definition for given AST Type node
403+
*
404+
* @api
399405
* @param Schema $schema
400406
* @param NamedTypeNode|ListTypeNode|NonNullTypeNode $inputTypeNode
401407
* @return Type
@@ -430,6 +436,9 @@ private static function isMissingVariable($valueNode, $variables)
430436
}
431437

432438
/**
439+
* Returns operation type ("query", "mutation" or "subscription") given a document and operation name
440+
*
441+
* @api
433442
* @param DocumentNode $document
434443
* @param string $operationName
435444
* @return bool

src/Utils/BuildSchema.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@
3333
use GraphQL\Type\Introspection;
3434

3535
/**
36-
* Class BuildSchema
37-
* @package GraphQL\Utils
36+
* Build instance of `GraphQL\Type\Schema` out of type language definition (string or parsed AST)
37+
* See [section in docs](type-system/type-language.md) for details.
3838
*/
3939
class BuildSchema
4040
{
@@ -72,9 +72,10 @@ private function getNamedTypeNode(TypeNode $typeNode)
7272
* If no schema definition is provided, then it will look for types named Query
7373
* and Mutation.
7474
*
75-
* Given that AST it constructs a GraphQLSchema. The resulting schema
75+
* Given that AST it constructs a GraphQL\Type\Schema. The resulting schema
7676
* has no resolve methods, so execution will use default resolvers.
7777
*
78+
* @api
7879
* @param DocumentNode $ast
7980
* @param callable $typeConfigDecorator
8081
* @return Schema
@@ -608,6 +609,7 @@ public function getDescription($node)
608609
* A helper function to build a GraphQLSchema directly from a source
609610
* document.
610611
*
612+
* @api
611613
* @param DocumentNode|Source|string $source
612614
* @param callable $typeConfigDecorator
613615
* @return Schema

src/Utils/SchemaPrinter.php

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,27 @@
1414
use GraphQL\Type\Definition\Directive;
1515

1616
/**
17-
* Class SchemaPrinter
18-
* @package GraphQL\Utils
17+
* Given an instance of Schema, prints it in GraphQL type language.
1918
*/
2019
class SchemaPrinter
2120
{
21+
/**
22+
* @api
23+
* @param Schema $schema
24+
* @return string
25+
*/
2226
public static function doPrint(Schema $schema)
2327
{
2428
return self::printFilteredSchema($schema, function($n) {
2529
return !self::isSpecDirective($n);
2630
}, 'self::isDefinedType');
2731
}
2832

33+
/**
34+
* @api
35+
* @param Schema $schema
36+
* @return string
37+
*/
2938
public static function printIntrosepctionSchema(Schema $schema)
3039
{
3140
return self::printFilteredSchema($schema, [__CLASS__, 'isSpecDirective'], [__CLASS__, 'isIntrospectionType']);

tools/gendocs.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
$entries = [
99
\GraphQL\GraphQL::class,
1010
\GraphQL\Type\Definition\Type::class,
11+
\GraphQL\Type\Definition\ResolveInfo::class,
12+
\GraphQL\Type\Definition\DirectiveLocation::class => ['constants' => true],
1113
\GraphQL\Type\SchemaConfig::class,
1214
\GraphQL\Type\Schema::class,
1315
\GraphQL\Language\Parser::class,
@@ -17,7 +19,6 @@
1719
\GraphQL\Executor\Executor::class,
1820
\GraphQL\Executor\ExecutionResult::class,
1921
\GraphQL\Executor\Promise\PromiseAdapter::class,
20-
\GraphQL\Type\Definition\ResolveInfo::class,
2122
\GraphQL\Validator\DocumentValidator::class,
2223
\GraphQL\Error\Error::class => ['constants' => true, 'methods' => true, 'props' => true],
2324
\GraphQL\Error\Warning::class => ['constants' => true, 'methods' => true],
@@ -27,7 +28,10 @@
2728
\GraphQL\Server\StandardServer::class,
2829
\GraphQL\Server\ServerConfig::class,
2930
\GraphQL\Server\Helper::class,
30-
\GraphQL\Server\OperationParams::class
31+
\GraphQL\Server\OperationParams::class,
32+
\GraphQL\Utils\BuildSchema::class,
33+
\GraphQL\Utils\AST::class,
34+
\GraphQL\Utils\SchemaPrinter::class
3135
];
3236

3337
function renderClassMethod(ReflectionMethod $method) {

0 commit comments

Comments
 (0)