@@ -50,6 +50,9 @@ |
||
| 50 | 50 | return $value; |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | + /** |
|
| 54 | + * @param null|Scalar\StringType $value |
|
| 55 | + */ |
|
| 53 | 56 | public function isValidValue($value) |
| 54 | 57 | { |
| 55 | 58 | return $value !== null; |
@@ -57,7 +57,7 @@ |
||
| 57 | 57 | * @param Field $objField |
| 58 | 58 | * @param AbstractInterfaceType $interface |
| 59 | 59 | * |
| 60 | - * @return bool |
|
| 60 | + * @return boolean|null |
|
| 61 | 61 | * |
| 62 | 62 | * @throws ConfigurationException |
| 63 | 63 | */ |
@@ -16,13 +16,16 @@ |
||
| 16 | 16 | { |
| 17 | 17 | |
| 18 | 18 | /** |
| 19 | - * @return AbstractObjectType |
|
| 19 | + * @return IntType |
|
| 20 | 20 | */ |
| 21 | 21 | public function getType() |
| 22 | 22 | { |
| 23 | 23 | return new IntType(); |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | + /** |
|
| 27 | + * @param string $value |
|
| 28 | + */ |
|
| 26 | 29 | public function resolve($value, array $args, ResolveInfo $info) |
| 27 | 30 | { |
| 28 | 31 | return $value; |
@@ -16,7 +16,7 @@ |
||
| 16 | 16 | { |
| 17 | 17 | |
| 18 | 18 | /** |
| 19 | - * @return AbstractInputObjectType |
|
| 19 | + * @return IntType |
|
| 20 | 20 | */ |
| 21 | 21 | public function getType() |
| 22 | 22 | { |
@@ -9,7 +9,6 @@ |
||
| 9 | 9 | |
| 10 | 10 | |
| 11 | 11 | use Youshido\GraphQL\Field\Field; |
| 12 | -use Youshido\GraphQL\Field\FieldFactory; |
|
| 13 | 12 | use Youshido\GraphQL\Type\Object\AbstractObjectType; |
| 14 | 13 | use Youshido\GraphQL\Type\Scalar\IdType; |
| 15 | 14 | |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | 'args' => [ |
| 37 | 37 | 'episode' => ['type' => new EpisodeEnum()] |
| 38 | 38 | ], |
| 39 | - 'resolve' => function ($root, $args) { |
|
| 39 | + 'resolve' => function($root, $args) { |
|
| 40 | 40 | return StarWarsData::getHero(isset($args['episode']) ? $args['episode'] : null); |
| 41 | 41 | }, |
| 42 | 42 | ]) |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | 'args' => [ |
| 47 | 47 | 'id' => new IdType() |
| 48 | 48 | ], |
| 49 | - 'resolve' => function ($value = null, $args = []) { |
|
| 49 | + 'resolve' => function($value = null, $args = []) { |
|
| 50 | 50 | $humans = StarWarsData::humans(); |
| 51 | 51 | |
| 52 | 52 | return isset($humans[$args['id']]) ? $humans[$args['id']] : null; |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | 'args' => [ |
| 59 | 59 | 'id' => new IdType() |
| 60 | 60 | ], |
| 61 | - 'resolve' => function ($value = null, $args = []) { |
|
| 61 | + 'resolve' => function($value = null, $args = []) { |
|
| 62 | 62 | $droids = StarWarsData::droids(); |
| 63 | 63 | |
| 64 | 64 | return isset($droids[$args['id']]) ? $droids[$args['id']] : null; |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | 'fields' => [ |
| 27 | 27 | 'currentTime' => [ |
| 28 | 28 | 'type' => new StringType(), |
| 29 | - 'resolve' => function ($value, $args, $type) { |
|
| 29 | + 'resolve' => function($value, $args, $type) { |
|
| 30 | 30 | return 'May 5, 9:00am'; |
| 31 | 31 | }, |
| 32 | 32 | 'args' => [ |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | |
| 56 | 56 | $this->assertEquals(1, count($schema->getMutationType()->getFields())); |
| 57 | 57 | |
| 58 | - $schema->addMutationField('changeUser', ['type' => new TestObjectType(), 'resolve' => function () { }]); |
|
| 58 | + $schema->addMutationField('changeUser', ['type' => new TestObjectType(), 'resolve' => function() { }]); |
|
| 59 | 59 | $this->assertEquals(2, count($schema->getMutationType()->getFields())); |
| 60 | 60 | |
| 61 | 61 | } |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | { |
| 23 | 23 | foreach (TypeFactory::getScalarTypesNames() as $typeName) { |
| 24 | 24 | $scalarType = TypeFactory::getScalarType($typeName); |
| 25 | - $testDataMethod = 'get' . $typeName . 'TestData'; |
|
| 25 | + $testDataMethod = 'get'.$typeName.'TestData'; |
|
| 26 | 26 | |
| 27 | 27 | $this->assertNotEmpty($scalarType->getDescription()); |
| 28 | 28 | $this->assertEquals($scalarType->getKind(), TypeMap::KIND_SCALAR); |
@@ -38,9 +38,9 @@ discard block |
||
| 38 | 38 | $this->assertParse($scalarType, $data, $serialized); |
| 39 | 39 | |
| 40 | 40 | if ($isValid) { |
| 41 | - $this->assertTrue($scalarType->isValidValue($data), $typeName . ' validation for :' . serialize($data)); |
|
| 41 | + $this->assertTrue($scalarType->isValidValue($data), $typeName.' validation for :'.serialize($data)); |
|
| 42 | 42 | } else { |
| 43 | - $this->assertFalse($scalarType->isValidValue($data), $typeName . ' validation for :' . serialize($data)); |
|
| 43 | + $this->assertFalse($scalarType->isValidValue($data), $typeName.' validation for :'.serialize($data)); |
|
| 44 | 44 | } |
| 45 | 45 | } |
| 46 | 46 | } |
@@ -52,12 +52,12 @@ discard block |
||
| 52 | 52 | |
| 53 | 53 | private function assertSerialization(AbstractScalarType $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 | private function assertParse(AbstractScalarType $object, $input, $expected) |
| 59 | 59 | { |
| 60 | - $this->assertEquals($expected, $object->parseValue($input), $object->getName() . ' serialize for: ' . serialize($input)); |
|
| 60 | + $this->assertEquals($expected, $object->parseValue($input), $object->getName().' serialize for: '.serialize($input)); |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | } |
@@ -43,7 +43,7 @@ |
||
| 43 | 43 | 'fields' => [ |
| 44 | 44 | 'name' => new StringType() |
| 45 | 45 | ], |
| 46 | - 'resolveType' => function ($object) { |
|
| 46 | + 'resolveType' => function($object) { |
|
| 47 | 47 | return $object; |
| 48 | 48 | } |
| 49 | 49 | ]); |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | new TestObjectType(), |
| 33 | 33 | $object |
| 34 | 34 | ], |
| 35 | - 'resolveType' => function ($type) { |
|
| 35 | + 'resolveType' => function($type) { |
|
| 36 | 36 | return $type; |
| 37 | 37 | } |
| 38 | 38 | ]); |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | 'types' => [ |
| 68 | 68 | 'test', new IntType() |
| 69 | 69 | ], |
| 70 | - 'resolveType' => function ($type) { |
|
| 70 | + 'resolveType' => function($type) { |
|
| 71 | 71 | return $type; |
| 72 | 72 | } |
| 73 | 73 | ]); |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | 'types' => [ |
| 85 | 85 | new IntType() |
| 86 | 86 | ], |
| 87 | - 'resolveType' => function ($type) { |
|
| 87 | + 'resolveType' => function($type) { |
|
| 88 | 88 | return $type; |
| 89 | 89 | } |
| 90 | 90 | ]); |