Skip to content

Commit 47ac4ba

Browse files
committed
Remove deprecated values from Enum
1 parent def9d46 commit 47ac4ba

File tree

5 files changed

+3
-44
lines changed

5 files changed

+3
-44
lines changed

UPGRADE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ UPGRADE FROM 0.14 to 1.0
88
* Removed deprecated `argsBuilder` from `Field`
99
* Removed deprecated `args` from `Field`
1010
* Removed deprecated `builders` from `Type`
11+
* Removed deprecated `values` from `Enum`
1112

1213
UPGRADE FROM 0.13 to 0.14
1314
=========================

src/Annotation/Enum.php

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,23 +22,11 @@ final class Enum extends Annotation
2222
*/
2323
public ?string $name;
2424

25-
/**
26-
* @var array<\Overblog\GraphQLBundle\Annotation\EnumValue>
27-
*
28-
* @deprecated
29-
*/
30-
public array $values;
31-
3225
/**
3326
* @param string|null $name The GraphQL name of the enum
34-
* @param array<EnumValue> $values An array of @GQL\EnumValue @deprecated
3527
*/
36-
public function __construct(?string $name = null, array $values = [])
28+
public function __construct(?string $name = null)
3729
{
3830
$this->name = $name;
39-
$this->values = $values;
40-
if (!empty($values)) {
41-
@trigger_error('The attributes "values" on annotation @GQL\Enum is deprecated as of 0.14 and will be removed in 1.0. Use the @GQL\EnumValue annotation on the class itself instead.', E_USER_DEPRECATED);
42-
}
4331
}
4432
}

src/Config/Parser/MetadataParser/MetadataParser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ private static function scalarMetadataToGQLConfiguration(ReflectionClass $reflec
431431
private static function enumMetadataToGQLConfiguration(ReflectionClass $reflectionClass, Metadata\Enum $enumMetadata): array
432432
{
433433
$metadatas = static::getMetadatas($reflectionClass);
434-
$enumValues = array_merge(self::getMetadataMatching($metadatas, Metadata\EnumValue::class), $enumMetadata->values);
434+
$enumValues = self::getMetadataMatching($metadatas, Metadata\EnumValue::class);
435435

436436
$values = [];
437437

tests/Config/Parser/AnnotationParserTest.php

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,4 @@ public function testNoDoctrineAnnotations(): void
5050
$this->assertMatchesRegularExpression('/doctrine\/annotations/', $e->getPrevious()->getMessage());
5151
}
5252
}
53-
54-
public function testLegacyEnumNestedValue(): void
55-
{
56-
$this->config = self::cleanConfig($this->parser('parse', new SplFileInfo(__DIR__.'/fixtures/annotations/Deprecated/DeprecatedEnum.php'), $this->containerBuilder, ['doctrine' => ['types_mapping' => []]]));
57-
$this->expect('DeprecatedEnum', 'enum', [
58-
'values' => [
59-
'P1' => ['value' => 1, 'description' => 'P1 description'],
60-
'P2' => ['value' => 2, 'deprecationReason' => 'P2 deprecated'],
61-
],
62-
]);
63-
}
6453
}

tests/Config/Parser/fixtures/annotations/Deprecated/DeprecatedEnum.php

Lines changed: 0 additions & 19 deletions
This file was deleted.

0 commit comments

Comments
 (0)