Skip to content

[Validator] New UnexpectedValueException #10551

@ro0NL

Description

@ro0NL

see symfony/symfony#27917 + symfony/symfony#12312

https://symfony.com/doc/current/validation/custom_constraint.html

instead of

if (!is_string($value)) {
-    throw new UnexpectedTypeException($value, 'string');
+    throw new UnexpectedValueException($value, 'string');
}

This will cause a violation to be raised instead.

The "string" value is used with This value should be of type {{ type }}., thus should be translator friendly. E.g. core uses phpdoc notation to avoid any grammar being used here (string|int instead of string or integer and Some&Other instead of Some and Other).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy