Passed
Pull Request — main (#91)
by Tom
02:58
created
src/Attribute/Association.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -12,8 +12,8 @@  discard block
 block discarded – undo
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,
15
+        protected string | null $strategy = null,
16
+        protected string | null $description = null,
17 17
         protected array $excludeCriteria = [],
18 18
     ) {
19 19
     }
@@ -23,12 +23,12 @@  discard block
 block discarded – undo
23 23
         return $this->group;
24 24
     }
25 25
 
26
-    public function getStrategy(): string|null
26
+    public function getStrategy(): string | null
27 27
     {
28 28
         return $this->strategy;
29 29
     }
30 30
 
31
-    public function getDescription(): string|null
31
+    public function getDescription(): string | null
32 32
     {
33 33
         return $this->description;
34 34
     }
Please login to merge, or discard this patch.
src/Attribute/Field.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -11,9 +11,9 @@  discard block
 block discarded – undo
11 11
 {
12 12
     public function __construct(
13 13
         protected string $group = 'default',
14
-        protected string|null $strategy = null,
15
-        protected string|null $description = null,
16
-        protected string|null $type = null,
14
+        protected string | null $strategy = null,
15
+        protected string | null $description = null,
16
+        protected string | null $type = null,
17 17
     ) {
18 18
     }
19 19
 
@@ -22,17 +22,17 @@  discard block
 block discarded – undo
22 22
         return $this->group;
23 23
     }
24 24
 
25
-    public function getStrategy(): string|null
25
+    public function getStrategy(): string | null
26 26
     {
27 27
         return $this->strategy;
28 28
     }
29 29
 
30
-    public function getDescription(): string|null
30
+    public function getDescription(): string | null
31 31
     {
32 32
         return $this->description;
33 33
     }
34 34
 
35
-    public function getType(): string|null
35
+    public function getType(): string | null
36 36
     {
37 37
         return $this->type;
38 38
     }
Please login to merge, or discard this patch.
src/Type/Entity.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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,
Please login to merge, or discard this patch.
src/Services.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -22,16 +22,16 @@  discard block
 block discarded – undo
22 22
      */
23 23
     public function __construct(
24 24
         EntityManager $entityManager,
25
-        Config|null $config = null,
26
-        array|null $metadataConfig = null,
25
+        Config | null $config = null,
26
+        array | null $metadataConfig = null,
27 27
     ) {
28 28
         $this
29 29
             // Plain classes
30 30
             ->set(EntityManager::class, $entityManager)
31 31
             ->set(
32 32
                 Config::class,
33
-                static function () use ($config) {
34
-                    if (! $config) {
33
+                static function() use ($config) {
34
+                    if (!$config) {
35 35
                         $config = new Config();
36 36
                     }
37 37
 
@@ -48,13 +48,13 @@  discard block
 block discarded – undo
48 48
             )
49 49
             ->set(
50 50
                 Metadata\Metadata::class,
51
-                static function (ContainerInterface $container) use ($metadataConfig) {
51
+                static function(ContainerInterface $container) use ($metadataConfig) {
52 52
                     return (new Metadata\MetadataFactory($container, $metadataConfig))->getMetadata();
53 53
                 },
54 54
             )
55 55
             ->set(
56 56
                 Resolve\FieldResolver::class,
57
-                static function (ContainerInterface $container) {
57
+                static function(ContainerInterface $container) {
58 58
                     return new Resolve\FieldResolver(
59 59
                         $container->get(Config::class),
60 60
                         $container->get(Metadata\Metadata::class),
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
             )
64 64
             ->set(
65 65
                 Resolve\ResolveCollectionFactory::class,
66
-                static function (ContainerInterface $container) {
66
+                static function(ContainerInterface $container) {
67 67
                     return new Resolve\ResolveCollectionFactory(
68 68
                         $container->get(EntityManager::class),
69 69
                         $container->get(Config::class),
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
             )
75 75
             ->set(
76 76
                 Resolve\ResolveEntityFactory::class,
77
-                static function (ContainerInterface $container) {
77
+                static function(ContainerInterface $container) {
78 78
                     return new Resolve\ResolveEntityFactory(
79 79
                         $container->get(Config::class),
80 80
                         $container->get(EntityManager::class),
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
             )
85 85
             ->set(
86 86
                 Criteria\CriteriaFactory::class,
87
-                static function (ContainerInterface $container) {
87
+                static function(ContainerInterface $container) {
88 88
                     return new Criteria\CriteriaFactory(
89 89
                         $container->get(Config::class),
90 90
                         $container->get(EntityManager::class),
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
             )
96 96
             ->set(
97 97
                 Hydrator\HydratorFactory::class,
98
-                static function (ContainerInterface $container) {
98
+                static function(ContainerInterface $container) {
99 99
                     return new Hydrator\HydratorFactory(
100 100
                         $container->get(EntityManager::class),
101 101
                         $container->get(Metadata\Metadata::class),
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
             )
105 105
             ->set(
106 106
                 Input\InputFactory::class,
107
-                static function (ContainerInterface $container) {
107
+                static function(ContainerInterface $container) {
108 108
                     return new Input\InputFactory(
109 109
                         $container->get(Config::class),
110 110
                         $container->get(EntityManager::class),
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
@@ -22,12 +22,12 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
         /** @psalm-suppress UndefinedDocblockClass */
Please login to merge, or discard this patch.
src/Metadata/Metadata.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -13,27 +13,27 @@
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
src/Criteria/CriteriaFactory.php 1 patch
Spacing   +12 added lines, -12 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
 
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
 
263 263
         $arrayObject = new ArrayObject([
264 264
             'name' => $typeName,
265
-            'fields' => static function () use ($fields) {
265
+            'fields' => static function() use ($fields) {
266 266
                 return $fields;
267 267
             },
268 268
         ]);
Please login to merge, or discard this patch.
src/Resolve/ResolveCollectionFactory.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
211 211
             ];
212 212
 
213 213
             $lastCursor = $cursor;
214
-            if (! $firstCursor) {
214
+            if (!$firstCursor) {
215 215
                 $firstCursor = $cursor;
216 216
             }
217 217
 
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
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 
33 33
     public function get(Entity $entity, string $eventName): Closure
34 34
     {
35
-        return function ($objectValue, array $args, $context, ResolveInfo $info) use ($entity, $eventName) {
35
+        return function($objectValue, array $args, $context, ResolveInfo $info) use ($entity, $eventName) {
36 36
             $entityClass = $entity->getEntityClass();
37 37
 
38 38
             $queryBuilderFilter = (new Applicator($this->entityManager, $entityClass))
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
         $paginator = new Paginator($queryBuilder->getQuery());
192 192
         $itemCount = $paginator->count();
193 193
 
194
-        if ($last && ! $before) {
194
+        if ($last && !$before) {
195 195
             $offset = $itemCount - $last;
196 196
             $queryBuilder->setFirstResult($offset);
197 197
             $paginator = new Paginator($queryBuilder->getQuery());
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
             ];
211 211
 
212 212
             $lastCursor = $cursor;
213
-            if (! $firstCursor) {
213
+            if (!$firstCursor) {
214 214
                 $firstCursor = $cursor;
215 215
             }
216 216
 
Please login to merge, or discard this patch.