Passed
Pull Request — main (#72)
by Tom
02:38
created
src/Metadata/MetadataFactory.php 1 patch
Spacing   +4 added lines, -5 removed lines patch added patch discarded remove patch
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 
96 96
             // Only one matching instance per group is allowed
97 97
             assert(
98
-                ! $entityInstance,
98
+                !$entityInstance,
99 99
                 'Duplicate attribute found for entity '
100 100
                 . $reflectionClass->getName() . ', group ' . $instance->getGroup(),
101 101
             );
@@ -112,8 +112,7 @@  discard block
 block discarded – undo
112 112
                 'excludeFilters' => Filters::toStringArray($instance->getExcludeFilters()),
113 113
                 'description' => $instance->getDescription(),
114 114
                 'typeName' => $instance->getTypeName()
115
-                    ? $this->appendGroupSuffix($instance->getTypeName()) :
116
-                    $this->getTypeName($reflectionClass->getName()),
115
+                    ? $this->appendGroupSuffix($instance->getTypeName()) : $this->getTypeName($reflectionClass->getName()),
117 116
             ];
118 117
         }
119 118
     }
@@ -139,7 +138,7 @@  discard block
 block discarded – undo
139 138
 
140 139
                 // Only one matching instance per group is allowed
141 140
                 assert(
142
-                    ! $fieldInstance,
141
+                    !$fieldInstance,
143 142
                     'Duplicate attribute found for field '
144 143
                     . $fieldName . ', group ' . $instance->getGroup(),
145 144
                 );
@@ -184,7 +183,7 @@  discard block
 block discarded – undo
184 183
 
185 184
                 // Only one matching instance per group is allowed
186 185
                 assert(
187
-                    ! $associationInstance,
186
+                    !$associationInstance,
188 187
                     'Duplicate attribute found for association '
189 188
                     . $associationName . ', group ' . $instance->getGroup(),
190 189
                 );
Please login to merge, or discard this patch.
src/Filter/Filters.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
     public static function fromArray(array $filters): array
89 89
     {
90 90
         $filters = array_map(
91
-            static function ($filter) {
91
+            static function($filter) {
92 92
                 return is_string($filter) ? Filters::from($filter) : $filter;
93 93
             },
94 94
             $filters,
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
     public static function toStringArray(array $filters): array
108 108
     {
109 109
         return array_map(
110
-            static function (Filters $filter) {
110
+            static function(Filters $filter) {
111 111
                 return $filter->value;
112 112
             },
113 113
             $filters,
Please login to merge, or discard this patch.
src/Attribute/ExcludeFilters.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
             $this->excludeFilters = array_udiff(
35 35
                 Filters::cases(),
36 36
                 $this->includeFilters,
37
-                static function (Filters $a1, Filters $a2) {
37
+                static function(Filters $a1, Filters $a2) {
38 38
                     return $a1->value <=> $a2->value;
39 39
                 },
40 40
             );
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
             $this->excludeFilters = array_uintersect(
43 43
                 Filters::cases(),
44 44
                 $this->excludeFilters,
45
-                static function (Filters $a1, Filters $a2) {
45
+                static function(Filters $a1, Filters $a2) {
46 46
                     return $a1->value <=> $a2->value;
47 47
                 },
48 48
             );
Please login to merge, or discard this patch.
src/Filter/FilterFactory.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -68,15 +68,15 @@  discard block
 block discarded – undo
68 68
         );
69 69
 
70 70
         // Get the allowed filters
71
-        $allowedFilters = array_udiff(Filters::cases(), $excludedFilters, static function ($a, $b) {
71
+        $allowedFilters = array_udiff(Filters::cases(), $excludedFilters, static function($a, $b) {
72 72
             return $a->value <=> $b->value;
73 73
         });
74 74
 
75 75
         // Limit association filters
76 76
         if ($associationName) {
77 77
             $excludeFilters = Filters::fromArray($associationMetadata['excludeFilters'] ?? []);
78
-            $allowedFilters = array_filter($allowedFilters, static function ($value) use ($excludeFilters) {
79
-                return ! in_array($value, $excludeFilters);
78
+            $allowedFilters = array_filter($allowedFilters, static function($value) use ($excludeFilters) {
79
+                return !in_array($value, $excludeFilters);
80 80
             });
81 81
         }
82 82
 
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 
111 111
         foreach ($classMetadata->getFieldNames() as $fieldName) {
112 112
             // Only process fields that are in the graphql metadata
113
-            if (! in_array($fieldName, array_keys($entityMetadata['fields']))) {
113
+            if (!in_array($fieldName, array_keys($entityMetadata['fields']))) {
114 114
                 continue;
115 115
             }
116 116
 
@@ -125,8 +125,8 @@  discard block
 block discarded – undo
125 125
                 $fieldExcludeFilters = Filters::fromArray($entityMetadata['fields'][$fieldName]['excludeFilters']);
126 126
                 $allowedFilters      = array_filter(
127 127
                     $allowedFilters,
128
-                    static function ($value) use ($fieldExcludeFilters) {
129
-                        return ! in_array($value, $fieldExcludeFilters);
128
+                    static function($value) use ($fieldExcludeFilters) {
129
+                        return !in_array($value, $fieldExcludeFilters);
130 130
                     },
131 131
                 );
132 132
             }
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
         // Add eq filter for to-one associations
160 160
         foreach ($classMetadata->getAssociationNames() as $associationName) {
161 161
             // Only process fields which are in the graphql metadata
162
-            if (! isset($entityMetadata['fields'][$associationName])) {
162
+            if (!isset($entityMetadata['fields'][$associationName])) {
163 163
                 continue;
164 164
             }
165 165
 
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
                     ClassMetadata::MANY_TO_MANY,
172 172
                     ClassMetadata::ONE_TO_MANY,
173 173
                 ])
174
-                || ! in_array(Filters::EQ, $allowedFilters)
174
+                || !in_array(Filters::EQ, $allowedFilters)
175 175
             ) {
176 176
                 continue;
177 177
             }
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
@@ -28,8 +28,8 @@  discard block
 block discarded – undo
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
 
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
             )
47 47
             ->set(
48 48
                 'metadata',
49
-                static function (AbstractContainer $container) use ($metadata) {
49
+                static function(AbstractContainer $container) use ($metadata) {
50 50
                     return (new Metadata\MetadataFactory(
51 51
                         $metadata,
52 52
                         $container->get(EntityManager::class),
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
             )
59 59
             ->set(
60 60
                 Metadata\GlobalEnable::class,
61
-                static function (AbstractContainer $container) {
61
+                static function(AbstractContainer $container) {
62 62
                     return new Metadata\GlobalEnable(
63 63
                         $container->get(EntityManager::class),
64 64
                         $container->get(Config::class),
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
             )
69 69
             ->set(
70 70
                 Resolve\FieldResolver::class,
71
-                static function (AbstractContainer $container) {
71
+                static function(AbstractContainer $container) {
72 72
                     return new Resolve\FieldResolver(
73 73
                         $container->get(Config::class),
74 74
                         $container->get(Type\Entity\EntityTypeManager::class),
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
             )
78 78
             ->set(
79 79
                 Resolve\ResolveCollectionFactory::class,
80
-                static function (AbstractContainer $container) {
80
+                static function(AbstractContainer $container) {
81 81
                     return new Resolve\ResolveCollectionFactory(
82 82
                         $container->get(EntityManager::class),
83 83
                         $container->get(Config::class),
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
             )
91 91
             ->set(
92 92
                 Resolve\ResolveEntityFactory::class,
93
-                static function (AbstractContainer $container) {
93
+                static function(AbstractContainer $container) {
94 94
                     return new Resolve\ResolveEntityFactory(
95 95
                         $container->get(Config::class),
96 96
                         $container->get(EntityManager::class),
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
             )
102 102
             ->set(
103 103
                 Filter\FilterFactory::class,
104
-                static function (AbstractContainer $container) {
104
+                static function(AbstractContainer $container) {
105 105
                     return new Filter\FilterFactory(
106 106
                         $container->get(Config::class),
107 107
                         $container->get(EntityManager::class),
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
             )
113 113
             ->set(
114 114
                 Hydrator\HydratorFactory::class,
115
-                static function (AbstractContainer $container) {
115
+                static function(AbstractContainer $container) {
116 116
                     return new Hydrator\HydratorFactory(
117 117
                         $container->get(EntityManager::class),
118 118
                         $container->get(Type\Entity\EntityTypeManager::class),
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
             )
122 122
             ->set(
123 123
                 Input\InputFactory::class,
124
-                static function (AbstractContainer $container) {
124
+                static function(AbstractContainer $container) {
125 125
                     return new Input\InputFactory(
126 126
                         $container->get(Config::class),
127 127
                         $container->get(EntityManager::class),
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
             )
133 133
         ->set(
134 134
             Type\Entity\EntityTypeManager::class,
135
-            static function (AbstractContainer $container) {
135
+            static function(AbstractContainer $container) {
136 136
                 return new Type\Entity\EntityTypeManager(
137 137
                     $container,
138 138
                 );
Please login to merge, or discard this patch.
src/Type/Entity/Entity.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
         $this->hydratorFactory   = $container->get(HydratorFactory::class);
65 65
         $this->typeManager       = $container->get(TypeManager::class);
66 66
 
67
-        if (! isset($container->get('metadata')[$typeName])) {
67
+        if (!isset($container->get('metadata')[$typeName])) {
68 68
             throw new Error(
69 69
                 'Entity ' . $typeName . ' is not mapped in the metadata',
70 70
             );
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
         $classMetadata = $this->entityManager->getClassMetadata($this->getEntityClass());
156 156
 
157 157
         foreach ($classMetadata->getFieldNames() as $fieldName) {
158
-            if (! in_array($fieldName, array_keys($this->metadata['fields']))) {
158
+            if (!in_array($fieldName, array_keys($this->metadata['fields']))) {
159 159
                 continue;
160 160
             }
161 161
 
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
         $classMetadata = $this->entityManager->getClassMetadata($this->getEntityClass());
174 174
 
175 175
         foreach ($classMetadata->getAssociationNames() as $associationName) {
176
-            if (! in_array($associationName, array_keys($this->metadata['fields']))) {
176
+            if (!in_array($associationName, array_keys($this->metadata['fields']))) {
177 177
                 continue;
178 178
             }
179 179
 
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
                 ])
187 187
             ) {
188 188
                 $targetEntity             = $associationMetadata['targetEntity'];
189
-                $fields[$associationName] = function () use ($targetEntity) {
189
+                $fields[$associationName] = function() use ($targetEntity) {
190 190
                     $entity = $this->entityTypeManager->get($targetEntity);
191 191
 
192 192
                     return [
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
 
201 201
             // Collections
202 202
             $targetEntity             = $associationMetadata['targetEntity'];
203
-            $fields[$associationName] = function () use ($targetEntity, $associationName) {
203
+            $fields[$associationName] = function() use ($targetEntity, $associationName) {
204 204
                 $entity    = $this->entityTypeManager->get($targetEntity);
205 205
                 $shortName = $this->getTypeName() . '_' . $associationName;
206 206
 
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
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
         $fields       = [];
46 46
         $targetEntity = $this->entityTypeManager->get($id);
47 47
 
48
-        if (! count($requiredFields) && ! count($optionalFields)) {
48
+        if (!count($requiredFields) && !count($optionalFields)) {
49 49
             $this->addAllFieldsAsRequired($targetEntity, $fields);
50 50
         } else {
51 51
             $this->addRequiredFields($targetEntity, $requiredFields, $fields);
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
         array &$fields,
70 70
     ): void {
71 71
         foreach ($this->entityManager->getClassMetadata($targetEntity->getEntityClass())->getFieldNames() as $fieldName) {
72
-            if (! in_array($fieldName, $optionalFields)) {
72
+            if (!in_array($fieldName, $optionalFields)) {
73 73
                 continue;
74 74
             }
75 75
 
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
         array &$fields,
103 103
     ): void {
104 104
         foreach ($this->entityManager->getClassMetadata($targetEntity->getEntityClass())->getFieldNames() as $fieldName) {
105
-            if (! in_array($fieldName, $requiredFields)) {
105
+            if (!in_array($fieldName, $requiredFields)) {
106 106
                 continue;
107 107
             }
108 108
 
Please login to merge, or discard this patch.