@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | return $this->metadataConfig['typeName']; |
65 | 65 | } |
66 | 66 | |
67 | - public function getDescription(): string|null |
|
67 | + public function getDescription(): string | null |
|
68 | 68 | { |
69 | 69 | return $this->metadataConfig['description']; |
70 | 70 | } |
@@ -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, |
@@ -13,27 +13,27 @@ |
||
13 | 13 | { |
14 | 14 | public function __construct( |
15 | 15 | protected ContainerInterface $container, |
16 | - protected array|null $metadataConfig, |
|
16 | + protected array | null $metadataConfig, |
|
17 | 17 | ) { |
18 | 18 | } |
19 | 19 | |
20 | 20 | /** @throws Error */ |
21 | 21 | public function get(string $id): Entity |
22 | 22 | { |
23 | - if (! isset($this->metadataConfig[$id])) { |
|
23 | + if (!isset($this->metadataConfig[$id])) { |
|
24 | 24 | throw new Error( |
25 | 25 | 'Entity ' . $id . ' is not mapped in the metadata', |
26 | 26 | ); |
27 | 27 | } |
28 | 28 | |
29 | - if (! $this->has($id)) { |
|
29 | + if (!$this->has($id)) { |
|
30 | 30 | $this->set($id, new Entity($this->container, $this->metadataConfig[$id])); |
31 | 31 | } |
32 | 32 | |
33 | 33 | return parent::get($id); |
34 | 34 | } |
35 | 35 | |
36 | - public function getMetadataConfig(): array|null |
|
36 | + public function getMetadataConfig(): array | null |
|
37 | 37 | { |
38 | 38 | return $this->metadataConfig; |
39 | 39 | } |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | |
53 | 53 | public function get(Entity $entity): Closure |
54 | 54 | { |
55 | - return function ($source, $args, $context, ResolveInfo $resolveInfo) { |
|
55 | + return function($source, $args, $context, ResolveInfo $resolveInfo) { |
|
56 | 56 | $fieldResolver = $this->fieldResolver; |
57 | 57 | $collection = $fieldResolver($source, $args, $context, $resolveInfo); |
58 | 58 | |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | } |
126 | 126 | } |
127 | 127 | |
128 | - if (! empty($orderBy)) { |
|
128 | + if (!empty($orderBy)) { |
|
129 | 129 | $criteria->orderBy($orderBy); |
130 | 130 | } |
131 | 131 | |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | // Get total count from collection then match |
184 | 184 | $itemCount = count($collection->matching($criteria)); |
185 | 185 | |
186 | - if ($last && ! $before) { |
|
186 | + if ($last && !$before) { |
|
187 | 187 | $offset = $itemCount - $last; |
188 | 188 | } |
189 | 189 | |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | ]; |
212 | 212 | |
213 | 213 | $lastCursor = $cursor; |
214 | - if (! $firstCursor) { |
|
214 | + if (!$firstCursor) { |
|
215 | 215 | $firstCursor = $cursor; |
216 | 216 | } |
217 | 217 |
@@ -22,12 +22,12 @@ discard block |
||
22 | 22 | |
23 | 23 | class MetadataFactory |
24 | 24 | { |
25 | - protected Metadata|null $metadata = null; |
|
25 | + protected Metadata | null $metadata = null; |
|
26 | 26 | protected EntityManager $entityManager; |
27 | 27 | protected Config $config; |
28 | 28 | |
29 | 29 | /** @param mixed|null $metadataConfig */ |
30 | - public function __construct(protected ContainerInterface $container, protected array|null $metadataConfig) |
|
30 | + public function __construct(protected ContainerInterface $container, protected array | null $metadataConfig) |
|
31 | 31 | { |
32 | 32 | $this->entityManager = $container->get(EntityManager::class); |
33 | 33 | $this->config = $container->get(Config::class); |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | |
159 | 159 | // Only one matching instance per group is allowed |
160 | 160 | assert( |
161 | - ! $entityInstance, |
|
161 | + !$entityInstance, |
|
162 | 162 | 'Duplicate attribute found for entity ' |
163 | 163 | . $reflectionClass->getName() . ', group ' . $instance->getGroup(), |
164 | 164 | ); |
@@ -174,8 +174,7 @@ discard block |
||
174 | 174 | 'excludeCriteria' => $instance->getExcludeCriteria(), |
175 | 175 | 'description' => $instance->getDescription(), |
176 | 176 | 'typeName' => $instance->getTypeName() |
177 | - ? $this->appendGroupSuffix($instance->getTypeName()) : |
|
178 | - $this->getTypeName($reflectionClass->getName()), |
|
177 | + ? $this->appendGroupSuffix($instance->getTypeName()) : $this->getTypeName($reflectionClass->getName()), |
|
179 | 178 | ]; |
180 | 179 | } |
181 | 180 | } |
@@ -198,7 +197,7 @@ discard block |
||
198 | 197 | |
199 | 198 | // Only one matching instance per group is allowed |
200 | 199 | assert( |
201 | - ! $fieldInstance, |
|
200 | + !$fieldInstance, |
|
202 | 201 | 'Duplicate attribute found for field ' |
203 | 202 | . $fieldName . ', group ' . $instance->getGroup(), |
204 | 203 | ); |
@@ -246,7 +245,7 @@ discard block |
||
246 | 245 | |
247 | 246 | // Only one matching instance per group is allowed |
248 | 247 | assert( |
249 | - ! $associationInstance, |
|
248 | + !$associationInstance, |
|
250 | 249 | 'Duplicate attribute found for association ' |
251 | 250 | . $associationName . ', group ' . $instance->getGroup(), |
252 | 251 | ); |
@@ -316,7 +315,7 @@ discard block |
||
316 | 315 | return $this->appendGroupSuffix($this->stripEntityPrefix($entityClass)); |
317 | 316 | } |
318 | 317 | |
319 | - private function getDefaultStrategy(string|null $fieldType): string |
|
318 | + private function getDefaultStrategy(string | null $fieldType): string |
|
320 | 319 | { |
321 | 320 | // Set default strategy based on field type |
322 | 321 | switch ($fieldType) { |
@@ -12,9 +12,9 @@ discard block |
||
12 | 12 | /** @param string[] $excludeCriteria */ |
13 | 13 | public function __construct( |
14 | 14 | protected string $group = 'default', |
15 | - protected string|null $strategy = null, |
|
16 | - protected string|null $description = null, |
|
17 | - protected string|null $type = null, |
|
15 | + protected string | null $strategy = null, |
|
16 | + protected string | null $description = null, |
|
17 | + protected string | null $type = null, |
|
18 | 18 | private array $excludeCriteria = [], |
19 | 19 | ) { |
20 | 20 | } |
@@ -24,17 +24,17 @@ discard block |
||
24 | 24 | return $this->group; |
25 | 25 | } |
26 | 26 | |
27 | - public function getStrategy(): string|null |
|
27 | + public function getStrategy(): string | null |
|
28 | 28 | { |
29 | 29 | return $this->strategy; |
30 | 30 | } |
31 | 31 | |
32 | - public function getDescription(): string|null |
|
32 | + public function getDescription(): string | null |
|
33 | 33 | { |
34 | 34 | return $this->description; |
35 | 35 | } |
36 | 36 | |
37 | - public function getType(): string|null |
|
37 | + public function getType(): string | null |
|
38 | 38 | { |
39 | 39 | return $this->type; |
40 | 40 | } |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | |
32 | 32 | public function get(Entity $entity, string $eventName): Closure |
33 | 33 | { |
34 | - return function ($objectValue, array $args, $context, ResolveInfo $info) use ($entity, $eventName) { |
|
34 | + return function($objectValue, array $args, $context, ResolveInfo $info) use ($entity, $eventName) { |
|
35 | 35 | $entityClass = $entity->getEntityClass(); |
36 | 36 | |
37 | 37 | $queryBuilderFilter = (new Applicator($this->entityManager, $entityClass)) |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | $itemCount = $paginator->count(); |
177 | 177 | |
178 | 178 | // Rebuild paginator if needed |
179 | - if ($last && ! $before) { |
|
179 | + if ($last && !$before) { |
|
180 | 180 | $offset = $itemCount - $last; |
181 | 181 | $queryBuilder->setFirstResult($offset); |
182 | 182 | $paginator = new Paginator($queryBuilder->getQuery()); |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | ]; |
194 | 194 | |
195 | 195 | $lastCursor = $cursor; |
196 | - if (! $firstCursor) { |
|
196 | + if (!$firstCursor) { |
|
197 | 197 | $firstCursor = $cursor; |
198 | 198 | } |
199 | 199 |
@@ -33,9 +33,9 @@ discard block |
||
33 | 33 | /** @param mixed[]|null $associationMetadata */ |
34 | 34 | public function get( |
35 | 35 | Entity $targetEntity, |
36 | - Entity|null $owningEntity = null, |
|
37 | - string|null $associationName = null, |
|
38 | - array|null $associationMetadata = null, |
|
36 | + Entity | null $owningEntity = null, |
|
37 | + string | null $associationName = null, |
|
38 | + array | null $associationMetadata = null, |
|
39 | 39 | ): InputObjectType { |
40 | 40 | $typeName = $owningEntity ? |
41 | 41 | $owningEntity->getTypeName() . '_' . $associationName . '_filter' |
@@ -53,22 +53,22 @@ discard block |
||
53 | 53 | // Limit entity filters |
54 | 54 | if ($entityMetadata['excludeCriteria']) { |
55 | 55 | $excludeCriteria = $entityMetadata['excludeCriteria']; |
56 | - $allowedFilters = array_filter($allowedFilters, static function ($value) use ($excludeCriteria) { |
|
57 | - return ! in_array($value, $excludeCriteria); |
|
56 | + $allowedFilters = array_filter($allowedFilters, static function($value) use ($excludeCriteria) { |
|
57 | + return !in_array($value, $excludeCriteria); |
|
58 | 58 | }); |
59 | 59 | } |
60 | 60 | |
61 | 61 | // Limit association filters |
62 | 62 | if ($associationName) { |
63 | 63 | $excludeCriteria = $associationMetadata['excludeCriteria']; |
64 | - $allowedFilters = array_filter($allowedFilters, static function ($value) use ($excludeCriteria) { |
|
65 | - return ! in_array($value, $excludeCriteria); |
|
64 | + $allowedFilters = array_filter($allowedFilters, static function($value) use ($excludeCriteria) { |
|
65 | + return !in_array($value, $excludeCriteria); |
|
66 | 66 | }); |
67 | 67 | } |
68 | 68 | |
69 | 69 | foreach ($classMetadata->getFieldNames() as $fieldName) { |
70 | 70 | // Only process fields that are in the graphql metadata |
71 | - if (! in_array($fieldName, array_keys($entityMetadata['fields']))) { |
|
71 | + if (!in_array($fieldName, array_keys($entityMetadata['fields']))) { |
|
72 | 72 | continue; |
73 | 73 | } |
74 | 74 | |
@@ -92,8 +92,8 @@ discard block |
||
92 | 92 | $fieldExcludeCriteria = $entityMetadata['fields'][$fieldName]['excludeCriteria']; |
93 | 93 | $allowedFilters = array_filter( |
94 | 94 | $allowedFilters, |
95 | - static function ($value) use ($fieldExcludeCriteria) { |
|
96 | - return ! in_array($value, $fieldExcludeCriteria); |
|
95 | + static function($value) use ($fieldExcludeCriteria) { |
|
96 | + return !in_array($value, $fieldExcludeCriteria); |
|
97 | 97 | }, |
98 | 98 | ); |
99 | 99 | } |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | // Add eq filter for to-one associations |
109 | 109 | foreach ($classMetadata->getAssociationNames() as $associationName) { |
110 | 110 | // Only process fields which are in the graphql metadata |
111 | - if (! in_array($associationName, array_keys($entityMetadata['fields']))) { |
|
111 | + if (!in_array($associationName, array_keys($entityMetadata['fields']))) { |
|
112 | 112 | continue; |
113 | 113 | } |
114 | 114 |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | /** |
19 | 19 | * This is the shared TypeManger for all Drivers |
20 | 20 | */ |
21 | - private static Type\TypeManager|null $typeManagerShared = null; |
|
21 | + private static Type\TypeManager | null $typeManagerShared = null; |
|
22 | 22 | |
23 | 23 | /** |
24 | 24 | * @param string $entityManagerAlias required |
@@ -27,10 +27,10 @@ discard block |
||
27 | 27 | */ |
28 | 28 | public function __construct( |
29 | 29 | EntityManager $entityManager, |
30 | - Config|null $config = null, |
|
31 | - array|null $metadataConfig = null, |
|
30 | + Config | null $config = null, |
|
31 | + array | null $metadataConfig = null, |
|
32 | 32 | ) { |
33 | - if (! $config) { |
|
33 | + if (!$config) { |
|
34 | 34 | $config = new Config(); |
35 | 35 | } |
36 | 36 | |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | ->set(EntityManager::class, $entityManager) |
40 | 40 | ->set( |
41 | 41 | Config::class, |
42 | - static function () use ($config) { |
|
42 | + static function() use ($config) { |
|
43 | 43 | return $config; |
44 | 44 | }, |
45 | 45 | ) |
@@ -49,12 +49,12 @@ discard block |
||
49 | 49 | ) |
50 | 50 | ->set( |
51 | 51 | Type\TypeManager::class, |
52 | - static function (ContainerInterface $container) { |
|
53 | - if (! $container->get(Config::class)->getSharedTypeManager()) { |
|
52 | + static function(ContainerInterface $container) { |
|
53 | + if (!$container->get(Config::class)->getSharedTypeManager()) { |
|
54 | 54 | return new Type\TypeManager(); |
55 | 55 | } |
56 | 56 | |
57 | - if (! self::$typeManagerShared) { |
|
57 | + if (!self::$typeManagerShared) { |
|
58 | 58 | self::$typeManagerShared = new Type\TypeManager(); |
59 | 59 | } |
60 | 60 | |
@@ -63,13 +63,13 @@ discard block |
||
63 | 63 | ) |
64 | 64 | ->set( |
65 | 65 | Metadata\Metadata::class, |
66 | - static function (ContainerInterface $container) use ($metadataConfig) { |
|
66 | + static function(ContainerInterface $container) use ($metadataConfig) { |
|
67 | 67 | return (new Metadata\MetadataFactory($container, $metadataConfig))->getMetadata(); |
68 | 68 | }, |
69 | 69 | ) |
70 | 70 | ->set( |
71 | 71 | Resolve\FieldResolver::class, |
72 | - static function (ContainerInterface $container) { |
|
72 | + static function(ContainerInterface $container) { |
|
73 | 73 | return new Resolve\FieldResolver( |
74 | 74 | $container->get(Config::class), |
75 | 75 | $container->get(Metadata\Metadata::class), |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | ) |
79 | 79 | ->set( |
80 | 80 | Resolve\ResolveCollectionFactory::class, |
81 | - static function (ContainerInterface $container) { |
|
81 | + static function(ContainerInterface $container) { |
|
82 | 82 | return new Resolve\ResolveCollectionFactory( |
83 | 83 | $container->get(EntityManager::class), |
84 | 84 | $container->get(Config::class), |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | ) |
90 | 90 | ->set( |
91 | 91 | Resolve\ResolveEntityFactory::class, |
92 | - static function (ContainerInterface $container) { |
|
92 | + static function(ContainerInterface $container) { |
|
93 | 93 | return new Resolve\ResolveEntityFactory( |
94 | 94 | $container->get(Config::class), |
95 | 95 | $container->get(EntityManager::class), |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | ) |
100 | 100 | ->set( |
101 | 101 | Criteria\CriteriaFactory::class, |
102 | - static function (ContainerInterface $container) { |
|
102 | + static function(ContainerInterface $container) { |
|
103 | 103 | return new Criteria\CriteriaFactory( |
104 | 104 | $container->get(Config::class), |
105 | 105 | $container->get(EntityManager::class), |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | ) |
111 | 111 | ->set( |
112 | 112 | Hydrator\HydratorFactory::class, |
113 | - static function (ContainerInterface $container) { |
|
113 | + static function(ContainerInterface $container) { |
|
114 | 114 | return new Hydrator\HydratorFactory( |
115 | 115 | $container->get(EntityManager::class), |
116 | 116 | $container->get(Metadata\Metadata::class), |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | ) |
120 | 120 | ->set( |
121 | 121 | Input\InputFactory::class, |
122 | - static function (ContainerInterface $container) { |
|
122 | + static function(ContainerInterface $container) { |
|
123 | 123 | return new Input\InputFactory( |
124 | 124 | $container->get(Config::class), |
125 | 125 | $container->get(EntityManager::class), |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | }, |
130 | 130 | ); |
131 | 131 | |
132 | - if (! $this->get(Config::class)->getGlobalEnable()) { |
|
132 | + if (!$this->get(Config::class)->getGlobalEnable()) { |
|
133 | 133 | return; |
134 | 134 | } |
135 | 135 |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | * Be warned, using the same groupSuffix with two different |
25 | 25 | * groups can cause collisions. |
26 | 26 | */ |
27 | - protected string|null $groupSuffix = null; |
|
27 | + protected string | null $groupSuffix = null; |
|
28 | 28 | |
29 | 29 | /** |
30 | 30 | * @var bool When set to true hydrator results will be cached for the |
@@ -52,14 +52,14 @@ discard block |
||
52 | 52 | * all hydrators will extract by reference. This overrides |
53 | 53 | * per-entity attribute configuration. |
54 | 54 | */ |
55 | - protected bool|null $globalByValue = null; |
|
55 | + protected bool | null $globalByValue = null; |
|
56 | 56 | |
57 | 57 | /** |
58 | 58 | * @var string|null When set, the entityPrefix will be removed from each |
59 | 59 | * type name. This simplifies type names and makes reading |
60 | 60 | * the GraphQL documentation easier. |
61 | 61 | */ |
62 | - protected string|null $entityPrefix = null; |
|
62 | + protected string | null $entityPrefix = null; |
|
63 | 63 | |
64 | 64 | /** |
65 | 65 | * @var bool When set to false the driver will have a unique instance of the |
@@ -95,14 +95,14 @@ discard block |
||
95 | 95 | return $this->group; |
96 | 96 | } |
97 | 97 | |
98 | - protected function setGroupSuffix(string|null $groupSuffix): self |
|
98 | + protected function setGroupSuffix(string | null $groupSuffix): self |
|
99 | 99 | { |
100 | 100 | $this->groupSuffix = $groupSuffix; |
101 | 101 | |
102 | 102 | return $this; |
103 | 103 | } |
104 | 104 | |
105 | - public function getGroupSuffix(): string|null |
|
105 | + public function getGroupSuffix(): string | null |
|
106 | 106 | { |
107 | 107 | return $this->groupSuffix; |
108 | 108 | } |
@@ -157,26 +157,26 @@ discard block |
||
157 | 157 | return $this->globalIgnore; |
158 | 158 | } |
159 | 159 | |
160 | - protected function setGlobalByValue(bool|null $globalByValue): self |
|
160 | + protected function setGlobalByValue(bool | null $globalByValue): self |
|
161 | 161 | { |
162 | 162 | $this->globalByValue = $globalByValue; |
163 | 163 | |
164 | 164 | return $this; |
165 | 165 | } |
166 | 166 | |
167 | - public function getGlobalByValue(): bool|null |
|
167 | + public function getGlobalByValue(): bool | null |
|
168 | 168 | { |
169 | 169 | return $this->globalByValue; |
170 | 170 | } |
171 | 171 | |
172 | - protected function setEntityPrefix(string|null $entityPrefix): self |
|
172 | + protected function setEntityPrefix(string | null $entityPrefix): self |
|
173 | 173 | { |
174 | 174 | $this->entityPrefix = $entityPrefix; |
175 | 175 | |
176 | 176 | return $this; |
177 | 177 | } |
178 | 178 | |
179 | - public function getEntityPrefix(): string|null |
|
179 | + public function getEntityPrefix(): string | null |
|
180 | 180 | { |
181 | 181 | return $this->entityPrefix; |
182 | 182 | } |