@@ -36,7 +36,9 @@ |
||
| 36 | 36 | |
| 37 | 37 | public function validate($data, $rules = [], $extraFieldsAllowed = null) |
| 38 | 38 | { |
| 39 | - if ($extraFieldsAllowed !== null) $this->setExtraFieldsAllowed($extraFieldsAllowed); |
|
| 39 | + if ($extraFieldsAllowed !== null) { |
|
| 40 | + $this->setExtraFieldsAllowed($extraFieldsAllowed); |
|
| 41 | + } |
|
| 40 | 42 | |
| 41 | 43 | $processedFields = []; |
| 42 | 44 | foreach ($rules as $fieldName => $fieldRules) { |
@@ -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; |
@@ -11,7 +11,6 @@ |
||
| 11 | 11 | |
| 12 | 12 | use Youshido\GraphQL\Type\Config\Config; |
| 13 | 13 | use Youshido\GraphQL\Type\Object\AbstractObjectType; |
| 14 | -use Youshido\GraphQL\Type\Object\InputObjectType; |
|
| 15 | 14 | use Youshido\GraphQL\Type\Object\ObjectType; |
| 16 | 15 | use Youshido\GraphQL\Type\TypeMap; |
| 17 | 16 | |
@@ -11,15 +11,10 @@ |
||
| 11 | 11 | |
| 12 | 12 | use Youshido\GraphQL\Type\AbstractType; |
| 13 | 13 | use Youshido\GraphQL\Type\Config\Field\FieldConfig; |
| 14 | -use Youshido\GraphQL\Type\Config\Field\InputFieldConfig; |
|
| 15 | 14 | use Youshido\GraphQL\Type\Field\Field; |
| 16 | 15 | use Youshido\GraphQL\Type\Field\InputField; |
| 17 | -use Youshido\GraphQL\Type\Object\AbstractEnumType; |
|
| 18 | 16 | use Youshido\GraphQL\Type\Object\AbstractInputObjectType; |
| 19 | -use Youshido\GraphQL\Type\Object\AbstractInterfaceType; |
|
| 20 | 17 | use Youshido\GraphQL\Type\Object\AbstractObjectType; |
| 21 | -use Youshido\GraphQL\Type\Object\AbstractUnionType; |
|
| 22 | -use Youshido\GraphQL\Type\Scalar\AbstractScalarType; |
|
| 23 | 18 | use Youshido\GraphQL\Type\TypeMap; |
| 24 | 19 | use Youshido\GraphQL\Validator\Exception\ConfigurationException; |
| 25 | 20 | |
@@ -84,7 +84,9 @@ discard block |
||
| 84 | 84 | |
| 85 | 85 | private function isArrayOfValues($data) |
| 86 | 86 | { |
| 87 | - if (!is_array($data)) return false; |
|
| 87 | + if (!is_array($data)) { |
|
| 88 | + return false; |
|
| 89 | + } |
|
| 88 | 90 | |
| 89 | 91 | foreach ($data as $item) { |
| 90 | 92 | if (!array_key_exists('value', $item)) { |
@@ -97,7 +99,9 @@ discard block |
||
| 97 | 99 | |
| 98 | 100 | private static function isArrayOfInterfaces($data) |
| 99 | 101 | { |
| 100 | - if (!is_array($data)) return false; |
|
| 102 | + if (!is_array($data)) { |
|
| 103 | + return false; |
|
| 104 | + } |
|
| 101 | 105 | |
| 102 | 106 | foreach ($data as $item) { |
| 103 | 107 | if (!TypeMap::isInterface($item)) { |
@@ -110,10 +114,14 @@ discard block |
||
| 110 | 114 | |
| 111 | 115 | private function isArrayOfFields($data) |
| 112 | 116 | { |
| 113 | - if (!is_array($data)) return false; |
|
| 117 | + if (!is_array($data)) { |
|
| 118 | + return false; |
|
| 119 | + } |
|
| 114 | 120 | |
| 115 | 121 | foreach ($data as $name => $item) { |
| 116 | - if (!$this->isField($item, $name)) return false; |
|
| 122 | + if (!$this->isField($item, $name)) { |
|
| 123 | + return false; |
|
| 124 | + } |
|
| 117 | 125 | } |
| 118 | 126 | |
| 119 | 127 | return true; |
@@ -127,7 +135,9 @@ discard block |
||
| 127 | 135 | |
| 128 | 136 | try { |
| 129 | 137 | /** @todo need to change it to optimize performance */ |
| 130 | - if (empty($data['name'])) $data['name'] = $name; |
|
| 138 | + if (empty($data['name'])) { |
|
| 139 | + $data['name'] = $name; |
|
| 140 | + } |
|
| 131 | 141 | |
| 132 | 142 | $config = new FieldConfig($data); |
| 133 | 143 | |
@@ -141,10 +151,14 @@ discard block |
||
| 141 | 151 | |
| 142 | 152 | private function isArrayOfInputs($data) |
| 143 | 153 | { |
| 144 | - if (!is_array($data)) return false; |
|
| 154 | + if (!is_array($data)) { |
|
| 155 | + return false; |
|
| 156 | + } |
|
| 145 | 157 | |
| 146 | 158 | foreach ($data as $name => $item) { |
| 147 | - if (!$this->isInputField($item, $name)) return false; |
|
| 159 | + if (!$this->isInputField($item, $name)) { |
|
| 160 | + return false; |
|
| 161 | + } |
|
| 148 | 162 | } |
| 149 | 163 | |
| 150 | 164 | return true; |
@@ -59,7 +59,9 @@ |
||
| 59 | 59 | { |
| 60 | 60 | if ($value instanceof AbstractObjectType) { |
| 61 | 61 | foreach($value->getInterfaces() as $interface) { |
| 62 | - if ($interface instanceof $this) return true; |
|
| 62 | + if ($interface instanceof $this) { |
|
| 63 | + return true; |
|
| 64 | + } |
|
| 63 | 65 | } |
| 64 | 66 | } |
| 65 | 67 | return false; |
@@ -12,7 +12,6 @@ |
||
| 12 | 12 | use Youshido\GraphQL\Type\AbstractType; |
| 13 | 13 | use Youshido\GraphQL\Type\Config\Object\UnionTypeConfig; |
| 14 | 14 | use Youshido\GraphQL\Type\Config\Traits\ConfigCallTrait; |
| 15 | -use Youshido\GraphQL\Type\Config\TypeConfigInterface; |
|
| 16 | 15 | use Youshido\GraphQL\Type\Traits\AutoNameTrait; |
| 17 | 16 | use Youshido\GraphQL\Type\TypeMap; |
| 18 | 17 | |
@@ -27,7 +27,9 @@ |
||
| 27 | 27 | if (!$type) { |
| 28 | 28 | return; |
| 29 | 29 | } |
| 30 | - if (is_object($type) && array_key_exists($type->getName(), $this->types)) return; |
|
| 30 | + if (is_object($type) && array_key_exists($type->getName(), $this->types)) { |
|
| 31 | + return; |
|
| 32 | + } |
|
| 31 | 33 | |
| 32 | 34 | switch ($type->getKind()) { |
| 33 | 35 | case TypeMap::KIND_INTERFACE: |
@@ -39,7 +39,9 @@ |
||
| 39 | 39 | |
| 40 | 40 | protected function assertInterfaceImplementationCorrect(AbstractObjectType $type) |
| 41 | 41 | { |
| 42 | - if (!$type->getInterfaces()) return true; |
|
| 42 | + if (!$type->getInterfaces()) { |
|
| 43 | + return true; |
|
| 44 | + } |
|
| 43 | 45 | |
| 44 | 46 | foreach ($type->getInterfaces() as $interface) { |
| 45 | 47 | foreach ($interface->getConfig()->getFields() as $intField) { |
@@ -50,7 +50,9 @@ |
||
| 50 | 50 | */ |
| 51 | 51 | public function validateArguments($field, $query, $request) |
| 52 | 52 | { |
| 53 | - if (!count($field->getConfig()->getArguments())) return true; |
|
| 53 | + if (!count($field->getConfig()->getArguments())) { |
|
| 54 | + return true; |
|
| 55 | + } |
|
| 54 | 56 | |
| 55 | 57 | $requiredArguments = array_filter($field->getConfig()->getArguments(), function (InputField $argument) { |
| 56 | 58 | return $argument->getConfig()->getType()->getKind() == TypeMap::KIND_NON_NULL; |
@@ -9,8 +9,6 @@ |
||
| 9 | 9 | namespace Youshido\GraphQL\Type; |
| 10 | 10 | |
| 11 | 11 | |
| 12 | -use Youshido\GraphQL\Type\Config\TypeConfigInterface; |
|
| 13 | - |
|
| 14 | 12 | class NonNullType extends AbstractType implements CompositeTypeInterface |
| 15 | 13 | { |
| 16 | 14 | private $_typeOf; |