Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. NotNormalizableValueException.php

class NotNormalizableValueException

@author Christian Flothmann <christian.flothmann@sensiolabs.de>

Hierarchy

  • class \Symfony\Component\Serializer\Exception\UnexpectedValueException extends \Symfony\Component\Serializer\Exception\UnexpectedValueException implements \Symfony\Component\Serializer\Exception\ExceptionInterface
    • class \Symfony\Component\Serializer\Exception\UnexpectedValueException extends \Symfony\Component\Serializer\Exception\UnexpectedValueException implements \Symfony\Component\Serializer\Exception\ExceptionInterface
      • class \Symfony\Component\Serializer\Exception\NotNormalizableValueException extends \Symfony\Component\Serializer\Exception\UnexpectedValueException

Expanded class hierarchy of NotNormalizableValueException

11 files declare their use of NotNormalizableValueException
AbstractNormalizer.php in vendor/symfony/serializer/Normalizer/AbstractNormalizer.php
AbstractObjectNormalizer.php in vendor/symfony/serializer/Normalizer/AbstractObjectNormalizer.php
ArrayDenormalizer.php in vendor/symfony/serializer/Normalizer/ArrayDenormalizer.php
BackedEnumNormalizer.php in vendor/symfony/serializer/Normalizer/BackedEnumNormalizer.php
DataUriNormalizer.php in vendor/symfony/serializer/Normalizer/DataUriNormalizer.php

... See full list

File

vendor/symfony/serializer/Exception/NotNormalizableValueException.php, line 17

Namespace

Symfony\Component\Serializer\Exception
View source
class NotNormalizableValueException extends UnexpectedValueException {
    private ?string $currentType = null;
    private ?array $expectedTypes = null;
    private ?string $path = null;
    private bool $useMessageForUser = false;
    
    /**
     * @param list<string|\Stringable> $expectedTypes
     * @param bool                     $useMessageForUser If the message passed to this exception is something that can be shown
     *                                                    safely to your user. In other words, avoid catching other exceptions and
     *                                                    passing their message directly to this class.
     */
    public static function createForUnexpectedDataType(string $message, mixed $data, array $expectedTypes, ?string $path = null, bool $useMessageForUser = false, int $code = 0, ?\Throwable $previous = null) : self {
        $self = new self($message, $code, $previous);
        $self->currentType = get_debug_type($data);
        $self->expectedTypes = array_map(strval(...), $expectedTypes);
        $self->path = $path;
        $self->useMessageForUser = $useMessageForUser;
        return $self;
    }
    public function getCurrentType() : ?string {
        return $this->currentType;
    }
    
    /**
     * @return string[]|null
     */
    public function getExpectedTypes() : ?array {
        return $this->expectedTypes;
    }
    public function getPath() : ?string {
        return $this->path;
    }
    public function canUseMessageForUser() : ?bool {
        return $this->useMessageForUser;
    }

}

Members

Title Sort descending Modifiers Object type Summary
NotNormalizableValueException::$currentType private property
NotNormalizableValueException::$expectedTypes private property
NotNormalizableValueException::$path private property
NotNormalizableValueException::$useMessageForUser private property
NotNormalizableValueException::canUseMessageForUser public function
NotNormalizableValueException::createForUnexpectedDataType public static function
NotNormalizableValueException::getCurrentType public function
NotNormalizableValueException::getExpectedTypes public function
NotNormalizableValueException::getPath public function

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal