Skip to content

Handle unknown discriminators with component exceptions instead of PHP warnings and TypeError #33

@javihgil

Description

@javihgil

Problem

Unknown discriminator values currently end in undefined array access and type errors in NodeDiscriminator::getClassNameForDiscriminator() or getFormTypeFromDiscriminator().

Current behavior

If a discriminator is not configured, the component can emit PHP warnings and then fail with a TypeError because null is returned where a string is expected.

Expected behavior

Unknown discriminators should fail with the component's own exceptions, such as MissingClassDiscriminatorException or MissingFormTypeException.

Why it matters

This would make debugging and production failures much clearer, especially in polymorphic collections driven by user input or CMS configuration.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions