@@ -34,7 +34,7 @@ discard block |
||
| 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 |
||
| 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 | ); |
@@ -28,7 +28,7 @@ |
||
| 28 | 28 | { |
| 29 | 29 | $id = strtolower($id); |
| 30 | 30 | |
| 31 | - if (! $this->has($id)) { |
|
| 31 | + if (!$this->has($id)) { |
|
| 32 | 32 | throw new Error($id . ' is not registered'); |
| 33 | 33 | } |
| 34 | 34 | |
@@ -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,7 +47,7 @@ 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 | |
@@ -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,7 +200,7 @@ 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 | } |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | $this->hydratorFactory = $container->get(HydratorContainer::class); |
| 66 | 66 | $this->typeContainer = $container->get(TypeContainer::class); |
| 67 | 67 | |
| 68 | - if (! isset($container->get('metadata')[$typeName])) { |
|
| 68 | + if (!isset($container->get('metadata')[$typeName])) { |
|
| 69 | 69 | throw new Error( |
| 70 | 70 | 'Entity ' . $typeName . ' is not mapped in the metadata', |
| 71 | 71 | ); |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | $classMetadata = $this->entityManager->getClassMetadata($this->getEntityClass()); |
| 157 | 157 | |
| 158 | 158 | foreach ($classMetadata->getFieldNames() as $fieldName) { |
| 159 | - if (! in_array($fieldName, array_keys($this->metadata['fields']))) { |
|
| 159 | + if (!in_array($fieldName, array_keys($this->metadata['fields']))) { |
|
| 160 | 160 | continue; |
| 161 | 161 | } |
| 162 | 162 | |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | $classMetadata = $this->entityManager->getClassMetadata($this->getEntityClass()); |
| 175 | 175 | |
| 176 | 176 | foreach ($classMetadata->getAssociationNames() as $associationName) { |
| 177 | - if (! in_array($associationName, array_keys($this->metadata['fields']))) { |
|
| 177 | + if (!in_array($associationName, array_keys($this->metadata['fields']))) { |
|
| 178 | 178 | continue; |
| 179 | 179 | } |
| 180 | 180 | |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | ]) |
| 188 | 188 | ) { |
| 189 | 189 | $targetEntity = $associationMetadata['targetEntity']; |
| 190 | - $fields[$associationName] = function () use ($targetEntity) { |
|
| 190 | + $fields[$associationName] = function() use ($targetEntity) { |
|
| 191 | 191 | $entity = $this->entityTypeContainer->get($targetEntity); |
| 192 | 192 | |
| 193 | 193 | return [ |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | |
| 202 | 202 | // Collections |
| 203 | 203 | $targetEntity = $associationMetadata['targetEntity']; |
| 204 | - $fields[$associationName] = function () use ($targetEntity, $associationName) { |
|
| 204 | + $fields[$associationName] = function() use ($targetEntity, $associationName) { |
|
| 205 | 205 | $entity = $this->entityTypeContainer->get($targetEntity); |
| 206 | 206 | $shortName = $this->getTypeName() . '_' . ucwords($associationName); |
| 207 | 207 | |
@@ -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', |