@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | |
29 | 29 | $this->typeSetter = $config['typeSetter'] ?? null; |
30 | 30 | |
31 | - if (! isset($config['type'])) { |
|
31 | + if (!isset($config['type'])) { |
|
32 | 32 | throw new Exception('You must specify a type for your field'); |
33 | 33 | } |
34 | 34 | |
@@ -38,14 +38,14 @@ discard block |
||
38 | 38 | 'result' => [ |
39 | 39 | 'type' => $config['type'], |
40 | 40 | 'description' => 'The payload, if any', |
41 | - 'resolve' => static function ($value) { |
|
41 | + 'resolve' => static function($value) { |
|
42 | 42 | return $value['result'] ?? null; |
43 | 43 | }, |
44 | 44 | ], |
45 | 45 | 'valid' => [ |
46 | 46 | 'type' => Type::nonNull(Type::boolean()), |
47 | 47 | 'description' => 'Whether all validation passed. True for yes, false for no.', |
48 | - 'resolve' => static function ($value) { |
|
48 | + 'resolve' => static function($value) { |
|
49 | 49 | return $value['valid']; |
50 | 50 | }, |
51 | 51 | ], |
@@ -62,17 +62,17 @@ discard block |
||
62 | 62 | 'type' => $type, |
63 | 63 | 'args' => $args, |
64 | 64 | 'name' => $name, |
65 | - 'resolve' => function ($value, $args1, $context, $info) use ($config, $args) { |
|
65 | + 'resolve' => function($value, $args1, $context, $info) use ($config, $args) { |
|
66 | 66 | // validate inputs |
67 | - $config['type'] = new InputObjectType([ |
|
67 | + $config['type'] = new InputObjectType([ |
|
68 | 68 | 'name'=>'', |
69 | 69 | 'fields' => $args, |
70 | 70 | ]); |
71 | 71 | $errors = $this->_validate($config, $args1); |
72 | 72 | $result = $errors; |
73 | - $result['valid'] = ! $errors; |
|
73 | + $result['valid'] = !$errors; |
|
74 | 74 | |
75 | - if (! isset($result['error']) && ! isset($result['suberrors'])) { |
|
75 | + if (!isset($result['error']) && !isset($result['suberrors'])) { |
|
76 | 76 | $result['result'] = $config['resolve']($value, $args1, $context, $info); |
77 | 77 | } |
78 | 78 | |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | $err = $this->_validate($config, $subValue); |
109 | 109 | } |
110 | 110 | |
111 | - if (! $err) { |
|
111 | + if (!$err) { |
|
112 | 112 | continue; |
113 | 113 | } |
114 | 114 |
@@ -30,12 +30,12 @@ |
||
30 | 30 | ], |
31 | 31 | 'validateItem' => function(string $phoneNumber) { |
32 | 32 | $res = preg_match('/^[0-9\-]+$/', $phoneNumber) === 1; |
33 | - return ! $res ? ['invalidPhoneNumber', 'That does not seem to be a valid phone number'] : 0; |
|
33 | + return !$res ? ['invalidPhoneNumber', 'That does not seem to be a valid phone number'] : 0; |
|
34 | 34 | }, |
35 | 35 | 'type' => Type::listOf(Type::string()) |
36 | 36 | ] |
37 | 37 | ], |
38 | - 'resolve' => function ($value, $args) { |
|
38 | + 'resolve' => function($value, $args) { |
|
39 | 39 | // PhoneNumberProvider::setPhoneNumbers($args['phoneNumbers']); |
40 | 40 | return true; |
41 | 41 | }, |
@@ -58,11 +58,11 @@ discard block |
||
58 | 58 | 'validate' => function(string $name) { |
59 | 59 | global $authors; |
60 | 60 | |
61 | - if(strlen($name) > 15) { |
|
61 | + if (strlen($name) > 15) { |
|
62 | 62 | return ['nameTooLong', "Name is too long; please keep it under 15 characters."]; |
63 | 63 | } |
64 | 64 | |
65 | - if(array_search($name, array_column($authors, "name")) !== false) { |
|
65 | + if (array_search($name, array_column($authors, "name")) !== false) { |
|
66 | 66 | return ['nameNotUnique', 'That name is already in use']; |
67 | 67 | } |
68 | 68 | |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | 'invalidAge' |
76 | 76 | ], |
77 | 77 | 'validate' => function(int $age) { |
78 | - if($age <= 0) { |
|
78 | + if ($age <= 0) { |
|
79 | 79 | return ['invalidAge', "Invalid Age; must be positive"]; |
80 | 80 | } |
81 | 81 | |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | 'type' => new AuthorAttributes() |
116 | 116 | ] |
117 | 117 | ], |
118 | - 'resolve' => function ($value, $args) use ($authors) { |
|
118 | + 'resolve' => function($value, $args) use ($authors) { |
|
119 | 119 | $authorId = $args['authorId']; |
120 | 120 | |
121 | 121 | // AuthorProvider::update($authorId, $args['attributes']); |