Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .styleci.yml
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
preset: symfony
enabled:
- ordered_use
- short_array_syntax

disabled:
- unalign_equals
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ php:
- hhvm

branches:
only:
- master
- /^\d+\.\d+$/
only:
- master
- /^\d+\.\d+$/

matrix:
fast_finish: true
Expand Down
21 changes: 4 additions & 17 deletions Definition/Argument.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,13 @@
class Argument implements \ArrayAccess, \Countable
{
/**
* @var array|\ArrayAccess
* @var array
*/
private $arguments = [];
private $arguments;

public function __construct($arguments)
public function __construct(array $arguments = null)
{
if (!is_array($arguments) && !$arguments instanceof \ArrayAccess) {
$arguments = [$arguments];
}
$this->arguments = $arguments;
$this->arguments = null === $arguments ? [] : $arguments;
}

public function offsetExists($offset)
Expand All @@ -46,16 +43,6 @@ public function offsetUnset($offset)
unset($this->arguments[$offset]);
}

public function __get($key)
{
return $this->offsetGet($key);
}

public function __set($key, $value)
{
$this->offsetSet($key, $value);
}

public function getRawArguments()
{
return $this->arguments;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
* file that was distributed with this source code.
*/

namespace Overblog\GraphQLBundle\Definition;
namespace Overblog\GraphQLBundle\Definition\Builder;

interface ArgsInterface
interface MappingInterface
{
/**
* @param array $config
*
* @return array
*/
public function toArgsDefinition(array $config);
public function toMappingDefinition(array $config);
}
2 changes: 1 addition & 1 deletion Definition/Builder/TypeBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ private function getBaseClassName($type)
break;

default:
throw new \RuntimeException(sprintf('Type "%s" is not managed.'), $type);
throw new \RuntimeException(sprintf('Type "%s" is not managed.', $type));
}

return $class;
Expand Down
2 changes: 1 addition & 1 deletion Definition/MergeFieldTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ protected function getFieldsWithDefaults($fields, array $defaultFields, $forceAr
}

if (!is_array($fields)) {
$fields = [$fields];
$fields = (array) $fields;
}

return array_merge($fields, $defaultFields);
Expand Down
2 changes: 1 addition & 1 deletion DependencyInjection/OverblogGraphQLExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@
use Symfony\Component\Config\Util\XmlUtils;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\Finder\Finder;
use Symfony\Component\Finder\SplFileInfo;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
use Symfony\Component\Yaml\Exception\ParseException;
use Symfony\Component\Yaml\Parser as YamlParser;

Expand Down
6 changes: 3 additions & 3 deletions DependencyInjection/TypesConfiguration.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,18 +130,18 @@ private function addFieldsSelection($name, $enabledBuilder = true)
->prototype('array')
->beforeNormalization()
->ifString()
->then(function ($v) { return array('builder' => $v); })
->then(function ($v) { return ['builder' => $v]; })
->end()
->children()
->append($this->addTypeSelection())
->arrayNode('argsBuilder')
->info('Use to build dynamic args. Can be combine with args.')
->beforeNormalization()
->ifString()
->then(function ($v) { return array('name' => $v); })
->then(function ($v) { return ['builder' => $v]; })
->end()
->children()
->scalarNode('name')
->scalarNode('builder')
->info('Service alias tagged with "overblog_graphql.arg"')
->isRequired()
->end()
Expand Down
2 changes: 1 addition & 1 deletion Error/ErrorHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function __construct($internalErrorMessage = null, LoggerInterface $logge

/**
* @param Error[] $errors
* @param $throwRawException
* @param bool $throwRawException
*
* @return Error[]
*
Expand Down
2 changes: 1 addition & 1 deletion OverblogGraphQLBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
use Overblog\GraphQLBundle\DependencyInjection\Compiler\ResolverPass;
use Overblog\GraphQLBundle\DependencyInjection\Compiler\TypePass;
use Overblog\GraphQLBundle\DependencyInjection\OverblogGraphQLExtension;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Extension\ExtensionInterface;
use Symfony\Component\HttpKernel\Bundle\Bundle;
use Symfony\Component\DependencyInjection\ContainerBuilder;

class OverblogGraphQLBundle extends Bundle
{
Expand Down
6 changes: 3 additions & 3 deletions Relay/Connection/BackwardConnectionArgs.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@
namespace Overblog\GraphQLBundle\Relay\Connection;

use GraphQL\Type\Definition\Type;
use Overblog\GraphQLBundle\Definition\ArgsInterface;
use Overblog\GraphQLBundle\Definition\Builder\MappingInterface;

class BackwardConnectionArgs implements ArgsInterface
class BackwardConnectionArgs implements MappingInterface
{
/**
* @param array $config
*
* @return array
*/
public function toArgsDefinition(array $config)
public function toMappingDefinition(array $config)
{
return [
'before' => [
Expand Down
6 changes: 3 additions & 3 deletions Relay/Connection/ConnectionArgs.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@
namespace Overblog\GraphQLBundle\Relay\Connection;

use GraphQL\Type\Definition\Type;
use Overblog\GraphQLBundle\Definition\ArgsInterface;
use Overblog\GraphQLBundle\Definition\Builder\MappingInterface;

class ConnectionArgs implements ArgsInterface
class ConnectionArgs implements MappingInterface
{
/**
* @param array $config
*
* @return array
*/
public function toArgsDefinition(array $config)
public function toMappingDefinition(array $config)
{
return [
'after' => [
Expand Down
4 changes: 2 additions & 2 deletions Relay/Connection/ConnectionType.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@

namespace Overblog\GraphQLBundle\Relay\Connection;

use GraphQL\Type\Definition\ObjectType;
use GraphQL\Type\Definition\Config;
use GraphQL\Type\Definition\Type;
use GraphQL\Type\Definition\FieldDefinition;
use GraphQL\Type\Definition\ObjectType;
use GraphQL\Type\Definition\Type;
use GraphQL\Utils;
use Overblog\GraphQLBundle\Definition\MergeFieldTrait;

Expand Down
6 changes: 3 additions & 3 deletions Relay/Connection/ForwardConnectionArgs.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@
namespace Overblog\GraphQLBundle\Relay\Connection;

use GraphQL\Type\Definition\Type;
use Overblog\GraphQLBundle\Definition\ArgsInterface;
use Overblog\GraphQLBundle\Definition\Builder\MappingInterface;

class ForwardConnectionArgs implements ArgsInterface
class ForwardConnectionArgs implements MappingInterface
{
/**
* @param array $config
*
* @return array
*/
public function toArgsDefinition(array $config)
public function toMappingDefinition(array $config)
{
return [
'after' => [
Expand Down
2 changes: 1 addition & 1 deletion Relay/Mutation/InputType.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@

namespace Overblog\GraphQLBundle\Relay\Mutation;

use GraphQL\Type\Definition\InputObjectType;
use GraphQL\Type\Definition\Config;
use GraphQL\Type\Definition\FieldDefinition;
use GraphQL\Type\Definition\InputObjectType;
use GraphQL\Type\Definition\Type;
use GraphQL\Utils;
use Overblog\GraphQLBundle\Definition\MergeFieldTrait;
Expand Down
6 changes: 3 additions & 3 deletions Relay/Mutation/MutationField.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@
use GraphQL\Type\Definition\Config;
use GraphQL\Type\Definition\Type;
use GraphQL\Utils;
use Overblog\GraphQLBundle\Definition\FieldInterface;
use Overblog\GraphQLBundle\Definition\Builder\MappingInterface;
use Overblog\GraphQLBundle\Definition\MergeFieldTrait;

class MutationField implements FieldInterface
class MutationField implements MappingInterface
{
use MergeFieldTrait;

public function toFieldDefinition(array $config)
public function toMappingDefinition(array $config)
{
Utils::invariant(!empty($config['name']), 'Every type is expected to have name');

Expand Down
2 changes: 1 addition & 1 deletion Relay/Mutation/PayloadType.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@

namespace Overblog\GraphQLBundle\Relay\Mutation;

use GraphQL\Type\Definition\ObjectType;
use GraphQL\Type\Definition\Config;
use GraphQL\Type\Definition\FieldDefinition;
use GraphQL\Type\Definition\ObjectType;
use GraphQL\Type\Definition\Type;
use GraphQL\Utils;
use Overblog\GraphQLBundle\Definition\MergeFieldTrait;
Expand Down
2 changes: 1 addition & 1 deletion Relay/Node/GlobalId.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public static function fromGlobalId($globalId)
{
$unBasedGlobalId = base64_decode($globalId);

list($type, $id) = array_merge(explode(static::SEPARATOR, $unBasedGlobalId), array(true));
list($type, $id) = array_merge(explode(static::SEPARATOR, $unBasedGlobalId), [true]);

return [
'type' => $type,
Expand Down
6 changes: 3 additions & 3 deletions Relay/Node/GlobalIdField.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
use GraphQL\Type\Definition\Config;
use GraphQL\Type\Definition\ResolveInfo;
use GraphQL\Type\Definition\Type;
use Overblog\GraphQLBundle\Definition\FieldInterface;
use Overblog\GraphQLBundle\Definition\Builder\MappingInterface;

class GlobalIdField implements FieldInterface
class GlobalIdField implements MappingInterface
{
public function toFieldDefinition(array $config)
public function toMappingDefinition(array $config)
{
Config::validate($config, [
'name' => Config::STRING | Config::REQUIRED,
Expand Down
12 changes: 3 additions & 9 deletions Relay/Node/NodeField.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@

use GraphQL\Type\Definition\Config;
use GraphQL\Type\Definition\Type;
use Overblog\GraphQLBundle\Definition\FieldInterface;
use Overblog\GraphQLBundle\Definition\Builder\MappingInterface;

class NodeField implements FieldInterface
class NodeField implements MappingInterface
{
public function toFieldDefinition(array $config)
public function toMappingDefinition(array $config)
{
Config::validate($config, [
'name' => Config::STRING | Config::REQUIRED,
Expand All @@ -37,12 +37,6 @@ public function toFieldDefinition(array $config)
'id' => ['type' => Type::nonNull(Type::id()), 'description' => 'The ID of an object'],
],
'resolve' => function ($obj, $args, $info) use ($idFetcher) {
if (empty($args['id'])) {
throw new \InvalidArgumentException(
'Argument "id" is required but not provided.'
);
}

return call_user_func_array($idFetcher, [$args['id'], $info]);
},
];
Expand Down
6 changes: 3 additions & 3 deletions Relay/Node/PluralIdentifyingRootField.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@

use GraphQL\Type\Definition\Config;
use GraphQL\Type\Definition\Type;
use Overblog\GraphQLBundle\Definition\FieldInterface;
use Overblog\GraphQLBundle\Definition\Builder\MappingInterface;

class PluralIdentifyingRootField implements FieldInterface
class PluralIdentifyingRootField implements MappingInterface
{
public function toFieldDefinition(array $config)
public function toMappingDefinition(array $config)
{
Config::validate($config, [
'name' => Config::STRING,
Expand Down
40 changes: 0 additions & 40 deletions Relay/Node/RawIdField.php

This file was deleted.

Loading