@@ -24,8 +24,8 @@ |
||
24 | 24 | public function getDescription() |
25 | 25 | { |
26 | 26 | return 'The `Float` scalar type represents signed double-precision fractional ' . |
27 | - 'values as specified by ' . |
|
28 | - '[IEEE 754](http://en.wikipedia.org/wiki/IEEE_floating_point).'; |
|
27 | + 'values as specified by ' . |
|
28 | + '[IEEE 754](http://en.wikipedia.org/wiki/IEEE_floating_point).'; |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | } |
32 | 32 | \ No newline at end of file |
@@ -23,8 +23,8 @@ |
||
23 | 23 | |
24 | 24 | public function getDescription() |
25 | 25 | { |
26 | - return 'The `Float` scalar type represents signed double-precision fractional ' . |
|
27 | - 'values as specified by ' . |
|
26 | + return 'The `Float` scalar type represents signed double-precision fractional '. |
|
27 | + 'values as specified by '. |
|
28 | 28 | '[IEEE 754](http://en.wikipedia.org/wiki/IEEE_floating_point).'; |
29 | 29 | } |
30 | 30 |
@@ -26,9 +26,9 @@ |
||
26 | 26 | public function getDescription() |
27 | 27 | { |
28 | 28 | return 'The `Int` scalar type represents non-fractional signed whole numeric ' . |
29 | - 'values. Int can represent values between -(2^53 - 1) and 2^53 - 1 since ' . |
|
30 | - 'represented in JSON as double-precision floating point numbers specified' . |
|
31 | - 'by [IEEE 754](http://en.wikipedia.org/wiki/IEEE_floating_point).'; |
|
29 | + 'values. Int can represent values between -(2^53 - 1) and 2^53 - 1 since ' . |
|
30 | + 'represented in JSON as double-precision floating point numbers specified' . |
|
31 | + 'by [IEEE 754](http://en.wikipedia.org/wiki/IEEE_floating_point).'; |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | } |
35 | 35 | \ No newline at end of file |
@@ -29,9 +29,9 @@ |
||
29 | 29 | |
30 | 30 | public function getDescription() |
31 | 31 | { |
32 | - return 'The `Int` scalar type represents non-fractional signed whole numeric ' . |
|
33 | - 'values. Int can represent values between -(2^53 - 1) and 2^53 - 1 since ' . |
|
34 | - 'represented in JSON as double-precision floating point numbers specified' . |
|
32 | + return 'The `Int` scalar type represents non-fractional signed whole numeric '. |
|
33 | + 'values. Int can represent values between -(2^53 - 1) and 2^53 - 1 since '. |
|
34 | + 'represented in JSON as double-precision floating point numbers specified'. |
|
35 | 35 | 'by [IEEE 754](http://en.wikipedia.org/wiki/IEEE_floating_point).'; |
36 | 36 | } |
37 | 37 |
@@ -37,8 +37,8 @@ |
||
37 | 37 | public function getDescription() |
38 | 38 | { |
39 | 39 | return 'The `String` scalar type represents textual data, represented as UTF-8 ' . |
40 | - 'character sequences. The String type is most often used by GraphQL to ' . |
|
41 | - 'represent free-form human-readable text.'; |
|
40 | + 'character sequences. The String type is most often used by GraphQL to ' . |
|
41 | + 'represent free-form human-readable text.'; |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | } |
45 | 45 | \ No newline at end of file |
@@ -36,8 +36,8 @@ |
||
36 | 36 | |
37 | 37 | public function getDescription() |
38 | 38 | { |
39 | - return 'The `String` scalar type represents textual data, represented as UTF-8 ' . |
|
40 | - 'character sequences. The String type is most often used by GraphQL to ' . |
|
39 | + return 'The `String` scalar type represents textual data, represented as UTF-8 '. |
|
40 | + 'character sequences. The String type is most often used by GraphQL to '. |
|
41 | 41 | 'represent free-form human-readable text.'; |
42 | 42 | } |
43 | 43 |
@@ -36,7 +36,9 @@ |
||
36 | 36 | |
37 | 37 | public function validate($data, $rules = [], $extraFieldsAllowed = null) |
38 | 38 | { |
39 | - if ($extraFieldsAllowed !== null) $this->setExtraFieldsAllowed($extraFieldsAllowed); |
|
39 | + if ($extraFieldsAllowed !== null) { |
|
40 | + $this->setExtraFieldsAllowed($extraFieldsAllowed); |
|
41 | + } |
|
40 | 42 | |
41 | 43 | $processedFields = []; |
42 | 44 | foreach ($rules as $fieldName => $fieldRules) { |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | if (array_key_exists('required', $fieldRules)) { |
47 | 47 | unset($fieldRules['required']); |
48 | 48 | if (!array_key_exists($fieldName, $data)) { |
49 | - $this->addError(new ValidationException('Field \'' . $fieldName . '\' of ' . $this->getContextName() . ' is required')); |
|
49 | + $this->addError(new ValidationException('Field \''.$fieldName.'\' of '.$this->getContextName().' is required')); |
|
50 | 50 | continue; |
51 | 51 | } |
52 | 52 | } elseif (!array_key_exists($fieldName, $data)) { |
@@ -56,14 +56,14 @@ discard block |
||
56 | 56 | /** Validation of all other rules*/ |
57 | 57 | foreach ($fieldRules as $ruleName => $ruleInfo) { |
58 | 58 | if (!array_key_exists($ruleName, $this->validationRules)) { |
59 | - $this->addError(new ValidationException('Field \'' . $fieldName . '\' has invalid rule \'' . $ruleInfo . '\'')); |
|
59 | + $this->addError(new ValidationException('Field \''.$fieldName.'\' has invalid rule \''.$ruleInfo.'\'')); |
|
60 | 60 | continue; |
61 | 61 | } |
62 | 62 | |
63 | 63 | if (!$this->validationRules[$ruleName]->validate($data[$fieldName], $ruleInfo)) { |
64 | 64 | $this->addError( |
65 | - new ValidationException('Field \'' . $fieldName . '\' of ' . $this->getContextName() |
|
66 | - . ' expected to be ' . $ruleName . ': \'' . (string)$ruleInfo . '\', but got: ' . gettype($data[$fieldName]))); |
|
65 | + new ValidationException('Field \''.$fieldName.'\' of '.$this->getContextName() |
|
66 | + . ' expected to be '.$ruleName.': \''.(string)$ruleInfo.'\', but got: '.gettype($data[$fieldName]))); |
|
67 | 67 | } |
68 | 68 | } |
69 | 69 | } |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | foreach (array_keys($data) as $fieldName) { |
73 | 73 | if (!in_array($fieldName, $processedFields)) { |
74 | 74 | $this->addError( |
75 | - new ValidationException('Field \'' . $fieldName . '\' is not expected in ' . $this->getContextName())); |
|
75 | + new ValidationException('Field \''.$fieldName.'\' is not expected in '.$this->getContextName())); |
|
76 | 76 | |
77 | 77 | } |
78 | 78 | } |
@@ -24,9 +24,9 @@ |
||
24 | 24 | public function getDescription() |
25 | 25 | { |
26 | 26 | return 'The `ID` scalar type represents a unique identifier, often used to ' . |
27 | - 'refetch an object or as key for a cache. The ID type appears in a JSON ' . |
|
28 | - 'response as a String; however, it is not intended to be human-readable. ' . |
|
29 | - 'When expected as an input type, any string (such as `"4"`) or integer ' . |
|
30 | - '(such as `4`) input value will be accepted as an ID.'; |
|
27 | + 'refetch an object or as key for a cache. The ID type appears in a JSON ' . |
|
28 | + 'response as a String; however, it is not intended to be human-readable. ' . |
|
29 | + 'When expected as an input type, any string (such as `"4"`) or integer ' . |
|
30 | + '(such as `4`) input value will be accepted as an ID.'; |
|
31 | 31 | } |
32 | 32 | } |
33 | 33 | \ No newline at end of file |
@@ -23,10 +23,10 @@ |
||
23 | 23 | |
24 | 24 | public function getDescription() |
25 | 25 | { |
26 | - return 'The `ID` scalar type represents a unique identifier, often used to ' . |
|
27 | - 'refetch an object or as key for a cache. The ID type appears in a JSON ' . |
|
28 | - 'response as a String; however, it is not intended to be human-readable. ' . |
|
29 | - 'When expected as an input type, any string (such as `"4"`) or integer ' . |
|
26 | + return 'The `ID` scalar type represents a unique identifier, often used to '. |
|
27 | + 'refetch an object or as key for a cache. The ID type appears in a JSON '. |
|
28 | + 'response as a String; however, it is not intended to be human-readable. '. |
|
29 | + 'When expected as an input type, any string (such as `"4"`) or integer '. |
|
30 | 30 | '(such as `4`) input value will be accepted as an ID.'; |
31 | 31 | } |
32 | 32 | } |
33 | 33 | \ No newline at end of file |
@@ -37,7 +37,7 @@ |
||
37 | 37 | return false; |
38 | 38 | } |
39 | 39 | |
40 | - $requiredFields = array_filter($this->getConfig()->getFields(), function (Field $field) { |
|
40 | + $requiredFields = array_filter($this->getConfig()->getFields(), function(Field $field) { |
|
41 | 41 | return $field->getConfig()->isRequired(); |
42 | 42 | }); |
43 | 43 |
@@ -61,7 +61,7 @@ |
||
61 | 61 | } |
62 | 62 | |
63 | 63 | /** |
64 | - * @return Field[]|Query[] |
|
64 | + * @return Query[] |
|
65 | 65 | */ |
66 | 66 | public function getFields() |
67 | 67 | { |
@@ -61,7 +61,7 @@ |
||
61 | 61 | } |
62 | 62 | |
63 | 63 | /** |
64 | - * @return Field[]|Query[] |
|
64 | + * @return Query[] |
|
65 | 65 | */ |
66 | 66 | public function getFields() |
67 | 67 | { |
@@ -31,7 +31,7 @@ |
||
31 | 31 | ->addField('friends', new ListType([ |
32 | 32 | 'item' => new CharacterInterface() |
33 | 33 | ]), [ |
34 | - 'resolve' => function ($droid) { |
|
34 | + 'resolve' => function($droid) { |
|
35 | 35 | return StarWarsData::getFriends($droid); |
36 | 36 | }, |
37 | 37 | ]) |