You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs: drop the 'bare single #[EnumValue] to silence' shortcut recommendation
Recommending users annotate a single case to silence the advisory is
actively misleading: once the default flips, every other case would
disappear from the schema — the exact opposite of what a user reaching
for the shortcut wanted. The honest recommendation is 'annotate every
case you want to keep exposed', which aligns their intent with the
post-flip behaviour.
- Warning message rewritten around 'add to every case you want exposed,
omit only from cases you want hidden' instead of 'at least one case
silences this notice'.
- descriptions.md migration subsection mirrors the same framing.
- Color/Size/Position test fixtures now annotate every case, not just
the first one, so they demonstrate the correct migration pattern
rather than the misleading shortcut.
Copy file name to clipboardExpand all lines: src/Mappers/Root/EnumTypeMapper.php
+6-8Lines changed: 6 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -197,12 +197,10 @@ private function mapByClassName(string $enumClass): EnumType|null
197
197
*
198
198
* Today every case is automatically exposed in the schema regardless of `#[EnumValue]` —
199
199
* this call site keeps that behaviour intact. The notice announces the planned migration:
200
-
* a future major release will require at least one `#[EnumValue]`-annotated case per
201
-
* `#[Type]`-mapped enum, and only annotated cases will participate in the schema
202
-
* (mirroring `#[Field]`'s opt-in model on classes). Partial annotation is deliberately
203
-
* allowed and intentionally silent — leaving some cases unannotated is the mechanism that
204
-
* hides internal cases from the public schema once the default flips, so it must not
205
-
* itself produce a warning.
200
+
* a future major release will require `#[EnumValue]` on each case that should participate
201
+
* in the schema, and unannotated cases will be hidden (mirroring `#[Field]`'s opt-in
202
+
* model on classes). Partial annotation is deliberately allowed and intentionally silent
203
+
* so that leaving some cases unannotated can be used to hide them once the default flips.
206
204
*
207
205
* @param class-string<UnitEnum> $enumClass
208
206
*/
@@ -211,8 +209,8 @@ private function warnEnumHasNoEnumValueAttribute(string $enumClass): void
211
209
trigger_error(
212
210
sprintf(
213
211
'Enum "%s" is mapped to a GraphQL enum type but declares no #[EnumValue] attributes on any case. '
214
-
. 'Today every case is automatically exposed; a future major release will require at least one #[EnumValue]-annotated case per #[Type]-mapped enum, and only annotated cases will participate in the schema (mirroring #[Field]\'s opt-in model on classes). '
215
-
. 'Add #[EnumValue] to the case(s) you want to expose — annotating at least one case acknowledges the opt-in model and silences this notice. Cases left unannotated will be hidden from the schema after the future default flip, which is the intended way to keep internal values out of the public API.',
212
+
. 'Today every case is automatically exposed; a future major release will require #[EnumValue] on each case that should participate in the schema, and unannotated cases will be hidden (mirroring #[Field]\'s opt-in model on classes). '
213
+
. 'Add #[EnumValue] to every case you want to keep exposed. Omit it only from cases you want hidden from the public schema after the future default flip.',
0 commit comments