@@ -98,21 +98,21 @@ discard block |
||
| 98 | 98 | 'friends' => [ |
| 99 | 99 | [ |
| 100 | 100 | 'name' => 'Luke Skywalker', |
| 101 | - 'appearsIn' => ['NEWHOPE', 'EMPIRE', 'JEDI',], |
|
| 101 | + 'appearsIn' => ['NEWHOPE', 'EMPIRE', 'JEDI', ], |
|
| 102 | 102 | 'friends' => [ |
| 103 | - ['name' => 'Han Solo',], |
|
| 104 | - ['name' => 'Leia Organa',], |
|
| 105 | - ['name' => 'C-3PO',], |
|
| 106 | - ['name' => 'R2-D2',], |
|
| 103 | + ['name' => 'Han Solo', ], |
|
| 104 | + ['name' => 'Leia Organa', ], |
|
| 105 | + ['name' => 'C-3PO', ], |
|
| 106 | + ['name' => 'R2-D2', ], |
|
| 107 | 107 | ], |
| 108 | 108 | ], |
| 109 | 109 | [ |
| 110 | 110 | 'name' => 'Han Solo', |
| 111 | 111 | 'appearsIn' => ['NEWHOPE', 'EMPIRE', 'JEDI'], |
| 112 | 112 | 'friends' => [ |
| 113 | - ['name' => 'Luke Skywalker',], |
|
| 113 | + ['name' => 'Luke Skywalker', ], |
|
| 114 | 114 | ['name' => 'Leia Organa'], |
| 115 | - ['name' => 'R2-D2',], |
|
| 115 | + ['name' => 'R2-D2', ], |
|
| 116 | 116 | ] |
| 117 | 117 | ], |
| 118 | 118 | [ |
@@ -120,10 +120,10 @@ discard block |
||
| 120 | 120 | 'appearsIn' => ['NEWHOPE', 'EMPIRE', 'JEDI'], |
| 121 | 121 | 'friends' => |
| 122 | 122 | [ |
| 123 | - ['name' => 'Luke Skywalker',], |
|
| 124 | - ['name' => 'Han Solo',], |
|
| 125 | - ['name' => 'C-3PO',], |
|
| 126 | - ['name' => 'R2-D2',], |
|
| 123 | + ['name' => 'Luke Skywalker', ], |
|
| 124 | + ['name' => 'Han Solo', ], |
|
| 125 | + ['name' => 'C-3PO', ], |
|
| 126 | + ['name' => 'R2-D2', ], |
|
| 127 | 127 | ], |
| 128 | 128 | ], |
| 129 | 129 | ], |
@@ -28,7 +28,7 @@ |
||
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | /** |
| 31 | - * @return Field[]|Query[] |
|
| 31 | + * @return Field[] |
|
| 32 | 32 | */ |
| 33 | 33 | public function getFields() |
| 34 | 34 | { |
@@ -44,7 +44,7 @@ |
||
| 44 | 44 | */ |
| 45 | 45 | public function isValidValue($value) |
| 46 | 46 | { |
| 47 | - return in_array($value, array_map(function ($item) { return $item['value']; }, $this->getConfig()->get('values'))); |
|
| 47 | + return in_array($value, array_map(function($item) { return $item['value']; }, $this->getConfig()->get('values'))); |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | abstract public function getValues(); |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | ->addField('kind', TypeMap::TYPE_STRING) |
| 46 | 46 | ->addField('description', TypeMap::TYPE_STRING) |
| 47 | 47 | ->addField('ofType', new QueryType(), [ |
| 48 | - 'resolve' => function ($value) { |
|
| 48 | + 'resolve' => function($value) { |
|
| 49 | 49 | if ($value->getKind() == TypeMap::KIND_LIST) { |
| 50 | 50 | return $value->getConfig()->getItem(); |
| 51 | 51 | } |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | ->addField('fields', new FieldListType()) |
| 59 | 59 | ->addField('interfaces', new InterfaceListType()) |
| 60 | 60 | ->addField('possibleTypes', new ListType(new QueryType()), [ |
| 61 | - 'resolve' => function ($value) { |
|
| 61 | + 'resolve' => function($value) { |
|
| 62 | 62 | if ($value) { |
| 63 | 63 | if ($value->getKind() == TypeMap::KIND_INTERFACE) { |
| 64 | 64 | $this->collectTypes(SchemaType::$schema->getQueryType()); |
@@ -20,16 +20,16 @@ discard block |
||
| 20 | 20 | foreach (TypeMap::getScalarTypes() as $typeName) { |
| 21 | 21 | $typeName = ucfirst($typeName); |
| 22 | 22 | if ($typeName == 'Datetime') { |
| 23 | - $className = 'Youshido\GraphQL\Type\Scalar\DateTimeType';// : ; |
|
| 23 | + $className = 'Youshido\GraphQL\Type\Scalar\DateTimeType'; // : ; |
|
| 24 | 24 | } elseif ($typeName == 'Datetimetz') { |
| 25 | 25 | $className = 'Youshido\GraphQL\Type\Scalar\DateTimeTzType'; |
| 26 | 26 | } else { |
| 27 | - $className = 'Youshido\GraphQL\Type\Scalar\\' . ucfirst($typeName) . 'Type'; |
|
| 27 | + $className = 'Youshido\GraphQL\Type\Scalar\\'.ucfirst($typeName).'Type'; |
|
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | /** @var TypeInterface $object */ |
| 31 | 31 | $object = new $className(); |
| 32 | - $testDataMethod = 'get' . $typeName . 'TestData'; |
|
| 32 | + $testDataMethod = 'get'.$typeName.'TestData'; |
|
| 33 | 33 | $this->checkDescription($object); |
| 34 | 34 | |
| 35 | 35 | foreach (call_user_func(['Youshido\Tests\DataProvider\TestScalarDataProvider', $testDataMethod]) as list($data, $serialized, $isValid)) { |
@@ -37,9 +37,9 @@ discard block |
||
| 37 | 37 | $this->checkSerialization($object, $data, $serialized); |
| 38 | 38 | |
| 39 | 39 | if ($isValid) { |
| 40 | - $this->assertTrue($object->isValidValue($data), $typeName . ' validation for :' . serialize($data)); |
|
| 40 | + $this->assertTrue($object->isValidValue($data), $typeName.' validation for :'.serialize($data)); |
|
| 41 | 41 | } else { |
| 42 | - $this->assertFalse($object->isValidValue($data), $typeName . ' validation for :' . serialize($data)); |
|
| 42 | + $this->assertFalse($object->isValidValue($data), $typeName.' validation for :'.serialize($data)); |
|
| 43 | 43 | } |
| 44 | 44 | } |
| 45 | 45 | } |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | |
| 53 | 53 | private function checkSerialization(TypeInterface $object, $input, $expected) |
| 54 | 54 | { |
| 55 | - $this->assertEquals($expected, $object->serialize($input), $object->getName() . ' serialize for: ' . serialize($input)); |
|
| 55 | + $this->assertEquals($expected, $object->serialize($input), $object->getName().' serialize for: '.serialize($input)); |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | } |
@@ -28,7 +28,7 @@ |
||
| 28 | 28 | public function addArgument($name, $type, $config = []) |
| 29 | 29 | { |
| 30 | 30 | if (!TypeMap::isInputType($type)) { |
| 31 | - throw new ConfigurationException('Argument input type ' . $type . ' is not supported'); |
|
| 31 | + throw new ConfigurationException('Argument input type '.$type.' is not supported'); |
|
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | $config['name'] = $name; |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | $this->data = $configData; |
| 52 | 52 | $this->validator = new ConfigValidator($contextObject); |
| 53 | 53 | if (!$this->validator->validate($this->data, $this->getRules())) { |
| 54 | - throw new ConfigurationException('Config is not valid for ' . get_class($contextObject) . "\n" . implode("\n", $this->validator->getErrorsArray(false))); |
|
| 54 | + throw new ConfigurationException('Config is not valid for '.get_class($contextObject)."\n".implode("\n", $this->validator->getErrorsArray(false))); |
|
| 55 | 55 | } |
| 56 | 56 | $this->build(); |
| 57 | 57 | } |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | return $this->get($propertyName); |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | - throw new \Exception('Call to undefined method ' . $method); |
|
| 99 | + throw new \Exception('Call to undefined method '.$method); |
|
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | |
@@ -76,7 +76,7 @@ |
||
| 76 | 76 | $name = $name == 'Datetime' ? 'DateTime' : $name; |
| 77 | 77 | $name = $name == 'Datetimetz' ? 'DateTimeTz' : $name; |
| 78 | 78 | |
| 79 | - $className = 'Youshido\GraphQL\Type\Scalar\\' . $name . 'Type'; |
|
| 79 | + $className = 'Youshido\GraphQL\Type\Scalar\\'.$name.'Type'; |
|
| 80 | 80 | self::$scalarObjectsCache[$type] = new $className(); |
| 81 | 81 | } |
| 82 | 82 | |
@@ -1,7 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | namespace BlogTest; |
| 3 | 3 | |
| 4 | -use Youshido\GraphQL\Type\NonNullType; |
|
| 5 | 4 | use Youshido\GraphQL\Type\Object\ObjectType; |
| 6 | 5 | use Youshido\GraphQL\Type\Scalar\BooleanType; |
| 7 | 6 | use Youshido\GraphQL\Type\Scalar\IntType; |
@@ -17,16 +17,16 @@ discard block |
||
| 17 | 17 | 'fields' => [ |
| 18 | 18 | // here you have a complex field with a lot of options |
| 19 | 19 | 'title' => [ |
| 20 | - 'type' => new StringType(), // string type |
|
| 21 | - 'description' => 'This field contains a post title', // description |
|
| 22 | - 'isDeprecated' => true, // marked as deprecated |
|
| 23 | - 'deprecationReason' => 'field title is now deprecated', // explain the reason |
|
| 20 | + 'type' => new StringType(), // string type |
|
| 21 | + 'description' => 'This field contains a post title', // description |
|
| 22 | + 'isDeprecated' => true, // marked as deprecated |
|
| 23 | + 'deprecationReason' => 'field title is now deprecated', // explain the reason |
|
| 24 | 24 | 'args' => [ |
| 25 | 25 | 'truncated' => new BooleanType() // add an optional argument |
| 26 | 26 | ], |
| 27 | - 'resolve' => function ($value, $args) { |
|
| 27 | + 'resolve' => function($value, $args) { |
|
| 28 | 28 | // used argument to modify a field value |
| 29 | - return (!empty($args['truncated'])) ? explode(' ', $value)[0] . '...' : $value; |
|
| 29 | + return (!empty($args['truncated'])) ? explode(' ', $value)[0].'...' : $value; |
|
| 30 | 30 | } |
| 31 | 31 | ], |
| 32 | 32 | // if field just has a type, you can use a short declaration syntax like this |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | 'id' => new IntType() |
| 39 | 39 | ], |
| 40 | 40 | // resolve function for the query |
| 41 | - 'resolve' => function ($value, $args, $type) { |
|
| 41 | + 'resolve' => function($value, $args, $type) { |
|
| 42 | 42 | return [ |
| 43 | 43 | 'title' => 'Title for the latest Post', |
| 44 | 44 | 'summary' => 'Post summary', |