Skip to content

Commit 01a05b6

Browse files
committed
improve code readability
1 parent 9814442 commit 01a05b6

File tree

99 files changed

+250
-388
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

99 files changed

+250
-388
lines changed

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ use GraphQL\Schemas\Schema;
2929
use GraphQL\Types\GraphQLString;
3030
use GraphQL\Types\GraphQLObjectType;
3131
use GraphQL\Fields\GraphQLTypeField;
32-
use GraphQL\Arguments\GraphQLFieldArgument;
3332

3433
// build the query type
3534
$QueryType = new GraphQLObjectType("Query", "Root Query", function (){

docs/schema-definition.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ The schema is a container for your type hierarchy that accepts object types as r
1010
It is passed to the validator and the executor and used to model your underlying data structures.
1111

1212
````php
13-
use GraphQL\Servers\Server;
13+
1414

1515
$schema = new Schema(
1616
$QueryType,

docs/types/object-types.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ $bookType = new GraphQLObjectType("Book", "The Book Type", function () use (&$au
2626
"name",
2727
new GraphQLString(),
2828
"Name of the Book",
29-
function ($parent, $args, &$context) {
29+
function ($parent, $args, $context) {
3030
return ($args["prefix"] ?? "") . $parent["name"] . ($context["addOn"] ?? "");
3131
},
3232
[

docs/types/scalars.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,14 @@ class MyCustomStringType extends GraphQLScalarType
4949
{
5050
if (!is_string($outputValue) and $outputValue !== null) {
5151
throw new GraphQLError(
52-
"Value \"{$outputValue}\" is not of type \"{$this->getName()}\"."
52+
"Value \"$outputValue\" is not of type \"{$this->getName()}\"."
5353
);
5454
}
5555
return $outputValue;
5656
}
5757

5858
/**
59-
* Parses an externally provided value (query variable) to use as an input
59+
* Parses an externally provided literal value (hardcoded in GraphQL query) to use as an input.
6060
*
6161
* @param $valueNode
6262
* @param $variables
@@ -75,7 +75,7 @@ class MyCustomStringType extends GraphQLScalarType
7575
}
7676

7777
/**
78-
* Parses an externally provided literal value (hardcoded in GraphQL query) to use as an input.
78+
* Parses an externally provided value (query variable) to use as an input
7979
*
8080
* @param $value
8181
* @return string|null
@@ -85,7 +85,7 @@ class MyCustomStringType extends GraphQLScalarType
8585
{
8686
if (!is_string($value) and $value !== null) {
8787
throw new GraphQLError(
88-
"Value \"{$value}\" is not of type \"{$this->getName()}\"."
88+
"Value \"$value\" is not of type \"{$this->getName()}\"."
8989
);
9090
}
9191
return $value;

examples/books/__data.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,3 @@
1515
["id" => 2, "name" => 'J. R. R. Tolkien'],
1616
["id" => 3, "name" => 'Brent Weeks']
1717
];
18-
?>

examples/books/__schema.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"name",
2626
new GraphQLString(),
2727
"Name of the Book",
28-
function ($parent, $args, &$context) {
28+
function ($parent, $args, $context) {
2929
return ($args["prefix"] ?? "") . $parent["name"] . ($context["addOn"] ?? "");
3030
},
3131
[
@@ -191,4 +191,3 @@ function ($_, $args) use (&$books) {
191191
)
192192
];
193193
});
194-
?>

examples/books/index.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,3 @@
2020
$server = new Server($schema);
2121
$server->setInternalServerErrorPrint(true);
2222
$server->listen();
23-
?>

examples/parser/index.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
// include the php-graphql-autoloader
66
require '../../src/autoloader.php';
77

8-
use \GraphQL\Parser\Parser;
8+
use GraphQL\Errors\GraphQLError;
9+
use GraphQL\Parser\Parser;
910

1011
$parser = new Parser();
1112
$query = '
@@ -90,8 +91,7 @@ enumValues(includeDeprecated: true) {
9091

9192
try {
9293
echo json_encode($parser->parse($query));
93-
} catch (\GraphQL\Errors\GraphQLError $e) {
94+
} catch (GraphQLError $e) {
9495
var_dump($e->getMessage(), $e->getLocations());
9596
}
9697

97-
?>

examples/starwars/index.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,3 @@
1919
$server = new Server($schema);
2020
$server->setInternalServerErrorPrint(true);
2121
$server->listen();
22-
?>

src/Arguments/GraphQLDirectiveArgument.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
namespace GraphQL\Arguments;
44

5-
use GraphQL\Types\GraphQLType;
6-
75
class GraphQLDirectiveArgument extends GraphQLArgument
86
{
97

0 commit comments

Comments
 (0)