@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | $graphQLFields = []; |
| 96 | 96 | |
| 97 | 97 | foreach ($classMetadata->getFieldNames() as $fieldName) { |
| 98 | - if (! in_array($fieldName, array_keys($this->metadataConfig['fields']))) { |
|
| 98 | + if (!in_array($fieldName, array_keys($this->metadataConfig['fields']))) { |
|
| 99 | 99 | continue; |
| 100 | 100 | } |
| 101 | 101 | |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | foreach ($classMetadata->getAssociationNames() as $associationName) { |
| 112 | - if (! in_array($associationName, array_keys($this->metadataConfig['fields']))) { |
|
| 112 | + if (!in_array($associationName, array_keys($this->metadataConfig['fields']))) { |
|
| 113 | 113 | continue; |
| 114 | 114 | } |
| 115 | 115 | |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | case ClassMetadataInfo::MANY_TO_ONE: |
| 121 | 121 | case ClassMetadataInfo::TO_ONE: |
| 122 | 122 | $targetEntity = $associationMetadata['targetEntity']; |
| 123 | - $graphQLFields[$associationName] = function () use ($targetEntity) { |
|
| 123 | + $graphQLFields[$associationName] = function() use ($targetEntity) { |
|
| 124 | 124 | $entity = $this->metadata->get($targetEntity); |
| 125 | 125 | |
| 126 | 126 | return [ |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | case ClassMetadataInfo::MANY_TO_MANY: |
| 134 | 134 | case ClassMetadataInfo::TO_MANY: |
| 135 | 135 | $targetEntity = $associationMetadata['targetEntity']; |
| 136 | - $graphQLFields[$associationName] = function () use ($targetEntity, $associationName) { |
|
| 136 | + $graphQLFields[$associationName] = function() use ($targetEntity, $associationName) { |
|
| 137 | 137 | $entity = $this->metadata->get($targetEntity); |
| 138 | 138 | $shortName = $this->getTypeName() . '_' . $associationName; |
| 139 | 139 | |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | $arrayObject = new ArrayObject([ |
| 163 | 163 | 'name' => $this->getTypeName(), |
| 164 | 164 | 'description' => $this->getDescription(), |
| 165 | - 'fields' => static function () use ($graphQLFields) { |
|
| 165 | + 'fields' => static function() use ($graphQLFields) { |
|
| 166 | 166 | return $graphQLFields; |
| 167 | 167 | }, |
| 168 | 168 | 'resolveField' => $this->fieldResolver, |
@@ -6,7 +6,7 @@ |
||
| 6 | 6 | |
| 7 | 7 | use Attribute; |
| 8 | 8 | |
| 9 | -#[Attribute(Attribute::TARGET_PROPERTY | Attribute::IS_REPEATABLE)] |
|
| 9 | +#[Attribute(Attribute::TARGET_PROPERTY|Attribute::IS_REPEATABLE)] |
|
| 10 | 10 | class Field |
| 11 | 11 | { |
| 12 | 12 | public function __construct( |
@@ -6,7 +6,7 @@ |
||
| 6 | 6 | |
| 7 | 7 | use Attribute; |
| 8 | 8 | |
| 9 | -#[Attribute(Attribute::TARGET_PROPERTY | Attribute::IS_REPEATABLE)] |
|
| 9 | +#[Attribute(Attribute::TARGET_PROPERTY|Attribute::IS_REPEATABLE)] |
|
| 10 | 10 | class Association |
| 11 | 11 | { |
| 12 | 12 | /** @param string[] $excludeCriteria */ |
@@ -6,7 +6,7 @@ |
||
| 6 | 6 | |
| 7 | 7 | use Attribute; |
| 8 | 8 | |
| 9 | -#[Attribute(Attribute::TARGET_CLASS | Attribute::IS_REPEATABLE)] |
|
| 9 | +#[Attribute(Attribute::TARGET_CLASS|Attribute::IS_REPEATABLE)] |
|
| 10 | 10 | final class Entity |
| 11 | 11 | { |
| 12 | 12 | /** @var string The GraphQL group */ |
@@ -18,6 +18,6 @@ |
||
| 18 | 18 | 'secret', |
| 19 | 19 | ]; |
| 20 | 20 | |
| 21 | - return ! in_array($property, $excludeFields); |
|
| 21 | + return !in_array($property, $excludeFields); |
|
| 22 | 22 | } |
| 23 | 23 | } |
@@ -111,7 +111,7 @@ |
||
| 111 | 111 | $object = $this->getObject(); |
| 112 | 112 | $getter = 'get' . $this->getInflector()->classify($this->getCollectionName()); |
| 113 | 113 | |
| 114 | - if (! method_exists($object, $getter)) { |
|
| 114 | + if (!method_exists($object, $getter)) { |
|
| 115 | 115 | throw new InvalidArgumentException( |
| 116 | 116 | sprintf( |
| 117 | 117 | 'The getter %s to access collection %s in object %s does not exist', |
@@ -74,16 +74,16 @@ discard block |
||
| 74 | 74 | // Limit entity filters |
| 75 | 75 | if ($entityMetadata['excludeCriteria']) { |
| 76 | 76 | $excludeCriteria = $entityMetadata['excludeCriteria']; |
| 77 | - $allowedFilters = array_filter($allowedFilters, static function ($value) use ($excludeCriteria) { |
|
| 78 | - return ! in_array($value, $excludeCriteria); |
|
| 77 | + $allowedFilters = array_filter($allowedFilters, static function($value) use ($excludeCriteria) { |
|
| 78 | + return !in_array($value, $excludeCriteria); |
|
| 79 | 79 | }); |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | // Limit association filters |
| 83 | 83 | if ($associationName) { |
| 84 | 84 | $excludeCriteria = $associationMetadata['excludeCriteria']; |
| 85 | - $allowedFilters = array_filter($allowedFilters, static function ($value) use ($excludeCriteria) { |
|
| 86 | - return ! in_array($value, $excludeCriteria); |
|
| 85 | + $allowedFilters = array_filter($allowedFilters, static function($value) use ($excludeCriteria) { |
|
| 86 | + return !in_array($value, $excludeCriteria); |
|
| 87 | 87 | }); |
| 88 | 88 | } |
| 89 | 89 | |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | $graphQLType = null; |
| 92 | 92 | |
| 93 | 93 | // Only process fields which are in the graphql metadata |
| 94 | - if (! in_array($fieldName, array_keys($entityMetadata['fields']))) { |
|
| 94 | + if (!in_array($fieldName, array_keys($entityMetadata['fields']))) { |
|
| 95 | 95 | continue; |
| 96 | 96 | } |
| 97 | 97 | |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | |
| 120 | 120 | // Build simple filters |
| 121 | 121 | foreach ($descriptions as $filter => $docs) { |
| 122 | - if (! in_array($filter, $allowedFilters)) { |
|
| 122 | + if (!in_array($filter, $allowedFilters)) { |
|
| 123 | 123 | continue; |
| 124 | 124 | } |
| 125 | 125 | |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | ]; |
| 220 | 220 | } |
| 221 | 221 | |
| 222 | - if (! in_array(Filters::CONTAINS, $allowedFilters)) { |
|
| 222 | + if (!in_array(Filters::CONTAINS, $allowedFilters)) { |
|
| 223 | 223 | continue; |
| 224 | 224 | } |
| 225 | 225 | |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | |
| 233 | 233 | foreach ($classMetadata->getAssociationNames() as $associationName) { |
| 234 | 234 | // Only process fields which are in the graphql metadata |
| 235 | - if (! in_array($associationName, array_keys($entityMetadata['fields']))) { |
|
| 235 | + if (!in_array($associationName, array_keys($entityMetadata['fields']))) { |
|
| 236 | 236 | continue; |
| 237 | 237 | } |
| 238 | 238 | |
@@ -261,17 +261,17 @@ discard block |
||
| 261 | 261 | } |
| 262 | 262 | |
| 263 | 263 | // Cursor pagination |
| 264 | - $fields['_first'] = [ |
|
| 264 | + $fields['_first'] = [ |
|
| 265 | 265 | 'name' => '_first', |
| 266 | 266 | 'type' => Type::int(), |
| 267 | 267 | 'documentation' => 'Items per page starting from the beginning.', |
| 268 | 268 | ]; |
| 269 | - $fields['_after'] = [ |
|
| 269 | + $fields['_after'] = [ |
|
| 270 | 270 | 'name' => '_after', |
| 271 | 271 | 'type' => Type::string(), |
| 272 | 272 | 'documentation' => 'Cursor from which the items are returned.', |
| 273 | 273 | ]; |
| 274 | - $fields['_last'] = [ |
|
| 274 | + $fields['_last'] = [ |
|
| 275 | 275 | 'name' => '_last', |
| 276 | 276 | 'type' => Type::int(), |
| 277 | 277 | 'documentation' => 'Items per page starting from the end.', |
@@ -284,7 +284,7 @@ discard block |
||
| 284 | 284 | |
| 285 | 285 | $arrayObject = new ArrayObject([ |
| 286 | 286 | 'name' => $typeName, |
| 287 | - 'fields' => static function () use ($fields) { |
|
| 287 | + 'fields' => static function() use ($fields) { |
|
| 288 | 288 | return $fields; |
| 289 | 289 | }, |
| 290 | 290 | ]); |
@@ -18,13 +18,13 @@ |
||
| 18 | 18 | /** @throws Error */ |
| 19 | 19 | public function get(string $id): Entity |
| 20 | 20 | { |
| 21 | - if (! isset($this->metadataConfig[$id])) { |
|
| 21 | + if (!isset($this->metadataConfig[$id])) { |
|
| 22 | 22 | throw new Error( |
| 23 | 23 | 'Entity ' . $id . ' is not mapped in the metadata', |
| 24 | 24 | ); |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | - if (! $this->has($id)) { |
|
| 27 | + if (!$this->has($id)) { |
|
| 28 | 28 | $this->set($id, new Entity($this->container, $this->metadataConfig[$id])); |
| 29 | 29 | } |
| 30 | 30 | |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | |
| 145 | 145 | // Only one matching instance per group is allowed |
| 146 | 146 | assert( |
| 147 | - ! $entityInstance, |
|
| 147 | + !$entityInstance, |
|
| 148 | 148 | 'Duplicate attribute found for entity ' |
| 149 | 149 | . $entityClass . ', group ' . $instance->getGroup(), |
| 150 | 150 | ); |
@@ -164,8 +164,7 @@ discard block |
||
| 164 | 164 | 'excludeCriteria' => $instance->getExcludeCriteria(), |
| 165 | 165 | 'description' => $instance->getDescription(), |
| 166 | 166 | 'typeName' => $instance->getTypeName() |
| 167 | - ? $this->appendGroupSuffix($instance->getTypeName()) : |
|
| 168 | - $this->getTypeName($entityClass), |
|
| 167 | + ? $this->appendGroupSuffix($instance->getTypeName()) : $this->getTypeName($entityClass), |
|
| 169 | 168 | ]; |
| 170 | 169 | } |
| 171 | 170 | |
@@ -188,7 +187,7 @@ discard block |
||
| 188 | 187 | |
| 189 | 188 | // Only one matching instance per group is allowed |
| 190 | 189 | assert( |
| 191 | - ! $fieldInstance, |
|
| 190 | + !$fieldInstance, |
|
| 192 | 191 | 'Duplicate attribute found for field ' |
| 193 | 192 | . $fieldName . ', group ' . $instance->getGroup(), |
| 194 | 193 | ); |
@@ -231,7 +230,7 @@ discard block |
||
| 231 | 230 | |
| 232 | 231 | // Only one matching instance per group is allowed |
| 233 | 232 | assert( |
| 234 | - ! $associationInstance, |
|
| 233 | + !$associationInstance, |
|
| 235 | 234 | 'Duplicate attribute found for association ' |
| 236 | 235 | . $associationName . ', group ' . $instance->getGroup(), |
| 237 | 236 | ); |