@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | * Be warned, using the same groupSuffix with two different |
21 | 21 | * groups can cause collisions. |
22 | 22 | */ |
23 | - protected string|null $groupSuffix = null; |
|
23 | + protected string | null $groupSuffix = null; |
|
24 | 24 | |
25 | 25 | /** |
26 | 26 | * @var bool When set to true hydrator results will be cached for the |
@@ -48,14 +48,14 @@ discard block |
||
48 | 48 | * all hydrators will extract by reference. This overrides |
49 | 49 | * per-entity attribute configuration. |
50 | 50 | */ |
51 | - protected bool|null $globalByValue = null; |
|
51 | + protected bool | null $globalByValue = null; |
|
52 | 52 | |
53 | 53 | /** |
54 | 54 | * @var string|null When set, the entityPrefix will be removed from each |
55 | 55 | * type name. This simplifies type names and makes reading |
56 | 56 | * the GraphQL documentation easier. |
57 | 57 | */ |
58 | - protected string|null $entityPrefix = null; |
|
58 | + protected string | null $entityPrefix = null; |
|
59 | 59 | |
60 | 60 | /** @param mixed[] $config */ |
61 | 61 | public function __construct(array $config = []) |
@@ -82,14 +82,14 @@ discard block |
||
82 | 82 | return $this->group; |
83 | 83 | } |
84 | 84 | |
85 | - protected function setGroupSuffix(string|null $groupSuffix): self |
|
85 | + protected function setGroupSuffix(string | null $groupSuffix): self |
|
86 | 86 | { |
87 | 87 | $this->groupSuffix = $groupSuffix; |
88 | 88 | |
89 | 89 | return $this; |
90 | 90 | } |
91 | 91 | |
92 | - public function getGroupSuffix(): string|null |
|
92 | + public function getGroupSuffix(): string | null |
|
93 | 93 | { |
94 | 94 | return $this->groupSuffix; |
95 | 95 | } |
@@ -144,26 +144,26 @@ discard block |
||
144 | 144 | return $this->globalIgnore; |
145 | 145 | } |
146 | 146 | |
147 | - protected function setGlobalByValue(bool|null $globalByValue): self |
|
147 | + protected function setGlobalByValue(bool | null $globalByValue): self |
|
148 | 148 | { |
149 | 149 | $this->globalByValue = $globalByValue; |
150 | 150 | |
151 | 151 | return $this; |
152 | 152 | } |
153 | 153 | |
154 | - public function getGlobalByValue(): bool|null |
|
154 | + public function getGlobalByValue(): bool | null |
|
155 | 155 | { |
156 | 156 | return $this->globalByValue; |
157 | 157 | } |
158 | 158 | |
159 | - protected function setEntityPrefix(string|null $entityPrefix): self |
|
159 | + protected function setEntityPrefix(string | null $entityPrefix): self |
|
160 | 160 | { |
161 | 161 | $this->entityPrefix = $entityPrefix; |
162 | 162 | |
163 | 163 | return $this; |
164 | 164 | } |
165 | 165 | |
166 | - public function getEntityPrefix(): string|null |
|
166 | + public function getEntityPrefix(): string | null |
|
167 | 167 | { |
168 | 168 | return $this->entityPrefix; |
169 | 169 | } |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | $fields = []; |
42 | 42 | $targetEntity = $this->typeManager->build(Entity::class, $id); |
43 | 43 | |
44 | - if (! count($requiredFields) && ! count($optionalFields)) { |
|
44 | + if (!count($requiredFields) && !count($optionalFields)) { |
|
45 | 45 | $this->addAllFieldsAsRequired($targetEntity, $fields); |
46 | 46 | } else { |
47 | 47 | $this->addRequiredFields($targetEntity, $requiredFields, $fields); |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | array &$fields, |
66 | 66 | ): void { |
67 | 67 | foreach ($this->entityManager->getClassMetadata($targetEntity->getEntityClass())->getFieldNames() as $fieldName) { |
68 | - if (! in_array($fieldName, $optionalFields) && $optionalFields !== ['*']) { |
|
68 | + if (!in_array($fieldName, $optionalFields) && $optionalFields !== ['*']) { |
|
69 | 69 | continue; |
70 | 70 | } |
71 | 71 | |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | array &$fields, |
97 | 97 | ): void { |
98 | 98 | foreach ($this->entityManager->getClassMetadata($targetEntity->getEntityClass())->getFieldNames() as $fieldName) { |
99 | - if (! in_array($fieldName, $requiredFields) && $requiredFields !== ['*']) { |
|
99 | + if (!in_array($fieldName, $requiredFields) && $requiredFields !== ['*']) { |
|
100 | 100 | continue; |
101 | 101 | } |
102 | 102 |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | */ |
23 | 23 | public function __construct( |
24 | 24 | EntityManager $entityManager, |
25 | - Config|null $config = null, |
|
25 | + Config | null $config = null, |
|
26 | 26 | array $metadata = [], |
27 | 27 | ) { |
28 | 28 | $this |
@@ -30,8 +30,8 @@ discard block |
||
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,7 +48,7 @@ discard block |
||
48 | 48 | ) |
49 | 49 | ->set( |
50 | 50 | 'metadata', |
51 | - static function (AbstractContainer $container) use ($metadata) { |
|
51 | + static function(AbstractContainer $container) use ($metadata) { |
|
52 | 52 | return (new Metadata\MetadataFactory( |
53 | 53 | $metadata, |
54 | 54 | $container->get(EntityManager::class), |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | ) |
60 | 60 | ->set( |
61 | 61 | Metadata\GlobalEnable::class, |
62 | - static function (AbstractContainer $container) { |
|
62 | + static function(AbstractContainer $container) { |
|
63 | 63 | return new Metadata\GlobalEnable( |
64 | 64 | $container->get(EntityManager::class), |
65 | 65 | $container->get(Config::class), |
@@ -68,7 +68,7 @@ discard block |
||
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\TypeManager::class), |
@@ -77,7 +77,7 @@ discard block |
||
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 |
||
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), |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | ) |
101 | 101 | ->set( |
102 | 102 | Criteria\CriteriaFactory::class, |
103 | - static function (AbstractContainer $container) { |
|
103 | + static function(AbstractContainer $container) { |
|
104 | 104 | return new Criteria\CriteriaFactory( |
105 | 105 | $container->get(Config::class), |
106 | 106 | $container->get(EntityManager::class), |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | ) |
112 | 112 | ->set( |
113 | 113 | Hydrator\HydratorFactory::class, |
114 | - static function (AbstractContainer $container) { |
|
114 | + static function(AbstractContainer $container) { |
|
115 | 115 | return new Hydrator\HydratorFactory( |
116 | 116 | $container->get(EntityManager::class), |
117 | 117 | $container->get(Type\TypeManager::class), |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | ) |
121 | 121 | ->set( |
122 | 122 | Input\InputFactory::class, |
123 | - static function (AbstractContainer $container) { |
|
123 | + static function(AbstractContainer $container) { |
|
124 | 124 | return new Input\InputFactory( |
125 | 125 | $container->get(Config::class), |
126 | 126 | $container->get(EntityManager::class), |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | $this->hydratorFactory = $container->get(HydratorFactory::class); |
58 | 58 | $this->typeManager = $container->get(TypeManager::class); |
59 | 59 | |
60 | - if (! isset($container->get('metadata')[$typeName])) { |
|
60 | + if (!isset($container->get('metadata')[$typeName])) { |
|
61 | 61 | throw new Error( |
62 | 62 | 'Entity ' . $typeName . ' is not mapped in the metadata', |
63 | 63 | ); |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | return $this->metadata['typeName']; |
82 | 82 | } |
83 | 83 | |
84 | - public function getDescription(): string|null |
|
84 | + public function getDescription(): string | null |
|
85 | 85 | { |
86 | 86 | return $this->metadata['description']; |
87 | 87 | } |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | $classMetadata = $this->entityManager->getClassMetadata($this->getEntityClass()); |
141 | 141 | |
142 | 142 | foreach ($classMetadata->getFieldNames() as $fieldName) { |
143 | - if (! in_array($fieldName, array_keys($this->metadata['fields']))) { |
|
143 | + if (!in_array($fieldName, array_keys($this->metadata['fields']))) { |
|
144 | 144 | continue; |
145 | 145 | } |
146 | 146 | |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | $classMetadata = $this->entityManager->getClassMetadata($this->getEntityClass()); |
159 | 159 | |
160 | 160 | foreach ($classMetadata->getAssociationNames() as $associationName) { |
161 | - if (! in_array($associationName, array_keys($this->metadata['fields']))) { |
|
161 | + if (!in_array($associationName, array_keys($this->metadata['fields']))) { |
|
162 | 162 | continue; |
163 | 163 | } |
164 | 164 | |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | case ClassMetadataInfo::MANY_TO_ONE: |
170 | 170 | case ClassMetadataInfo::TO_ONE: |
171 | 171 | $targetEntity = $associationMetadata['targetEntity']; |
172 | - $fields[$associationName] = function () use ($targetEntity) { |
|
172 | + $fields[$associationName] = function() use ($targetEntity) { |
|
173 | 173 | $entity = $this->typeManager->build(self::class, $targetEntity); |
174 | 174 | |
175 | 175 | return [ |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | case ClassMetadataInfo::MANY_TO_MANY: |
183 | 183 | case ClassMetadataInfo::TO_MANY: |
184 | 184 | $targetEntity = $associationMetadata['targetEntity']; |
185 | - $fields[$associationName] = function () use ($targetEntity, $associationName) { |
|
185 | + $fields[$associationName] = function() use ($targetEntity, $associationName) { |
|
186 | 186 | $entity = $this->typeManager->build(self::class, $targetEntity); |
187 | 187 | $shortName = $this->getTypeName() . '_' . $associationName; |
188 | 188 |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | } |
27 | 27 | |
28 | 28 | /** @return mixed[]|null */ |
29 | - public function __invoke(): array|null |
|
29 | + public function __invoke(): array | null |
|
30 | 30 | { |
31 | 31 | if ($this->metadata) { |
32 | 32 | return $this->metadata; |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | |
77 | 77 | // Only one matching instance per group is allowed |
78 | 78 | assert( |
79 | - ! $entityInstance, |
|
79 | + !$entityInstance, |
|
80 | 80 | 'Duplicate attribute found for entity ' |
81 | 81 | . $reflectionClass->getName() . ', group ' . $instance->getGroup(), |
82 | 82 | ); |
@@ -92,8 +92,7 @@ discard block |
||
92 | 92 | 'excludeCriteria' => $instance->getExcludeCriteria(), |
93 | 93 | 'description' => $instance->getDescription(), |
94 | 94 | 'typeName' => $instance->getTypeName() |
95 | - ? $this->appendGroupSuffix($instance->getTypeName()) : |
|
96 | - $this->getTypeName($reflectionClass->getName()), |
|
95 | + ? $this->appendGroupSuffix($instance->getTypeName()) : $this->getTypeName($reflectionClass->getName()), |
|
97 | 96 | ]; |
98 | 97 | } |
99 | 98 | } |
@@ -116,7 +115,7 @@ discard block |
||
116 | 115 | |
117 | 116 | // Only one matching instance per group is allowed |
118 | 117 | assert( |
119 | - ! $fieldInstance, |
|
118 | + !$fieldInstance, |
|
120 | 119 | 'Duplicate attribute found for field ' |
121 | 120 | . $fieldName . ', group ' . $instance->getGroup(), |
122 | 121 | ); |
@@ -167,7 +166,7 @@ discard block |
||
167 | 166 | |
168 | 167 | // Only one matching instance per group is allowed |
169 | 168 | assert( |
170 | - ! $associationInstance, |
|
169 | + !$associationInstance, |
|
171 | 170 | 'Duplicate attribute found for association ' |
172 | 171 | . $associationName . ', group ' . $instance->getGroup(), |
173 | 172 | ); |