Skip to content

Commit 33c16c3

Browse files
author
Cyril Mizzi
committed
removes Support\Field::toArray() method (handle by transformer)
adds abstract keyword to Mutation and Query classes
1 parent a046610 commit 33c16c3

File tree

4 files changed

+17
-23
lines changed

4 files changed

+17
-23
lines changed

src/Support/Field.php

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -21,25 +21,4 @@ public function getAttributes() {
2121
public function getArguments() {
2222
return [];
2323
}
24-
25-
/**
26-
* Convert current field into array
27-
*
28-
* @return array
29-
*/
30-
public function toArray() {
31-
$attributes = $this->getAttributes() + [
32-
'type' => $this->getRelatedType(),
33-
'args' => $this->getArguments()
34-
];
35-
36-
// Assert we have a resolve method
37-
if (method_exists($this, 'resolve')) {
38-
$attributes = $attributes + [
39-
'resolve' => [$this, 'resolve']
40-
];
41-
}
42-
43-
return $attributes;
44-
}
4524
}

src/Support/FieldInterface.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
<?php
22
namespace StudioNet\GraphQL\Support;
33

4+
/**
5+
* Represents must-used methods for an existing field
6+
*/
47
interface FieldInterface {
58
/**
69
* Return represented type

src/Support/Mutation.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
<?php
22
namespace StudioNet\GraphQL\Support;
33

4-
class Mutation extends Field {}
4+
/**
5+
* Mutation
6+
*
7+
* @see Field
8+
* @abstract
9+
*/
10+
abstract class Mutation extends Field {}

src/Support/Query.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
<?php
22
namespace StudioNet\GraphQL\Support;
33

4-
class Query extends Field {}
4+
/**
5+
* Query
6+
*
7+
* @see Field
8+
* @abstract
9+
*/
10+
abstract class Query extends Field {}

0 commit comments

Comments
 (0)