Passed
Pull Request — main (#84)
by Tom
02:37
created
src/AbstractContainer.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@
 block discarded – undo
25 25
     {
26 26
         $id = strtolower($id);
27 27
 
28
-        if (! $this->has($id)) {
28
+        if (!$this->has($id)) {
29 29
             throw new Error($id . ' is not registered');
30 30
         }
31 31
 
Please login to merge, or discard this patch.
src/Resolve/ResolveCollectionFactory.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 
52 52
     public function get(Entity $entity): Closure
53 53
     {
54
-        return function ($source, $args, $context, ResolveInfo $resolveInfo) {
54
+        return function($source, $args, $context, ResolveInfo $resolveInfo) {
55 55
             $fieldResolver = $this->fieldResolver;
56 56
             $collection    = $fieldResolver($source, $args, $context, $resolveInfo);
57 57
 
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
             // Get total count from collection then match
165 165
             $itemCount = count($collection->matching($criteria));
166 166
 
167
-            if ($last && ! $before) {
167
+            if ($last && !$before) {
168 168
                 $offset = $itemCount - $last;
169 169
             }
170 170
 
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
                 ];
193 193
 
194 194
                 $lastCursor = $cursor;
195
-                if (! $firstCursor) {
195
+                if (!$firstCursor) {
196 196
                     $firstCursor = $cursor;
197 197
                 }
198 198
 
Please login to merge, or discard this patch.
src/Resolve/ResolveEntityFactory.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 
29 29
     public function get(Entity $entity, string $eventName): Closure
30 30
     {
31
-        return function ($objectValue, array $args, $context, ResolveInfo $info) use ($entity, $eventName) {
31
+        return function($objectValue, array $args, $context, ResolveInfo $info) use ($entity, $eventName) {
32 32
             $entityClass = $entity->getEntityClass();
33 33
             // Resolve top level filters
34 34
             $filterTypes = $args['filter'] ?? [];
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
             $paginator = new Paginator($queryBuilder->getQuery());
158 158
             $itemCount = $paginator->count();
159 159
 
160
-            if ($last && ! $before) {
160
+            if ($last && !$before) {
161 161
                 $offset = $itemCount - $last;
162 162
                 $queryBuilder->setFirstResult($offset);
163 163
                 $paginator = new Paginator($queryBuilder->getQuery());
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
                 ];
177 177
 
178 178
                 $lastCursor = $cursor;
179
-                if (! $firstCursor) {
179
+                if (!$firstCursor) {
180 180
                     $firstCursor = $cursor;
181 181
                 }
182 182
 
Please login to merge, or discard this patch.
src/Resolve/FieldResolver.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@
 block discarded – undo
38 38
          * For disabled hydrator cache, store only last hydrator result and reuse for consecutive calls
39 39
          * then drop the cache if it doesn't hit.
40 40
          */
41
-        if (! $this->config->getUseHydratorCache()) {
41
+        if (!$this->config->getUseHydratorCache()) {
42 42
             if (isset($this->extractValues[$splObjectHash])) {
43 43
                 return $this->extractValues[$splObjectHash][$info->fieldName] ?? null;
44 44
             } else {
Please login to merge, or discard this patch.
src/Input/InputFactory.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
         return new InputObjectType([
43 43
             'name' => $targetEntity->getTypeName() . '_Input',
44 44
             'description' => $targetEntity->getDescription(),
45
-            'fields' => function () use ($id, $targetEntity, $requiredFields, $optionalFields): array {
45
+            'fields' => function() use ($id, $targetEntity, $requiredFields, $optionalFields): array {
46 46
                 $fields = [];
47 47
 
48 48
                 foreach ($this->entityManager->getClassMetadata($id)->getFieldNames() as $fieldName) {
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
                      * no reason to set or update an identifier.  For the case where an identifier
52 52
                      * should be set or updated, this facotry is not the correct solution.
53 53
                      */
54
-                    if (! empty($optionalFields)) {
54
+                    if (!empty($optionalFields)) {
55 55
                         // Include field as optional
56 56
                         if (in_array($fieldName, $optionalFields) || $optionalFields === ['*']) {
57 57
                             if ($optionalFields === ['*'] && $this->entityManager->getClassMetadata($id)->isIdentifier($fieldName)) {
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
                             $fields[$fieldName]['description'] = $targetEntity->getMetadataConfig()['fields'][$fieldName]['description'];
62 62
                             $fields[$fieldName]['type']        = $this->typeManager->get($targetEntity->getMetadataConfig()['fields'][$fieldName]['type']);
63 63
                         }
64
-                    } elseif (! empty($requiredFields)) {
64
+                    } elseif (!empty($requiredFields)) {
65 65
                         // Include fields as required
66 66
                         if (in_array($fieldName, $requiredFields) || $requiredFields === ['*']) {
67 67
                             if ($requiredFields === ['*'] && $this->entityManager->getClassMetadata($id)->isIdentifier($fieldName)) {
Please login to merge, or discard this patch.
src/Attribute/Entity.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
     private bool $byValue;
17 17
 
18 18
     /** @var string|null Documentation for the entity within GraphQL */
19
-    private string|null $description = null;
19
+    private string | null $description = null;
20 20
 
21 21
     /**
22 22
      * @var mixed[] An array of filters as
@@ -34,10 +34,10 @@  discard block
 block discarded – undo
34 34
     public function __construct(
35 35
         string $group = 'default',
36 36
         bool $byValue = true,
37
-        string|null $description = null,
38
-        private string|null $typeName = null,
37
+        string | null $description = null,
38
+        private string | null $typeName = null,
39 39
         array $filters = [],
40
-        private string|null $namingStrategy = null,
40
+        private string | null $namingStrategy = null,
41 41
         private array $excludeCriteria = [],
42 42
     ) {
43 43
         $this->group       = $group;
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
         $this->filters     = $filters;
47 47
     }
48 48
 
49
-    public function getGroup(): string|null
49
+    public function getGroup(): string | null
50 50
     {
51 51
         return $this->group;
52 52
     }
@@ -56,12 +56,12 @@  discard block
 block discarded – undo
56 56
         return $this->byValue;
57 57
     }
58 58
 
59
-    public function getDescription(): string|null
59
+    public function getDescription(): string | null
60 60
     {
61 61
         return $this->description;
62 62
     }
63 63
 
64
-    public function getTypeName(): string|null
64
+    public function getTypeName(): string | null
65 65
     {
66 66
         return $this->typeName;
67 67
     }
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
         return $this->filters;
73 73
     }
74 74
 
75
-    public function getNamingStrategy(): string|null
75
+    public function getNamingStrategy(): string | null
76 76
     {
77 77
         return $this->namingStrategy;
78 78
     }
Please login to merge, or discard this patch.
src/Metadata/MetadataFactory.php 1 patch
Spacing   +7 added lines, -8 removed lines patch added patch discarded remove patch
@@ -21,12 +21,12 @@  discard block
 block discarded – undo
21 21
 
22 22
 class MetadataFactory
23 23
 {
24
-    protected Metadata|null $metadata;
24
+    protected Metadata | null $metadata;
25 25
     protected EntityManager $entityManager;
26 26
     protected Config $config;
27 27
 
28 28
     /** @param mixed|null $metadataConfig */
29
-    public function __construct(protected ContainerInterface $container, protected array|null $metadataConfig)
29
+    public function __construct(protected ContainerInterface $container, protected array | null $metadataConfig)
30 30
     {
31 31
         $this->entityManager = $container->get(EntityManager::class);
32 32
         $this->config        = $container->get(Config::class);
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 
144 144
                 // Only one matching instance per group is allowed
145 145
                 assert(
146
-                    ! $entityInstance,
146
+                    !$entityInstance,
147 147
                     'Duplicate attribute found for entity '
148 148
                     . $entityClass . ', group ' . $instance->getGroup(),
149 149
                 );
@@ -163,8 +163,7 @@  discard block
 block discarded – undo
163 163
                     'excludeCriteria' => $instance->getExcludeCriteria(),
164 164
                     'description' => $instance->getDescription(),
165 165
                     'typeName' => $instance->getTypeName()
166
-                        ? $this->appendGroupSuffix($instance->getTypeName()) :
167
-                          $this->getTypeName($entityClass),
166
+                        ? $this->appendGroupSuffix($instance->getTypeName()) : $this->getTypeName($entityClass),
168 167
                 ];
169 168
             }
170 169
 
@@ -187,7 +186,7 @@  discard block
 block discarded – undo
187 186
 
188 187
                     // Only one matching instance per group is allowed
189 188
                     assert(
190
-                        ! $fieldInstance,
189
+                        !$fieldInstance,
191 190
                         'Duplicate attribute found for field '
192 191
                         . $fieldName . ', group ' . $instance->getGroup(),
193 192
                     );
@@ -230,7 +229,7 @@  discard block
 block discarded – undo
230 229
 
231 230
                     // Only one matching instance per group is allowed
232 231
                     assert(
233
-                        ! $associationInstance,
232
+                        !$associationInstance,
234 233
                         'Duplicate attribute found for association '
235 234
                         . $associationName . ', group ' . $instance->getGroup(),
236 235
                     );
@@ -294,7 +293,7 @@  discard block
 block discarded – undo
294 293
         return $this->appendGroupSuffix($this->stripEntityPrefix($entityClass));
295 294
     }
296 295
 
297
-    private function getDefaultStrategy(string|null $fieldType): string
296
+    private function getDefaultStrategy(string | null $fieldType): string
298 297
     {
299 298
         // Set default strategy based on field type
300 299
         /** @psalm-suppress UndefinedDocblockClass */
Please login to merge, or discard this patch.
src/Metadata/Metadata.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -11,20 +11,20 @@
 block discarded – undo
11 11
 
12 12
 class Metadata extends AbstractContainer
13 13
 {
14
-    public function __construct(protected ContainerInterface $container, protected array|null $metadataConfig)
14
+    public function __construct(protected ContainerInterface $container, protected array | null $metadataConfig)
15 15
     {
16 16
     }
17 17
 
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
 
Please login to merge, or discard this patch.
src/Criteria/CriteriaFactory.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -34,9 +34,9 @@  discard block
 block discarded – undo
34 34
     /** @param mixed[]|null $associationMetadata */
35 35
     public function get(
36 36
         Entity $targetEntity,
37
-        Entity|null $owningEntity = null,
38
-        string|null $associationName = null,
39
-        array|null $associationMetadata = null,
37
+        Entity | null $owningEntity = null,
38
+        string | null $associationName = null,
39
+        array | null $associationMetadata = null,
40 40
     ): InputObjectType {
41 41
         if ($owningEntity) {
42 42
             $typeName = $owningEntity->getTypeName() . '_' . $associationName . '_Filter';
@@ -74,16 +74,16 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
         ]);
Please login to merge, or discard this patch.