@@ -25,7 +25,7 @@ |
||
| 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 | |
@@ -38,7 +38,7 @@ |
||
| 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 { |
@@ -42,7 +42,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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)) { |
@@ -6,14 +6,14 @@ discard block |
||
| 6 | 6 | |
| 7 | 7 | use Attribute; |
| 8 | 8 | |
| 9 | -#[Attribute(Attribute::TARGET_PROPERTY|Attribute::IS_REPEATABLE)] |
|
| 9 | +#[Attribute(Attribute::TARGET_PROPERTY | Attribute::IS_REPEATABLE)] |
|
| 10 | 10 | class Association |
| 11 | 11 | { |
| 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 |
||
| 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 | } |
@@ -16,7 +16,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | } |
@@ -6,14 +6,14 @@ discard block |
||
| 6 | 6 | |
| 7 | 7 | use Attribute; |
| 8 | 8 | |
| 9 | -#[Attribute(Attribute::TARGET_PROPERTY|Attribute::IS_REPEATABLE)] |
|
| 9 | +#[Attribute(Attribute::TARGET_PROPERTY | Attribute::IS_REPEATABLE)] |
|
| 10 | 10 | class Field |
| 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 |
||
| 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 | } |
@@ -21,12 +21,12 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 */ |
@@ -11,20 +11,20 @@ |
||
| 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 | |
@@ -24,16 +24,16 @@ |
||
| 24 | 24 | public function __construct( |
| 25 | 25 | Driver $driver, |
| 26 | 26 | EntityManager $entityManager, |
| 27 | - Config|null $config = null, |
|
| 28 | - array|null $metadataConfig = null, |
|
| 27 | + Config | null $config = null, |
|
| 28 | + array | null $metadataConfig = null, |
|
| 29 | 29 | ) { |
| 30 | 30 | $driver |
| 31 | 31 | // Plain classes |
| 32 | 32 | ->set(EntityManager::class, $entityManager) |
| 33 | 33 | ->set( |
| 34 | 34 | Config::class, |
| 35 | - static function () use ($config) { |
|
| 36 | - if (! $config) { |
|
| 35 | + static function() use ($config) { |
|
| 36 | + if (!$config) { |
|
| 37 | 37 | $config = new Config(); |
| 38 | 38 | } |
| 39 | 39 | |