Skip to content

Commit

Permalink
style (FEDERATION) nuwave#911: Code style adjustments to match requir…
Browse files Browse the repository at this point in the history
…ements
  • Loading branch information
renepardon committed Nov 25, 2019
1 parent ca1f4b7 commit f2ab7dd
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 55 deletions.
20 changes: 10 additions & 10 deletions src/Federation/Directives/ExtendsDirective.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,6 @@

class ExtendsDirective extends BaseDirective
{
/**
* Directive name.
*
* @return string
*/
public function name(): string
{
return 'extends';
}

/**
* @return string
* @see https://www.apollographql.com/docs/apollo-server/federation/federation-spec/#schema-modifications-glossary
Expand All @@ -37,4 +27,14 @@ public static function definition(): string
directive @extends on OBJECT | INTERFACE
SDL;
}

/**
* Directive name.
*
* @return string
*/
public function name(): string
{
return 'extends';
}
}
20 changes: 10 additions & 10 deletions src/Federation/Directives/ExternalDirective.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,6 @@

class ExternalDirective extends BaseDirective
{
/**
* Name of the directive.
*
* @return string
*/
public function name(): string
{
return 'external';
}

/**
* @return string
* @see https://www.apollographql.com/docs/apollo-server/federation/federation-spec/#schema-modifications-glossary
Expand All @@ -32,4 +22,14 @@ public static function definition(): string
directive @external on FIELD_DEFINITION
SDL;
}

/**
* Name of the directive.
*
* @return string
*/
public function name(): string
{
return 'external';
}
}
20 changes: 10 additions & 10 deletions src/Federation/Directives/KeyDirective.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,6 @@

class KeyDirective extends BaseDirective
{
/**
* Directive name.
*
* @return string
*/
public function name(): string
{
return 'key';
}

/**
* @return string
* @see https://www.apollographql.com/docs/apollo-server/federation/federation-spec/#schema-modifications-glossary
Expand All @@ -38,4 +28,14 @@ public static function definition(): string
) on OBJECT | INTERFACE
SDL;
}

/**
* Directive name.
*
* @return string
*/
public function name(): string
{
return 'key';
}
}
20 changes: 10 additions & 10 deletions src/Federation/Directives/ProvidesDirective.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,6 @@

class ProvidesDirective extends BaseDirective
{
/**
* Name of the directive.
*
* @return string
*/
public function name(): string
{
return 'provides';
}

/**
* @return string
* @see https://www.apollographql.com/docs/apollo-server/federation/federation-spec/#schema-modifications-glossary
Expand Down Expand Up @@ -46,4 +36,14 @@ public static function definition(): string
) on FIELD_DEFINITION
SDL;
}

/**
* Name of the directive.
*
* @return string
*/
public function name(): string
{
return 'provides';
}
}
20 changes: 10 additions & 10 deletions src/Federation/Directives/RequiresDirective.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,6 @@

class RequiresDirective extends BaseDirective
{
/**
* Name of the directive.
*
* @return string
*/
public function name(): string
{
return 'requires';
}

/**
* @return string
* @see https://www.apollographql.com/docs/apollo-server/federation/federation-spec/#schema-modifications-glossary
Expand Down Expand Up @@ -44,4 +34,14 @@ public static function definition(): string
) on FIELD_DEFINITION
SDL;
}

/**
* Name of the directive.
*
* @return string
*/
public function name(): string
{
return 'requires';
}
}
2 changes: 1 addition & 1 deletion src/Federation/FederationServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ protected function addScalars(ManipulateAST &$manipulateAST): void

/**
* Retrieve all object types from AST which uses the @key directive (no matter if native or extended type) and
* combine those types into the _Entity union
* combine those types into the _Entity union.
*
* @param ManipulateAST $manipulateAST
*
Expand Down
6 changes: 2 additions & 4 deletions src/Federation/Resolvers/Service.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

use GraphQL\Type\Definition\ObjectType;
use GraphQL\Type\Definition\ResolveInfo;
use GraphQL\Type\Schema;
use GraphQL\Type\SchemaConfig;
use GraphQL\Utils\SchemaPrinter;
use Nuwave\Lighthouse\Support\Contracts\GraphQLContext;

Expand All @@ -29,14 +27,14 @@ public function resolveSdl($rootValue, array $args, GraphQLContext $context, Res

$queryFields = [];
foreach ($schema->getQueryType()->getFields() as $field) {
if (!in_array($field->name, static::FEDERATION_QUERY_FIELDS)) {
if (! in_array($field->name, static::FEDERATION_QUERY_FIELDS)) {
$queryFields[] = $field;
}
}

$directives = [];
foreach ($schema->getDirectives() as $directive) {
if (!in_array($directive->name, static::FEDERATION_DIRECTIVES)) {
if (! in_array($directive->name, static::FEDERATION_DIRECTIVES)) {
$directives[] = $directive;
}
}
Expand Down

0 comments on commit f2ab7dd

Please sign in to comment.