@@ -28,8 +28,8 @@ discard block |
||
| 28 | 28 | ->set(EntityManager::class, $entityManager) |
| 29 | 29 | ->set( |
| 30 | 30 | Config::class, |
| 31 | - static function () use ($config) { |
|
| 32 | - if (! $config) { |
|
| 31 | + static function() use ($config) { |
|
| 32 | + if (!$config) { |
|
| 33 | 33 | $config = new Config(); |
| 34 | 34 | } |
| 35 | 35 | |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | ) |
| 51 | 51 | ->set( |
| 52 | 52 | 'metadata', |
| 53 | - static function (Container $container) use ($metadata) { |
|
| 53 | + static function(Container $container) use ($metadata) { |
|
| 54 | 54 | return (new Metadata\MetadataFactory( |
| 55 | 55 | $metadata, |
| 56 | 56 | $container->get(EntityManager::class), |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | ) |
| 63 | 63 | ->set( |
| 64 | 64 | Metadata\GlobalEnable::class, |
| 65 | - static function (Container $container) { |
|
| 65 | + static function(Container $container) { |
|
| 66 | 66 | return new Metadata\GlobalEnable( |
| 67 | 67 | $container->get(EntityManager::class), |
| 68 | 68 | $container->get(Config::class), |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | ) |
| 73 | 73 | ->set( |
| 74 | 74 | Resolve\FieldResolver::class, |
| 75 | - static function (Container $container) { |
|
| 75 | + static function(Container $container) { |
|
| 76 | 76 | return new Resolve\FieldResolver( |
| 77 | 77 | $container->get(Config::class), |
| 78 | 78 | $container->get(Type\Entity\EntityTypeContainer::class), |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | ) |
| 82 | 82 | ->set( |
| 83 | 83 | Resolve\ResolveCollectionFactory::class, |
| 84 | - static function (Container $container) { |
|
| 84 | + static function(Container $container) { |
|
| 85 | 85 | return new Resolve\ResolveCollectionFactory( |
| 86 | 86 | $container->get(EntityManager::class), |
| 87 | 87 | $container->get(Config::class), |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | ) |
| 95 | 95 | ->set( |
| 96 | 96 | Resolve\ResolveEntityFactory::class, |
| 97 | - static function (Container $container) { |
|
| 97 | + static function(Container $container) { |
|
| 98 | 98 | return new Resolve\ResolveEntityFactory( |
| 99 | 99 | $container->get(Config::class), |
| 100 | 100 | $container->get(EntityManager::class), |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | ) |
| 106 | 106 | ->set( |
| 107 | 107 | Filter\FilterFactory::class, |
| 108 | - static function (Container $container) { |
|
| 108 | + static function(Container $container) { |
|
| 109 | 109 | return new Filter\FilterFactory( |
| 110 | 110 | $container->get(Config::class), |
| 111 | 111 | $container->get(EntityManager::class), |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | ) |
| 117 | 117 | ->set( |
| 118 | 118 | Hydrator\HydratorContainer::class, |
| 119 | - static function (Container $container) { |
|
| 119 | + static function(Container $container) { |
|
| 120 | 120 | return new Hydrator\HydratorContainer( |
| 121 | 121 | $container->get(EntityManager::class), |
| 122 | 122 | $container->get(Type\Entity\EntityTypeContainer::class), |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | ) |
| 126 | 126 | ->set( |
| 127 | 127 | Input\InputFactory::class, |
| 128 | - static function (Container $container) { |
|
| 128 | + static function(Container $container) { |
|
| 129 | 129 | return new Input\InputFactory( |
| 130 | 130 | $container->get(Config::class), |
| 131 | 131 | $container->get(EntityManager::class), |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | $fields = []; |
| 45 | 45 | $targetEntity = $this->entityTypeContainer->get($id); |
| 46 | 46 | |
| 47 | - if (! count($requiredFields) && ! count($optionalFields)) { |
|
| 47 | + if (!count($requiredFields) && !count($optionalFields)) { |
|
| 48 | 48 | $this->addAllFieldsAsRequired($targetEntity, $fields); |
| 49 | 49 | } else { |
| 50 | 50 | $this->addRequiredFields($targetEntity, $requiredFields, $fields); |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | array &$fields, |
| 69 | 69 | ): void { |
| 70 | 70 | foreach ($this->entityManager->getClassMetadata($targetEntity->getEntityClass())->getFieldNames() as $fieldName) { |
| 71 | - if (! in_array($fieldName, $optionalFields)) { |
|
| 71 | + if (!in_array($fieldName, $optionalFields)) { |
|
| 72 | 72 | continue; |
| 73 | 73 | } |
| 74 | 74 | |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | array &$fields, |
| 102 | 102 | ): void { |
| 103 | 103 | foreach ($this->entityManager->getClassMetadata($targetEntity->getEntityClass())->getFieldNames() as $fieldName) { |
| 104 | - if (! in_array($fieldName, $requiredFields)) { |
|
| 104 | + if (!in_array($fieldName, $requiredFields)) { |
|
| 105 | 105 | continue; |
| 106 | 106 | } |
| 107 | 107 | |
@@ -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', |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | |
| 39 | 39 | // Custom types may hit this condition |
| 40 | 40 | // @codeCoverageIgnoreStart |
| 41 | - if (! $type instanceof ScalarType) { |
|
| 41 | + if (!$type instanceof ScalarType) { |
|
| 42 | 42 | continue; |
| 43 | 43 | } |
| 44 | 44 | |
@@ -47,11 +47,11 @@ discard block |
||
| 47 | 47 | // Between is a special case filter. |
| 48 | 48 | // To avoid creating a new Between type for each field, |
| 49 | 49 | // check if the Between type exists and reuse it. |
| 50 | - if (! $fields[$filter->value]['type'] instanceof Between) { |
|
| 50 | + if (!$fields[$filter->value]['type'] instanceof Between) { |
|
| 51 | 51 | continue; |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | - if (! $typeContainer->has('Between_' . $type->name())) { |
|
| 54 | + if (!$typeContainer->has('Between_' . $type->name())) { |
|
| 55 | 55 | $typeContainer->set('Between_' . $type->name(), new Between($type)); |
| 56 | 56 | } |
| 57 | 57 | |
@@ -73,15 +73,15 @@ discard block |
||
| 73 | 73 | ); |
| 74 | 74 | |
| 75 | 75 | // Get the allowed filters |
| 76 | - $allowedFilters = array_udiff(Filters::cases(), $excludedFilters, static function ($a, $b) { |
|
| 76 | + $allowedFilters = array_udiff(Filters::cases(), $excludedFilters, static function($a, $b) { |
|
| 77 | 77 | return $a->value <=> $b->value; |
| 78 | 78 | }); |
| 79 | 79 | |
| 80 | 80 | // Limit association filters |
| 81 | 81 | if ($associationName) { |
| 82 | 82 | $excludeFilters = Filters::fromArray($associationMetadata['excludeFilters'] ?? []); |
| 83 | - $allowedFilters = array_filter($allowedFilters, static function ($value) use ($excludeFilters) { |
|
| 84 | - return ! in_array($value, $excludeFilters); |
|
| 83 | + $allowedFilters = array_filter($allowedFilters, static function($value) use ($excludeFilters) { |
|
| 84 | + return !in_array($value, $excludeFilters); |
|
| 85 | 85 | }); |
| 86 | 86 | } |
| 87 | 87 | |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | |
| 116 | 116 | foreach ($classMetadata->getFieldNames() as $fieldName) { |
| 117 | 117 | // Only process fields that are in the graphql metadata |
| 118 | - if (! in_array($fieldName, array_keys($entityMetadata['fields']))) { |
|
| 118 | + if (!in_array($fieldName, array_keys($entityMetadata['fields']))) { |
|
| 119 | 119 | continue; |
| 120 | 120 | } |
| 121 | 121 | |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | ->get($entityMetadata['fields'][$fieldName]['type']); |
| 124 | 124 | |
| 125 | 125 | // Custom types may hit this condition |
| 126 | - if (! $type instanceof ScalarType) { |
|
| 126 | + if (!$type instanceof ScalarType) { |
|
| 127 | 127 | continue; |
| 128 | 128 | } |
| 129 | 129 | |
@@ -140,8 +140,8 @@ discard block |
||
| 140 | 140 | $fieldExcludeFilters = Filters::fromArray($entityMetadata['fields'][$fieldName]['excludeFilters']); |
| 141 | 141 | $allowedFilters = array_filter( |
| 142 | 142 | $allowedFilters, |
| 143 | - static function ($value) use ($fieldExcludeFilters) { |
|
| 144 | - return ! in_array($value, $fieldExcludeFilters); |
|
| 143 | + static function($value) use ($fieldExcludeFilters) { |
|
| 144 | + return !in_array($value, $fieldExcludeFilters); |
|
| 145 | 145 | }, |
| 146 | 146 | ); |
| 147 | 147 | } |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | // Add eq filter for to-one associations |
| 189 | 189 | foreach ($classMetadata->getAssociationNames() as $associationName) { |
| 190 | 190 | // Only process fields which are in the graphql metadata |
| 191 | - if (! isset($entityMetadata['fields'][$associationName])) { |
|
| 191 | + if (!isset($entityMetadata['fields'][$associationName])) { |
|
| 192 | 192 | continue; |
| 193 | 193 | } |
| 194 | 194 | |
@@ -200,14 +200,14 @@ discard block |
||
| 200 | 200 | ClassMetadata::MANY_TO_MANY, |
| 201 | 201 | ClassMetadata::ONE_TO_MANY, |
| 202 | 202 | ]) |
| 203 | - || ! in_array(Filters::EQ, $allowedFilters) |
|
| 203 | + || !in_array(Filters::EQ, $allowedFilters) |
|
| 204 | 204 | ) { |
| 205 | 205 | continue; |
| 206 | 206 | } |
| 207 | 207 | |
| 208 | 208 | $filterTypeName = 'Filters_ID_' . md5(serialize($allowedFilters)); |
| 209 | 209 | |
| 210 | - if (! $this->typeContainer->has($filterTypeName)) { |
|
| 210 | + if (!$this->typeContainer->has($filterTypeName)) { |
|
| 211 | 211 | $this->typeContainer->set($filterTypeName, new Association($this->typeContainer, Type::id(), [Filters::EQ])); |
| 212 | 212 | } |
| 213 | 213 | |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | |
| 45 | 45 | public function get(Entity $entity): Closure |
| 46 | 46 | { |
| 47 | - return function ($source, array $args, $context, ResolveInfo $info) use ($entity) { |
|
| 47 | + return function($source, array $args, $context, ResolveInfo $info) use ($entity) { |
|
| 48 | 48 | $fieldResolver = $this->fieldResolver; |
| 49 | 49 | $collection = $fieldResolver($source, $args, $context, $info); |
| 50 | 50 | |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | } |
| 107 | 107 | } |
| 108 | 108 | |
| 109 | - if (! empty($orderBy)) { |
|
| 109 | + if (!empty($orderBy)) { |
|
| 110 | 110 | $criteria->orderBy($orderBy); |
| 111 | 111 | } |
| 112 | 112 | |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | 'cursor' => $cursors['last'], |
| 214 | 214 | ]; |
| 215 | 215 | |
| 216 | - if (! $cursors['first']) { |
|
| 216 | + if (!$cursors['first']) { |
|
| 217 | 217 | $cursors['first'] = $cursors['last']; |
| 218 | 218 | } |
| 219 | 219 | |
@@ -250,7 +250,7 @@ discard block |
||
| 250 | 250 | $limit = $associationLimit; |
| 251 | 251 | } |
| 252 | 252 | |
| 253 | - if (! $limit) { |
|
| 253 | + if (!$limit) { |
|
| 254 | 254 | $limit = $this->config->getLimit(); |
| 255 | 255 | } |
| 256 | 256 | |
@@ -271,7 +271,7 @@ discard block |
||
| 271 | 271 | $offset = 0; |
| 272 | 272 | } |
| 273 | 273 | |
| 274 | - if ($paginationFields['last'] && ! $paginationFields['before']) { |
|
| 274 | + if ($paginationFields['last'] && !$paginationFields['before']) { |
|
| 275 | 275 | $offset = $itemCount - $paginationFields['last']; |
| 276 | 276 | } |
| 277 | 277 | |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | $this->hydratorFactory = $container->get(HydratorContainer::class); |
| 71 | 71 | $this->typeContainer = $container->get(TypeContainer::class); |
| 72 | 72 | |
| 73 | - if (! isset($container->get('metadata')[$typeName])) { |
|
| 73 | + if (!isset($container->get('metadata')[$typeName])) { |
|
| 74 | 74 | throw new Error( |
| 75 | 75 | 'Entity ' . $typeName . ' is not mapped in the metadata', |
| 76 | 76 | ); |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | $this->aliasMap = []; |
| 121 | 121 | |
| 122 | 122 | foreach ($this->metadata['fields'] as $fieldName => $fieldMetadata) { |
| 123 | - if (! isset($fieldMetadata['alias'])) { |
|
| 123 | + if (!isset($fieldMetadata['alias'])) { |
|
| 124 | 124 | continue; |
| 125 | 125 | } |
| 126 | 126 | |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | $classMetadata = $this->entityManager->getClassMetadata($this->getEntityClass()); |
| 192 | 192 | |
| 193 | 193 | foreach ($classMetadata->getFieldNames() as $fieldName) { |
| 194 | - if (! in_array($fieldName, array_keys($this->metadata['fields']))) { |
|
| 194 | + if (!in_array($fieldName, array_keys($this->metadata['fields']))) { |
|
| 195 | 195 | continue; |
| 196 | 196 | } |
| 197 | 197 | |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | $classMetadata = $this->entityManager->getClassMetadata($this->getEntityClass()); |
| 214 | 214 | |
| 215 | 215 | foreach ($classMetadata->getAssociationNames() as $associationName) { |
| 216 | - if (! in_array($associationName, array_keys($this->metadata['fields']))) { |
|
| 216 | + if (!in_array($associationName, array_keys($this->metadata['fields']))) { |
|
| 217 | 217 | continue; |
| 218 | 218 | } |
| 219 | 219 | |
@@ -226,7 +226,7 @@ discard block |
||
| 226 | 226 | ]) |
| 227 | 227 | ) { |
| 228 | 228 | $targetEntity = $associationMetadata['targetEntity']; |
| 229 | - $fields[$associationName] = function () use ($targetEntity) { |
|
| 229 | + $fields[$associationName] = function() use ($targetEntity) { |
|
| 230 | 230 | $entity = $this->entityTypeContainer->get($targetEntity); |
| 231 | 231 | |
| 232 | 232 | return [ |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | // Collections |
| 242 | 242 | $targetEntity = $associationMetadata['targetEntity']; |
| 243 | 243 | |
| 244 | - $fields[$this->getAliasMap()[$associationName] ?? $associationName] = function () use ($targetEntity, $associationName) { |
|
| 244 | + $fields[$this->getAliasMap()[$associationName] ?? $associationName] = function() use ($targetEntity, $associationName) { |
|
| 245 | 245 | $entity = $this->entityTypeContainer->get($targetEntity); |
| 246 | 246 | $shortName = $this->getTypeName() . '_' . ucwords($associationName); |
| 247 | 247 | |